Skip to content

Commit 6bfb3d8

Browse files
committed
-
1 parent bebea1b commit 6bfb3d8

9 files changed

Lines changed: 23 additions & 28 deletions

src/CarnageGame.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ bool CarnageGame::SetInputActionsFromConfig()
206206
for (int iplayer = 0; iplayer < GAME_MAX_PLAYERS; ++iplayer)
207207
{
208208
HumanCharacterController& currentChar = mHumanCharacters[iplayer];
209-
currentChar.mInputActionsMapping.SetNull();
209+
currentChar.mInputs.SetNull();
210210
if (iplayer == 0)
211211
{
212-
currentChar.mInputActionsMapping.SetDefaults();
212+
currentChar.mInputs.SetDefaults();
213213
}
214214
}
215215

@@ -236,7 +236,7 @@ bool CarnageGame::SetInputActionsFromConfig()
236236
tempString.printf("player%d", iplayer + 1);
237237

238238
cxx::config_node configNode = configDocument.get_root_node().get_child(tempString.c_str());
239-
currentChar.mInputActionsMapping.SetFromConfig(configNode);
239+
currentChar.mInputs.SetFromConfig(configNode);
240240
}
241241

242242
return true;

src/DebugRenderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void DebugRenderer::RenderFrame()
6868
return;
6969

7070
gRenderManager.mDebugProgram.Activate();
71-
gRenderManager.mDebugProgram.UploadCameraTransformMatrices();
71+
gRenderManager.mDebugProgram.UploadCameraTransformMatrices(gCamera);
7272
FlushPrimitives();
7373
gRenderManager.mDebugProgram.Deactivate();
7474
}

src/GameCheatsWindow.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@ void GameCheatsWindow::DoUI(Timespan deltaTime)
5959
ImGui::Text("b slope: %d", currBlock->mSlopeType);
6060
ImGui::Text("b directions: %d, %d, %d, %d", currBlock->mUpDirection, currBlock->mRightDirection,
6161
currBlock->mDownDirection, currBlock->mLeftDirection);
62-
//ImGui::Text("b flat: %d", currBlock->mIsFlat);
63-
//for (int iface = 0; iface < eBlockFace_COUNT; ++iface)
64-
//{
65-
// ImGui::Text("b face %s : %d", cxx::enum_to_string((eBlockFace) iface), currBlock->mFaces[iface]);
66-
//}
6762

6863
ImGui::Separator();
6964
ImGui::SliderInt("ped remap", &pedestrian->mRemapIndex, -1, MAX_PED_REMAPS - 1);

src/HumanCharacterController.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,24 +141,24 @@ void HumanCharacterController::InputEvent(KeyInputEvent& inputEvent)
141141
if (mCharacter == nullptr || inputEvent.mKeycode == eKeycode_null)
142142
return;
143143

144-
if (mInputActionsMapping.mControllerType != eInputControllerType_Keyboard)
144+
if (mInputs.mControllerType != eInputControllerType_Keyboard)
145145
{
146146
return;
147147
}
148148

149149
ePedestrianAction action = ePedestrianAction_null;
150150
if (mCharacter->IsCarPassenger())
151151
{
152-
auto iaction = mInputActionsMapping.mKeysInCarActions.find(inputEvent.mKeycode);
153-
if (iaction != mInputActionsMapping.mKeysInCarActions.end())
152+
auto iaction = mInputs.mKeysInCarActions.find(inputEvent.mKeycode);
153+
if (iaction != mInputs.mKeysInCarActions.end())
154154
{
155155
action = iaction->second;
156156
}
157157
}
158158
else
159159
{
160-
auto iaction = mInputActionsMapping.mKeysOnFootActions.find(inputEvent.mKeycode);
161-
if (iaction != mInputActionsMapping.mKeysOnFootActions.end())
160+
auto iaction = mInputs.mKeysOnFootActions.find(inputEvent.mKeycode);
161+
if (iaction != mInputs.mKeysOnFootActions.end())
162162
{
163163
action = iaction->second;
164164
}
@@ -189,22 +189,22 @@ void HumanCharacterController::InputEvent(GamepadInputEvent& inputEvent)
189189
if (inputEvent.mGamepad < MAX_GAMEPADS)
190190
{
191191
eInputControllerType controllerType = gamepadControllers[inputEvent.mGamepad];
192-
if (controllerType != mInputActionsMapping.mControllerType)
192+
if (controllerType != mInputs.mControllerType)
193193
return;
194194

195195
ePedestrianAction action = ePedestrianAction_null;
196196
if (mCharacter->IsCarPassenger())
197197
{
198-
auto iaction = mInputActionsMapping.mGpButtonsInCarActions.find(inputEvent.mButton);
199-
if (iaction != mInputActionsMapping.mGpButtonsInCarActions.end())
198+
auto iaction = mInputs.mGpButtonsInCarActions.find(inputEvent.mButton);
199+
if (iaction != mInputs.mGpButtonsInCarActions.end())
200200
{
201201
action = iaction->second;
202202
}
203203
}
204204
else
205205
{
206-
auto iaction = mInputActionsMapping.mGpButtonsOnFootActions.find(inputEvent.mButton);
207-
if (iaction != mInputActionsMapping.mGpButtonsOnFootActions.end())
206+
auto iaction = mInputs.mGpButtonsOnFootActions.find(inputEvent.mButton);
207+
if (iaction != mInputs.mGpButtonsOnFootActions.end())
208208
{
209209
action = iaction->second;
210210
}

src/HumanCharacterController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class HumanCharacterController final: public CharacterController
3232
{
3333
public:
3434
// public for convenience
35-
InputActionsMapping mInputActionsMapping;
35+
InputActionsMapping mInputs;
3636

3737
public:
3838
// process controller logic

src/MapRenderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void MapRenderer::DrawCityMesh()
183183
gGraphicsDevice.SetRenderStates(cityMeshRenderStates);
184184

185185
gRenderManager.mCityMeshProgram.Activate();
186-
gRenderManager.mCityMeshProgram.UploadCameraTransformMatrices();
186+
gRenderManager.mCityMeshProgram.UploadCameraTransformMatrices(gCamera);
187187

188188
if (mCityMeshBufferV && mCityMeshBufferI)
189189
{

src/RenderProgram.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void RenderProgram::Deactivate()
9494
gGraphicsDevice.BindRenderProgram(nullptr);
9595
}
9696

97-
void RenderProgram::UploadCameraTransformMatrices()
97+
void RenderProgram::UploadCameraTransformMatrices(GameCamera& gameCamera)
9898
{
9999
bool isInited = IsProgramInited();
100100
if (isInited)
@@ -105,10 +105,10 @@ void RenderProgram::UploadCameraTransformMatrices()
105105
mGpuProgram->SetUniform(uniform_id, matrix_reference); \
106106
}
107107

108-
SET_UNIFORM(eRenderUniform_ViewMatrix, gCamera.mViewMatrix);
109-
SET_UNIFORM(eRenderUniform_ProjectionMatrix, gCamera.mProjectionMatrix);
110-
SET_UNIFORM(eRenderUniform_ViewProjectionMatrix, gCamera.mViewProjectionMatrix);
111-
SET_UNIFORM(eRenderUniform_CameraPosition, gCamera.mPosition);
108+
SET_UNIFORM(eRenderUniform_ViewMatrix, gameCamera.mViewMatrix);
109+
SET_UNIFORM(eRenderUniform_ProjectionMatrix, gameCamera.mProjectionMatrix);
110+
SET_UNIFORM(eRenderUniform_ViewProjectionMatrix, gameCamera.mViewProjectionMatrix);
111+
SET_UNIFORM(eRenderUniform_CameraPosition, gameCamera.mPosition);
112112

113113
#undef SET_UNIFORM
114114
}

src/RenderProgram.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class RenderProgram: public cxx::noncopyable
3131

3232
// will update projection and view parameters of render program
3333
// the matrices stored in game camera class, make sure compute them first
34-
void UploadCameraTransformMatrices();
34+
void UploadCameraTransformMatrices(GameCamera& gameCamera);
3535

3636
protected:
3737
// overridable

src/SpriteBatch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void SpriteBatch::RenderSpritesBatches()
145145
gGraphicsDevice.SetRenderStates(cityMeshRenderStates);
146146

147147
gRenderManager.mSpritesProgram.Activate();
148-
gRenderManager.mSpritesProgram.UploadCameraTransformMatrices();
148+
gRenderManager.mSpritesProgram.UploadCameraTransformMatrices(gCamera);
149149

150150
SpriteVertex3D_Format vFormat;
151151
mTrimeshBuffer.SetVertices(Sizeof_SpriteVertex3D * mDrawVertices.size(), mDrawVertices.data());

0 commit comments

Comments
 (0)