Skip to content

Commit

Permalink
Doom|Heretic|Hacx|Chex Quest: Added: "game-save-auto-loadonreborn" op…
Browse files Browse the repository at this point in the history
…tion

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.
  • Loading branch information
danij-deng committed Jun 21, 2012
1 parent 232d4cb commit 60cd67e
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 19 deletions.
33 changes: 18 additions & 15 deletions doomsday/plugins/common/src/g_game.c
Expand Up @@ -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__
Expand Down
3 changes: 3 additions & 0 deletions doomsday/plugins/common/src/p_saveg.c
Expand Up @@ -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 },
Expand Down
3 changes: 3 additions & 0 deletions doomsday/plugins/jdoom/data/conhelp.txt
Expand Up @@ -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.

Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/jdoom/include/d_config.h
Expand Up @@ -112,6 +112,7 @@ typedef struct jdoom_config_s {
int inludePatchReplaceMode;

byte confirmQuickGameSave;
byte loadAutoSaveOnReborn;

int hudPatchReplaceMode;
byte hudShown[NUMHUDDISPLAYS]; // HUD data visibility.
Expand Down
2 changes: 2 additions & 0 deletions doomsday/plugins/jdoom/src/d_main.c
Expand Up @@ -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;
Expand Down
7 changes: 5 additions & 2 deletions doomsday/plugins/jdoom64/data/conhelp.txt
Expand Up @@ -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).

Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/jdoom64/include/d_config.h
Expand Up @@ -114,6 +114,7 @@ typedef struct jdoom64_config_s {
int inludePatchReplaceMode;

byte confirmQuickGameSave;
byte loadAutoSaveOnReborn;

int hudPatchReplaceMode;
byte hudShown[NUMHUDDISPLAYS]; // HUD data visibility.
Expand Down
2 changes: 2 additions & 0 deletions doomsday/plugins/jdoom64/src/d_main.c
Expand Up @@ -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;
Expand Down
7 changes: 5 additions & 2 deletions doomsday/plugins/jheretic/data/conhelp.txt
Expand Up @@ -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).

Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/jheretic/include/h_config.h
Expand Up @@ -113,6 +113,7 @@ typedef struct jheretic_config_s {
int inludePatchReplaceMode;

byte confirmQuickGameSave;
byte loadAutoSaveOnReborn;

int hudPatchReplaceMode;
byte hudShown[6]; // HUD data visibility.
Expand Down
2 changes: 2 additions & 0 deletions doomsday/plugins/jheretic/src/h_main.c
Expand Up @@ -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;
Expand Down

0 comments on commit 60cd67e

Please sign in to comment.