changeset 42:91e927584f92

Code cleanup
author koryspansel
date Thu, 22 Sep 2011 10:38:54 -0700
parents a986355cca5f
children d27c06bd8ce1
files LightClone/LightClone.vcproj LightClone/Source/Bot.cpp LightClone/Source/CameraController.cpp LightClone/Source/CameraController.h LightClone/Source/Core.h LightClone/Source/Dialog.cpp LightClone/Source/Environment.cpp LightClone/Source/Environment.h
diffstat 8 files changed, 7 insertions(+), 140 deletions(-) [+]
line wrap: on
line diff
--- a/LightClone/LightClone.vcproj	Thu Sep 22 10:25:35 2011 -0700
+++ b/LightClone/LightClone.vcproj	Thu Sep 22 10:38:54 2011 -0700
@@ -193,10 +193,6 @@
 				>
 			</File>
 			<File
-				RelativePath=".\Source\Dialog.cpp"
-				>
-			</File>
-			<File
 				RelativePath=".\Source\Environment.cpp"
 				>
 			</File>
--- a/LightClone/Source/Bot.cpp	Thu Sep 22 10:25:35 2011 -0700
+++ b/LightClone/Source/Bot.cpp	Thu Sep 22 10:38:54 2011 -0700
@@ -386,46 +386,6 @@
 }
 
 /*
- * Compile
- */
-/*
-ErrorCode Bot::Compile(Code* pInstance, uint8* pData, uint32 nSize)
-{
-	const uint32 nLength = pInstance->GetLength();
-
-	for(uint32 i = 0; i < nLength; ++i)
-	{
-		const uint32 nAction = pInstance->GetSlot(i);
-
-		if(Action_Forward <= nAction && nAction <= Action_Light)
-		{
-			if(nSize < 2)
-				return Error_Fail;
-
-			*pData++ = Instruction_Action;
-			*pData++ = nAction;
-
-			nSize -= 2;
-		}
-		else
-
-		if(Action_FunctionA <= nAction && nAction <= Action_FunctionB)
-		{
-			if(nSize < 2)
-				return Error_Fail;
-
-			*pData++ = Instruction_Call;
-			*pData++ = nAction - Action_FunctionA + 1;
-
-			nSize -= 2;
-		}
-	}
-
-	return Error_Success;
-}
-*/
-
-/*
  * SetupVertexBuffer
  */
 ErrorCode Bot::SetupVertexBuffer()
--- a/LightClone/Source/CameraController.cpp	Thu Sep 22 10:25:35 2011 -0700
+++ b/LightClone/Source/CameraController.cpp	Thu Sep 22 10:38:54 2011 -0700
@@ -70,30 +70,6 @@
 }
 
 /*
- * GetDirection
- */
-const D3DXVECTOR3 CameraController::GetDirection() const
-{
-	return D3DXVECTOR3(0.0f, 0.0f, 1.0f);
-}
-
-/*
- * GetRight
- */
-const D3DXVECTOR3 CameraController::GetRight() const
-{
-	return D3DXVECTOR3(1.0f, 0.0f, 0.0f);
-}
-
-/*
- * GetUp
- */
-const D3DXVECTOR3 CameraController::GetUp() const
-{
-	return D3DXVECTOR3(0.0f, 1.0f, 0.0f);
-}
-
-/*
  * GetProjection
  */
 const D3DXMATRIX CameraController::GetProjection(const D3DVIEWPORT9& kViewport) const
@@ -129,10 +105,7 @@
 	
 	if(nMode == CameraMode_3D)
 	{
-		const D3DXVECTOR3& kLocation = GetLocation();
-		const D3DXVECTOR3& kUp		= GetUp();
-
-		D3DXMatrixLookAtLH(&kView, &kLocation, &D3DXVECTOR3(0.0f, 0.0f, 0.0f), &kUp);
+		D3DXMatrixLookAtLH(&kView, &GetLocation(), &D3DXVECTOR3(0.0f, 0.0f, 0.0f), &D3DXVECTOR3(0.0f, 1.0f, 0.0f));
 	}
 
 	return kView;
--- a/LightClone/Source/CameraController.h	Thu Sep 22 10:25:35 2011 -0700
+++ b/LightClone/Source/CameraController.h	Thu Sep 22 10:38:54 2011 -0700
@@ -97,21 +97,6 @@
 	const D3DXVECTOR3 GetLocation() const;
 
 	/*
-	 * GetDirection
-	 */
-	const D3DXVECTOR3 GetDirection() const;
-
-	/*
-	 * GetRight
-	 */
-	const D3DXVECTOR3 GetRight() const;
-
-	/*
-	 * GetUp
-	 */
-	const D3DXVECTOR3 GetUp() const;
-
-	/*
 	 * GetProjection
 	 */
 	virtual const D3DXMATRIX GetProjection(const D3DVIEWPORT9& kViewport) const;
--- a/LightClone/Source/Core.h	Thu Sep 22 10:25:35 2011 -0700
+++ b/LightClone/Source/Core.h	Thu Sep 22 10:38:54 2011 -0700
@@ -53,7 +53,6 @@
 	Action_Light,
 	Action_FunctionA,
 	Action_FunctionB,
-	//Action_FunctionC,
 	Action_Count = 7,
 };
 
@@ -70,32 +69,12 @@
 };
 
 /*
- * Tower
- */
-enum
-{
-	Tower_Normal,
-	Tower_Light,
-};
-
-/*
- * ControlButton
+ * TowerType
  */
 enum
 {
-	ControlButton_Play,
-	ControlButton_Stop,
-	ControlButton_Exit,
-};
-
-/*
- * DialogButton
- */
-enum
-{
-	DialogButton_Ok,
-	DialogButton_Yes = DialogButton_Ok,
-	DialogButton_No,
+	TowerType_Normal,
+	TowerType_Light,
 };
 
 /*
@@ -134,16 +113,6 @@
 const uint32 VerticesPerBlock = FacesPerCube * TrianglesPerFace * VerticesPerTriangle;
 
 /*
- * MaximumFunctionLength
- */
-const uint32 MaximumFunctionLength = 16;
-
-/*
- * MainFunctionLength
- */
-const uint32 MainFunctionLength = 14;
-
-/*
  * Position
  *	Represents the position of an object on a grid
  */
--- a/LightClone/Source/Dialog.cpp	Thu Sep 22 10:25:35 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-/*
- * Dialog
- */
-
-#include "Dialog.h"
--- a/LightClone/Source/Environment.cpp	Thu Sep 22 10:25:35 2011 -0700
+++ b/LightClone/Source/Environment.cpp	Thu Sep 22 10:38:54 2011 -0700
@@ -108,16 +108,6 @@
 	D3DXMATRIX kScaleMatrix;
 	D3DXMatrixScaling(&kScaleMatrix, kScale.x, kScale.y, kScale.z);
 
-	//const D3DXMATRIX& kProjection	= kContext.GetProjection();
-	//const D3DXMATRIX& kView			= kContext.GetView();
-
-	D3DVIEWPORT9 kViewport;
-	kContext.GetViewport(&kViewport);
-
-	D3DXVECTOR3 kCenterWorld(0.0f, 0.0f, 0.0f);
-	const float fMagicOffset = 400.0f;
-	//const D3DXVECTOR3& kCenterWorld = ComputeOrigin(0.5f * (ScreenSizeX - (304.0f + fMagicOffset)), 0.5f * ScreenSizeY, kViewport, kProjection, kView);
-
 	const float fOffsetX	= -0.5f * ((nWidth - 1) * kScale.x);
 	const float fOffsetZ	= -0.5f * ((nHeight - 1) * kScale.z);
 
@@ -138,7 +128,7 @@
 			for(uint32 i = 0; i < GetAltitude(nX, nZ); ++i)
 			{
 				D3DXMATRIX kTranslateMatrix;
-				D3DXMatrixTranslation(&kTranslateMatrix, fOffsetX + (kCenterWorld.x + nX) * kScale.x, i * kScale.y, fOffsetZ + (kCenterWorld.z + nZ) * kScale.z);
+				D3DXMatrixTranslation(&kTranslateMatrix, fOffsetX + nX * kScale.x, i * kScale.y, fOffsetZ + nZ * kScale.z);
 
 				D3DXMATRIX kWorldMatrix;
 				D3DXMatrixMultiply(&kWorldMatrix, &kScaleMatrix, &kTranslateMatrix);
@@ -360,7 +350,7 @@
  */
 void Environment::NotifyAction(uint32 nX, uint32 nY)
 {
-	if(pGrid[nY * nWidth + nX].Type == Tower_Light)
+	if(pGrid[nY * nWidth + nX].Type == TowerType_Light)
 	{
 		pGrid[nY * nWidth + nX].State ^= 1;
 	}
@@ -373,7 +363,7 @@
 {
 	for(uint32 i = 0; i < nWidth * nHeight; ++i)
 	{
-		if(pGrid[i].Type == Tower_Light)
+		if(pGrid[i].Type == TowerType_Light)
 		{
 			if(!pGrid[i].State)
 			{
--- a/LightClone/Source/Environment.h	Thu Sep 22 10:25:35 2011 -0700
+++ b/LightClone/Source/Environment.h	Thu Sep 22 10:38:54 2011 -0700
@@ -6,7 +6,6 @@
 #define __ENVIRONMENT_H__
 
 #include "Core.h"
-#include "Tower.h"
 #include "RenderContext.h"
 #include "ResourceManager.h"