diff --git a/doomsday/plugins/common/include/g_common.h b/doomsday/plugins/common/include/g_common.h index 6df0137928..76aeff2dca 100644 --- a/doomsday/plugins/common/include/g_common.h +++ b/doomsday/plugins/common/include/g_common.h @@ -71,7 +71,18 @@ boolean G_QuitInProgress(void); * @param mapEntryPoint Logical map entry point number. */ void G_InitNew(skillmode_t skill, uint episode, uint map, uint mapEntryPoint); -void G_DeferedInitNew(skillmode_t skill, uint episode, uint map, uint mapEntryPoint); +void G_DeferedNewGame(skillmode_t skill, uint episode, uint map, uint mapEntryPoint); + +#if __JHEXEN__ +/** + * Same as @ref G_DeferedNewGame() except a GA_NEWGAME action is queued + * instead of GA_INITNEW. + * + * @todo Why the distinction, surely starting a new game requires the same + * logic regardless of where the action originated. + */ +void G_DeferedNewGameAlt(skillmode_t skill, uint episode, uint map, uint mapEntryPoint); +#endif /** * Leave the current map and start intermission routine. diff --git a/doomsday/plugins/common/src/d_net.c b/doomsday/plugins/common/src/d_net.c index 5e5e5df4a8..4c942a1a39 100644 --- a/doomsday/plugins/common/src/d_net.c +++ b/doomsday/plugins/common/src/d_net.c @@ -862,7 +862,7 @@ D_CMD(SetMap) cfg.jumpEnabled = cfg.netJumping; // Use the configured network skill level for the new map. - G_DeferedInitNew(cfg.netSkill, ep, map, 0/*default*/); + G_DeferedNewGame(cfg.netSkill, ep, map, 0/*default*/); return true; } diff --git a/doomsday/plugins/common/src/g_game.c b/doomsday/plugins/common/src/g_game.c index a50f0b9f21..6a8941f159 100644 --- a/doomsday/plugins/common/src/g_game.c +++ b/doomsday/plugins/common/src/g_game.c @@ -144,7 +144,6 @@ D_CMD(SaveGame); D_CMD(OpenSaveMenu); void G_PlayerReborn(int player); -void G_DoInitNew(void); void G_DoReborn(int playernum); typedef struct { @@ -1618,18 +1617,13 @@ static void runGameAction(void) { #if __JHEXEN__ case GA_INITNEW: - G_DoInitNew(); + SV_HxInitBaseSlot(); + G_InitNew(dSkill, dEpisode, dMap, dMapEntryPoint); G_SetGameAction(GA_NONE); break; #endif - - case GA_LEAVEMAP: - G_DoLeaveMap(); - G_SetGameAction(GA_NONE); - break; - - case GA_RESTARTMAP: - G_DoRestartMap(); + case GA_NEWGAME: + G_DoNewGame(); G_SetGameAction(GA_NONE); break; @@ -1641,23 +1635,33 @@ static void runGameAction(void) G_DoSaveGame(); break; - case GA_MAPCOMPLETED: - G_DoMapCompleted(); + case GA_QUIT: + G_DoQuitGame(); + // No further game state changes occur once we have begun to quit. + return; + + case GA_SCREENSHOT: + G_DoScreenShot(); + G_SetGameAction(GA_NONE); break; - case GA_VICTORY: + case GA_LEAVEMAP: + G_DoLeaveMap(); G_SetGameAction(GA_NONE); break; - case GA_SCREENSHOT: - G_DoScreenShot(); + case GA_RESTARTMAP: + G_DoRestartMap(); G_SetGameAction(GA_NONE); break; - case GA_QUIT: - G_DoQuitGame(); - // No further game state changes occur once we have begun to quit. - return; + case GA_MAPCOMPLETED: + G_DoMapCompleted(); + break; + + case GA_VICTORY: + G_SetGameAction(GA_NONE); + break; default: break; } @@ -2935,34 +2939,31 @@ void G_DoSaveGame(void) G_SetGameAction(GA_NONE); } -#if __JHEXEN__ -void G_DeferredNewGame(skillmode_t skill) +void G_DeferedNewGame(skillmode_t skill, uint episode, uint map, uint mapEntryPoint) { dSkill = skill; - dMapEntryPoint = 0; - G_SetGameAction(GA_NEWGAME); -} + dEpisode = episode; + dMap = map; + dMapEntryPoint = mapEntryPoint; -void G_DoInitNew(void) -{ - SV_HxInitBaseSlot(); - G_InitNew(dSkill, dEpisode, dMap, dMapEntryPoint); -} +#if __JHEXEN__ + G_SetGameAction(GA_INITNEW); +#else + G_SetGameAction(GA_NEWGAME); #endif +} -void G_DeferedInitNew(skillmode_t skill, uint episode, uint map, uint mapEntryPoint) +#if __JHEXEN__ +void G_DeferedNewGameAlt(skillmode_t skill, uint episode, uint map, uint mapEntryPoint) { dSkill = skill; dEpisode = episode; dMap = map; dMapEntryPoint = mapEntryPoint; -#if __JHEXEN__ - G_SetGameAction(GA_INITNEW); -#else G_SetGameAction(GA_NEWGAME); -#endif } +#endif void G_DoNewGame(void) { @@ -2979,7 +2980,6 @@ void G_DoNewGame(void) G_StartNewInit(); #endif G_InitNew(dSkill, dEpisode, dMap, dMapEntryPoint); - G_SetGameAction(GA_NONE); } void G_InitNew(skillmode_t skill, uint episode, uint map, uint mapEntryPoint) diff --git a/doomsday/plugins/common/src/hu_menu.c b/doomsday/plugins/common/src/hu_menu.c index 26e7961969..d36b2813d0 100644 --- a/doomsday/plugins/common/src/hu_menu.c +++ b/doomsday/plugins/common/src/hu_menu.c @@ -6127,12 +6127,17 @@ void Hu_MenuInitNewGame(boolean confirmed) return; } #endif + Hu_MenuCommand(chooseCloseMethod()); + #if __JHEXEN__ cfg.playerClass[CONSOLEPLAYER] = mnPlrClass; - G_DeferredNewGame(mnSkillmode); +#endif + +#if __JHEXEN__ + G_DeferedNewGameAlt(mnSkillmode, mnEpisode, P_TranslateMap(0), 0/*default*/); #else - G_DeferedInitNew(mnSkillmode, mnEpisode, 0, 0/*default*/); + G_DeferedNewGame(mnSkillmode, mnEpisode, 0, 0/*default*/); #endif } diff --git a/doomsday/plugins/jdoom/src/d_main.c b/doomsday/plugins/jdoom/src/d_main.c index 9ca057d8a2..59e02066ab 100644 --- a/doomsday/plugins/jdoom/src/d_main.c +++ b/doomsday/plugins/jdoom/src/d_main.c @@ -577,7 +577,7 @@ void D_PostInit(void) if(autoStart || IS_NETGAME) { - G_DeferedInitNew(startSkill, startEpisode, startMap, 0/*default*/); + G_DeferedNewGame(startSkill, startEpisode, startMap, 0/*default*/); } else { diff --git a/doomsday/plugins/jdoom/src/m_cheat.c b/doomsday/plugins/jdoom/src/m_cheat.c index 875a427976..5cd24d4f00 100644 --- a/doomsday/plugins/jdoom/src/m_cheat.c +++ b/doomsday/plugins/jdoom/src/m_cheat.c @@ -366,7 +366,7 @@ int Cht_WarpFunc(const int* args, int player) // So be it. briefDisabled = true; - G_DeferedInitNew(gameSkill, epsd, map, 0/*default*/); + G_DeferedNewGame(gameSkill, epsd, map, 0/*default*/); return true; } diff --git a/doomsday/plugins/jdoom64/src/d_main.c b/doomsday/plugins/jdoom64/src/d_main.c index 007a925a3a..a78a1e2579 100644 --- a/doomsday/plugins/jdoom64/src/d_main.c +++ b/doomsday/plugins/jdoom64/src/d_main.c @@ -470,7 +470,7 @@ void D_PostInit(void) if(autoStart || IS_NETGAME) { - G_DeferedInitNew(startSkill, startEpisode, startMap, 0/*default*/); + G_DeferedNewGame(startSkill, startEpisode, startMap, 0/*default*/); } else { diff --git a/doomsday/plugins/jdoom64/src/m_cheat.c b/doomsday/plugins/jdoom64/src/m_cheat.c index f6a07a251f..bb32a33675 100644 --- a/doomsday/plugins/jdoom64/src/m_cheat.c +++ b/doomsday/plugins/jdoom64/src/m_cheat.c @@ -175,7 +175,7 @@ boolean Cht_WarpFunc(player_t* plr, cheatseq_t* cheat) // So be it. briefDisabled = true; - G_DeferedInitNew(gameSkill, epsd, map, 0/*default*/); + G_DeferedNewGame(gameSkill, epsd, map, 0/*default*/); return true; } diff --git a/doomsday/plugins/jheretic/src/h_main.c b/doomsday/plugins/jheretic/src/h_main.c index 83217a0e2e..9704e68207 100644 --- a/doomsday/plugins/jheretic/src/h_main.c +++ b/doomsday/plugins/jheretic/src/h_main.c @@ -491,7 +491,7 @@ void H_PostInit(void) if(autoStart || IS_NETGAME) { - G_DeferedInitNew(startSkill, startEpisode, startMap, 0/*default*/); + G_DeferedNewGame(startSkill, startEpisode, startMap, 0/*default*/); } else { diff --git a/doomsday/plugins/jheretic/src/m_cheat.c b/doomsday/plugins/jheretic/src/m_cheat.c index ea6d0ad883..9ccfa6698e 100644 --- a/doomsday/plugins/jheretic/src/m_cheat.c +++ b/doomsday/plugins/jheretic/src/m_cheat.c @@ -336,7 +336,7 @@ int Cht_WarpFunc(const int* args, int player) // So be it. briefDisabled = true; - G_DeferedInitNew(gameSkill, epsd, map, 0/* default*/); + G_DeferedNewGame(gameSkill, epsd, map, 0/* default*/); return true; } diff --git a/doomsday/plugins/jhexen/include/g_game.h b/doomsday/plugins/jhexen/include/g_game.h index 66d5c4f653..904d4744f0 100644 --- a/doomsday/plugins/jhexen/include/g_game.h +++ b/doomsday/plugins/jhexen/include/g_game.h @@ -119,7 +119,6 @@ void* G_GetVariable(int id); void G_DeathMatchSpawnPlayer(int playernum); uint G_GetMapNumber(uint episode, uint map); -void G_DeferredNewGame(skillmode_t skill); void G_DeferedPlayDemo(char* demo); void G_DoPlayDemo(void); diff --git a/doomsday/plugins/jhexen/src/h2_main.c b/doomsday/plugins/jhexen/src/h2_main.c index 039070b711..751992d99f 100644 --- a/doomsday/plugins/jhexen/src/h2_main.c +++ b/doomsday/plugins/jhexen/src/h2_main.c @@ -483,7 +483,7 @@ void X_PostInit(void) if(autoStart || IS_NETGAME) { - G_DeferedInitNew(startSkill, startEpisode, startMap, 0/* default */); + G_DeferedNewGame(startSkill, startEpisode, startMap, 0/* default */); } else { diff --git a/doomsday/plugins/jhexen/src/m_cheat.c b/doomsday/plugins/jhexen/src/m_cheat.c index 7434347f8b..8ec5101467 100644 --- a/doomsday/plugins/jhexen/src/m_cheat.c +++ b/doomsday/plugins/jhexen/src/m_cheat.c @@ -605,7 +605,7 @@ int Cht_InitFunc(const int* args, int player) if(plr->health <= 0) return false; // Dead players can't cheat. - G_DeferedInitNew(gameSkill, gameEpisode, gameMap, gameMapEntryPoint); + G_DeferedNewGame(gameSkill, gameEpisode, gameMap, gameMapEntryPoint); P_SetMessage(plr, TXT_CHEATWARP, false); S_LocalSound(SFX_PLATFORM_STOP, NULL); return true;