File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -202,6 +202,18 @@ void CarnageGame::SetCameraController(CameraController* controller)
202202
203203bool CarnageGame::SetInputActionsFromConfig ()
204204{
205+ // force default mapping for first player
206+ for (int iplayer = 0 ; iplayer < GAME_MAX_PLAYERS; ++iplayer)
207+ {
208+ HumanCharacterController& currentChar = mHumanCharacters [iplayer];
209+ currentChar.mInputActionsMapping .SetNull ();
210+ if (iplayer == 0 )
211+ {
212+ currentChar.mInputActionsMapping .SetDefaults ();
213+ }
214+ }
215+
216+ // open config document
205217 std::string jsonContent;
206218 if (!gFiles .ReadTextFile (InputsConfigPath, jsonContent))
207219 {
@@ -220,17 +232,12 @@ bool CarnageGame::SetInputActionsFromConfig()
220232 for (int iplayer = 0 ; iplayer < GAME_MAX_PLAYERS; ++iplayer)
221233 {
222234 HumanCharacterController& currentChar = mHumanCharacters [iplayer];
223- currentChar.mInputActionsMapping .SetNull ();
224-
225- if (iplayer == 0 ) // force default mapping for first player
226- {
227- currentChar.mInputActionsMapping .SetDefaults ();
228- }
229235
230236 tempString.printf (" player%d" , iplayer + 1 );
231237
232238 cxx::config_node configNode = configDocument.get_root_node ().get_child (tempString.c_str ());
233239 currentChar.mInputActionsMapping .SetFromConfig (configNode);
234240 }
241+
235242 return true ;
236243}
You can’t perform that action at this time.
0 commit comments