Skip to content

Commit

Permalink
libcommon|Refactor: Renamed the "reborn" save slot as "auto"
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Jun 21, 2012
1 parent 57d8065 commit daaec05
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions doomsday/plugins/common/include/p_savedef.h
Expand Up @@ -36,7 +36,7 @@
# define SAVEGAMEEXTENSION "dsg"
# define SAVEGAME_DEFAULT_DIR "savegame"

# define REBORN_SLOT 9
# define AUTO_SLOT 9

#elif __JDOOM64__
# define MY_SAVE_MAGIC 0x1D6420F4
Expand All @@ -49,7 +49,7 @@
# define SAVEGAMEEXTENSION "6sg"
# define SAVEGAME_DEFAULT_DIR "savegame"

# define REBORN_SLOT 9
# define AUTO_SLOT 9

#elif __JHERETIC__
# define MY_SAVE_MAGIC 0x7D9A12C5
Expand All @@ -62,7 +62,7 @@
# define SAVEGAMEEXTENSION "hsg"
# define SAVEGAME_DEFAULT_DIR "savegame"

# define REBORN_SLOT 9
# define AUTO_SLOT 9

#elif __JHEXEN__
# define HXS_VERSION_TEXT "HXS Ver " // Do not change me!
Expand All @@ -77,7 +77,7 @@

# define MOBJ_XX_PLAYER -2
# define BASE_SLOT 6
# define REBORN_SLOT 7
# define AUTO_SLOT 7

typedef union saveptr_u {
byte *b;
Expand Down
8 changes: 4 additions & 4 deletions doomsday/plugins/common/include/p_saveio.h
Expand Up @@ -89,9 +89,9 @@ int SV_FindGameSaveSlotForName(const char* name);
* Search is in ascending logical slot order 0..N (where N is the
* number of available save slots in the current game).
* Pass 2: Check for keyword identifiers.
* <last> = The last used slot.
* <quick> = The currently nominated "quick save" slot.
* <reborn> = The reborn slot.
* <last> = The last used slot.
* <quick> = The currently nominated "quick save" slot.
* <auto> = The autosave slot.
* Pass 3: Check for a logical save slot number.
*
* @return Save slot identifier of the slot else @c -1
Expand All @@ -101,7 +101,7 @@ int SV_ParseGameSaveSlot(const char* str);
/// @return @c true iff @a slot is a valid logical save slot.
boolean SV_IsValidSlot(int slot);

/// @return @c true iff @a slot is user-writable save slot (not "reborn" or similar).
/// @return @c true iff @a slot is user-writable save slot (not "auto" or similar).
boolean SV_IsUserWritableSlot(int slot);

/// @return @c true iff a game-save is present for logical save @a slot.
Expand Down
20 changes: 10 additions & 10 deletions doomsday/plugins/common/src/g_game.c
Expand Up @@ -2004,8 +2004,8 @@ void G_DoReborn(int plrNum)
briefDisabled = true;

#if __JHEXEN__
// Use the reborn logic if the slot is available else start a new game.
if(!G_LoadGame(REBORN_SLOT))
// Use the latest autosave if available else start a new game.
if(!G_LoadGame(AUTO_SLOT))
{
G_SetGameAction(GA_NEWGAME);
}
Expand All @@ -2024,7 +2024,7 @@ void G_DoReborn(int plrNum)
void G_StartNewInit(void)
{
SV_HxInitBaseSlot();
SV_ClearSaveSlot(REBORN_SLOT);
SV_ClearSaveSlot(AUTO_SLOT);

P_ACSInitNewGame();

Expand Down Expand Up @@ -2314,11 +2314,11 @@ void G_DoWorldDone(void)
#if __JHEXEN__
SV_HxMapTeleport(nextMap, nextMapEntryPoint);

// In a non-network, non-deathmatch game, save immediately into the reborn slot.
// In a non-network, non-deathmatch game, save immediately into the autosave slot.
if(!IS_NETGAME && !deathmatch)
{
ddstring_t* name = G_GenerateSaveGameName();
SV_SaveGame(REBORN_SLOT, Str_Text(name));
SV_SaveGame(AUTO_SLOT, Str_Text(name));
Str_Delete(name);
}

Expand Down Expand Up @@ -2367,19 +2367,19 @@ boolean G_LoadGame(int slot)
void G_DoLoadGame(void)
{
#if __JHEXEN__
boolean mustCopyBaseToReborn = (gaLoadGameSlot != REBORN_SLOT);
boolean mustCopyBaseToAutoSlot = (gaLoadGameSlot != AUTO_SLOT);
#endif

G_SetGameAction(GA_NONE);
if(!SV_LoadGame(gaLoadGameSlot)) return;

#if __JHEXEN__
if(!mustCopyBaseToReborn) return;
if(!mustCopyBaseToAutoSlot) return;
if(IS_NETGAME) return;

// Copy the base slot to the reborn slot.
SV_ClearSaveSlot(REBORN_SLOT);
SV_CopySaveSlot(BASE_SLOT, REBORN_SLOT);
// Copy the base slot to the autosave slot.
SV_ClearSaveSlot(AUTO_SLOT);
SV_CopySaveSlot(BASE_SLOT, AUTO_SLOT);
#endif
}

Expand Down
20 changes: 10 additions & 10 deletions doomsday/plugins/common/src/p_saveio.c
Expand Up @@ -44,7 +44,7 @@ static ddstring_t clientSavePath; // e.g., "savegame/client/"
#endif
static gamesaveinfo_t* gameSaveInfo;
#if __JHEXEN__
static gamesaveinfo_t rebornGameSaveInfo;
static gamesaveinfo_t autoGameSaveInfo;
#endif

#if __JHEXEN__
Expand Down Expand Up @@ -229,7 +229,7 @@ void SV_ShutdownIO(void)
free(gameSaveInfo); gameSaveInfo = NULL;

#if __JHEXEN__
clearGameSaveInfo(&rebornGameSaveInfo);
clearGameSaveInfo(&autoGameSaveInfo);
#endif
}

Expand Down Expand Up @@ -326,7 +326,7 @@ void SV_ClearSaveSlot(int slot)
boolean SV_IsValidSlot(int slot)
{
#if __JHEXEN__
if(slot == REBORN_SLOT) return true;
if(slot == AUTO_SLOT) return true;
if(slot == BASE_SLOT) return true;
#endif
return (slot >= 0 && slot < NUMSAVESLOTS);
Expand All @@ -335,7 +335,7 @@ boolean SV_IsValidSlot(int slot)
boolean SV_IsUserWritableSlot(int slot)
{
#if __JHEXEN__
if(slot == REBORN_SLOT || slot == BASE_SLOT) return false;
if(slot == AUTO_SLOT || slot == BASE_SLOT) return false;
#endif
return SV_IsValidSlot(slot);
}
Expand Down Expand Up @@ -432,7 +432,7 @@ static void buildGameSaveInfo(void)
initGameSaveInfo(info);
}
#if __JHEXEN__
initGameSaveInfo(&rebornGameSaveInfo);
initGameSaveInfo(&autoGameSaveInfo);
#endif
}

Expand All @@ -445,7 +445,7 @@ static void buildGameSaveInfo(void)
updateGameSaveInfo(info, composeGameSavePathForSlot(i));
}
#if __JHEXEN__
updateGameSaveInfo(&rebornGameSaveInfo, composeGameSavePathForSlot(REBORN_SLOT));
updateGameSaveInfo(&autoGameSaveInfo, composeGameSavePathForSlot(AUTO_SLOT));
#endif
}

Expand All @@ -456,13 +456,13 @@ static gamesaveinfo_t* findGameSaveInfoForSlot(int slot)
assert(inited);

#if __JHEXEN__
if(slot == REBORN_SLOT)
if(slot == AUTO_SLOT)
{
// On first call - automatically build and populate game-save info.
if(!gameSaveInfo)
buildGameSaveInfo();
// Retrieve the info for this slot.
return &rebornGameSaveInfo;
return &autoGameSaveInfo;
}
#endif
if(slot >= 0 && slot < NUMSAVESLOTS)
Expand Down Expand Up @@ -509,9 +509,9 @@ int SV_ParseGameSaveSlot(const char* str)
return Con_GetInteger("game-save-quick-slot");
}
#if __JHEXEN__
if(!stricmp(str, "reborn") || !stricmp(str, "<reborn>"))
if(!stricmp(str, "auto") || !stricmp(str, "<auto>"))
{
return REBORN_SLOT;
return AUTO_SLOT;
}
#endif

Expand Down

0 comments on commit daaec05

Please sign in to comment.