From 60cd67e3f32bbc2400fab7572a08996a28794c72 Mon Sep 17 00:00:00 2001 From: danij Date: Thu, 21 Jun 2012 17:25:46 +0100 Subject: [PATCH] Doom|Heretic|Hacx|Chex Quest: Added: "game-save-auto-loadonreborn" option When enabled and the player asks to be reborn; attempt to automatically load a game save state in the "auto" slot. If no autosave is found then restart the current map (a.k.a. "pistol start"). Note: Presently off by default. --- doomsday/plugins/common/src/g_game.c | 33 +++++++++++--------- doomsday/plugins/common/src/p_saveg.c | 3 ++ doomsday/plugins/jdoom/data/conhelp.txt | 3 ++ doomsday/plugins/jdoom/include/d_config.h | 1 + doomsday/plugins/jdoom/src/d_main.c | 2 ++ doomsday/plugins/jdoom64/data/conhelp.txt | 7 +++-- doomsday/plugins/jdoom64/include/d_config.h | 1 + doomsday/plugins/jdoom64/src/d_main.c | 2 ++ doomsday/plugins/jheretic/data/conhelp.txt | 7 +++-- doomsday/plugins/jheretic/include/h_config.h | 1 + doomsday/plugins/jheretic/src/h_main.c | 2 ++ 11 files changed, 43 insertions(+), 19 deletions(-) diff --git a/doomsday/plugins/common/src/g_game.c b/doomsday/plugins/common/src/g_game.c index 2db4f91ee6..2be8188fd9 100644 --- a/doomsday/plugins/common/src/g_game.c +++ b/doomsday/plugins/common/src/g_game.c @@ -1998,26 +1998,29 @@ void G_DoReborn(int plrNum) FI_StackClear(); } - if(!IS_NETGAME) + if(IS_NETGAME) + { + P_RebornPlayer(plrNum); + return; + } + + // We've just died, don't do a briefing now. + briefDisabled = true; + + // Use the latest autosave? +#if !__JHEXEN__ + if(cfg.loadAutoSaveOnReborn) // Cannot be disabled in Hexen. +#endif { - // We've just died, don't do a briefing now. - briefDisabled = true; + if(G_LoadGame(AUTO_SLOT)) return; + } + // Reload the map from scratch. #if __JHEXEN__ - // Use the latest autosave if available else start a new game. - if(!G_LoadGame(AUTO_SLOT)) - { - G_SetGameAction(GA_NEWGAME); - } + G_SetGameAction(GA_NEWGAME); #else - // Reload the map from scratch. - G_SetGameAction(GA_LOADMAP); + G_SetGameAction(GA_LOADMAP); #endif - } - else - { // In a net game. - P_RebornPlayer(plrNum); - } } #if __JHEXEN__ diff --git a/doomsday/plugins/common/src/p_saveg.c b/doomsday/plugins/common/src/p_saveg.c index 873ff989d6..37ccb2f339 100644 --- a/doomsday/plugins/common/src/p_saveg.c +++ b/doomsday/plugins/common/src/p_saveg.c @@ -371,6 +371,9 @@ static thinkerinfo_t thinkerInfo[] = { }; cvartemplate_t cvars[] = { +#if !__JHEXEN__ + { "game-save-auto-loadonreborn", 0, CVT_BYTE, &cfg.loadAutoSaveOnReborn, 0, 1 }, +#endif { "game-save-confirm", 0, CVT_BYTE, &cfg.confirmQuickGameSave, 0, 1 }, { "game-save-last-slot", CVF_NO_MIN|CVF_NO_MAX|CVF_NO_ARCHIVE|CVF_READ_ONLY, CVT_INT, &cvarLastSlot }, { "game-save-quick-slot", CVF_NO_MAX|CVF_NO_ARCHIVE, CVT_INT, &cvarQuickSlot, -1, 0 }, diff --git a/doomsday/plugins/jdoom/data/conhelp.txt b/doomsday/plugins/jdoom/data/conhelp.txt index 55d61ac1da..93a72e6fbd 100644 --- a/doomsday/plugins/jdoom/data/conhelp.txt +++ b/doomsday/plugins/jdoom/data/conhelp.txt @@ -311,6 +311,9 @@ desc = Color of HUD messages blue component. [msg-blink] desc = HUD messages blink for this number of tics when printed. +[game-save-auto-loadonreborn] +desc = 1=Load the auto save slot on player reborn. (default: off). + [game-save-last-slot] desc = Last used save slot. -1=Not yet loaded/saved in this game session. diff --git a/doomsday/plugins/jdoom/include/d_config.h b/doomsday/plugins/jdoom/include/d_config.h index 8659754f0d..3651f5df85 100644 --- a/doomsday/plugins/jdoom/include/d_config.h +++ b/doomsday/plugins/jdoom/include/d_config.h @@ -112,6 +112,7 @@ typedef struct jdoom_config_s { int inludePatchReplaceMode; byte confirmQuickGameSave; + byte loadAutoSaveOnReborn; int hudPatchReplaceMode; byte hudShown[NUMHUDDISPLAYS]; // HUD data visibility. diff --git a/doomsday/plugins/jdoom/src/d_main.c b/doomsday/plugins/jdoom/src/d_main.c index a7d7bc32c2..df855fd1f0 100644 --- a/doomsday/plugins/jdoom/src/d_main.c +++ b/doomsday/plugins/jdoom/src/d_main.c @@ -329,6 +329,8 @@ void D_PreInit(void) cfg.hideIWADAuthor = true; cfg.confirmQuickGameSave = true; + cfg.loadAutoSaveOnReborn = false; + cfg.maxSkulls = true; cfg.allowSkullsInWalls = false; cfg.anyBossDeath = false; diff --git a/doomsday/plugins/jdoom64/data/conhelp.txt b/doomsday/plugins/jdoom64/data/conhelp.txt index 785f324373..67ab5f361b 100644 --- a/doomsday/plugins/jdoom64/data/conhelp.txt +++ b/doomsday/plugins/jdoom64/data/conhelp.txt @@ -310,12 +310,15 @@ desc = Color of HUD messages blue component. [msg-blink] desc = HUD messages blink for this number of tics when printed. -[game-save-last-slot] -desc = Last used save slot. -1=Not yet loaded/saved in this game session. +[game-save-auto-loadonreborn] +desc = 1=Load the auto save slot on player reborn. (default: off). [game-save-confirm] desc = 1=Ask me to confirm when quick saving/loading. +[game-save-last-slot] +desc = Last used save slot. -1=Not yet loaded/saved in this game session. + [game-save-quick-slot] desc = Current "quick" save slot number. -1=None (default). diff --git a/doomsday/plugins/jdoom64/include/d_config.h b/doomsday/plugins/jdoom64/include/d_config.h index 518f43d56a..4dbf7f8ced 100644 --- a/doomsday/plugins/jdoom64/include/d_config.h +++ b/doomsday/plugins/jdoom64/include/d_config.h @@ -114,6 +114,7 @@ typedef struct jdoom64_config_s { int inludePatchReplaceMode; byte confirmQuickGameSave; + byte loadAutoSaveOnReborn; int hudPatchReplaceMode; byte hudShown[NUMHUDDISPLAYS]; // HUD data visibility. diff --git a/doomsday/plugins/jdoom64/src/d_main.c b/doomsday/plugins/jdoom64/src/d_main.c index 507e2ac4ec..fb57cc0941 100644 --- a/doomsday/plugins/jdoom64/src/d_main.c +++ b/doomsday/plugins/jdoom64/src/d_main.c @@ -264,6 +264,8 @@ void D_PreInit(void) cfg.menuGameSaveSuggestName = true; cfg.confirmQuickGameSave = true; + cfg.loadAutoSaveOnReborn = false; + cfg.maxSkulls = true; cfg.allowSkullsInWalls = false; cfg.anyBossDeath = false; diff --git a/doomsday/plugins/jheretic/data/conhelp.txt b/doomsday/plugins/jheretic/data/conhelp.txt index 9450e8e9c3..ab0c1935d9 100644 --- a/doomsday/plugins/jheretic/data/conhelp.txt +++ b/doomsday/plugins/jheretic/data/conhelp.txt @@ -320,12 +320,15 @@ desc = Color of HUD messages blue component. [msg-blink] desc = HUD messages blink for this number of tics when printed. -[game-save-last-slot] -desc = Last used save slot. -1=Not yet loaded/saved in this game session. +[game-save-auto-loadonreborn] +desc = 1=Load the auto save slot on player reborn. (default: off). [game-save-confirm] desc = 1=Ask me to confirm when quick saving/loading. +[game-save-last-slot] +desc = Last used save slot. -1=Not yet loaded/saved in this game session. + [game-save-quick-slot] desc = Current "quick" save slot number. -1=None (default). diff --git a/doomsday/plugins/jheretic/include/h_config.h b/doomsday/plugins/jheretic/include/h_config.h index 6f453bd0d3..5c9ff766f7 100644 --- a/doomsday/plugins/jheretic/include/h_config.h +++ b/doomsday/plugins/jheretic/include/h_config.h @@ -113,6 +113,7 @@ typedef struct jheretic_config_s { int inludePatchReplaceMode; byte confirmQuickGameSave; + byte loadAutoSaveOnReborn; int hudPatchReplaceMode; byte hudShown[6]; // HUD data visibility. diff --git a/doomsday/plugins/jheretic/src/h_main.c b/doomsday/plugins/jheretic/src/h_main.c index 6c8249bd04..af1ded759a 100644 --- a/doomsday/plugins/jheretic/src/h_main.c +++ b/doomsday/plugins/jheretic/src/h_main.c @@ -267,6 +267,8 @@ void H_PreInit(void) cfg.menuGameSaveSuggestName = true; cfg.confirmQuickGameSave = true; + cfg.loadAutoSaveOnReborn = false; + cfg.monstersStuckInDoors = false; cfg.avoidDropoffs = true; cfg.moveBlock = false;