diff --git a/doomsday/plugins/common/include/p_saveg.h b/doomsday/plugins/common/include/p_saveg.h index 71d01f6eea..ce44dbf58e 100644 --- a/doomsday/plugins/common/include/p_saveg.h +++ b/doomsday/plugins/common/include/p_saveg.h @@ -54,9 +54,9 @@ void SV_HxMapTeleport(uint map, uint position); * Saves a snapshot of the world, a still image. * No data of movement is included (server sends it). */ -void SV_SaveClient(uint gameId); +void SV_SaveGameClient(uint gameId); -void SV_LoadClient(uint gameId); +void SV_LoadGameClient(uint gameId); #endif typedef enum gamearchivesegment_e { @@ -116,14 +116,14 @@ typedef enum thinkclass_e { } thinkerclass_t; #if __JHEXEN__ -int SV_ThingArchiveNum(mobj_t* mo); +int SV_ThingArchiveNum(mobj_t* mo); #else -unsigned short SV_ThingArchiveNum(mobj_t* mo); +unsigned short SV_ThingArchiveNum(mobj_t* mo); #endif -mobj_t* SV_GetArchiveThing(int thingid, void* address); +mobj_t* SV_GetArchiveThing(int thingid, void* address); MaterialArchive* SV_MaterialArchive(void); -material_t* SV_GetArchiveMaterial(materialarchive_serialid_t serialId, int group); +material_t* SV_GetArchiveMaterial(materialarchive_serialid_t serialId, int group); /** * Exit with a fatal error if the value at the current location in the @@ -144,6 +144,6 @@ void SV_BeginSegment(int segType); * @param mo Mobj whoose flags are to be updated. * @param ver The MOBJ save version to update from. */ -void SV_UpdateReadMobjFlags(mobj_t* mo, int ver); +void SV_TranslateLegacyMobjFlags(mobj_t* mo, int ver); #endif /* LIBCOMMON_SAVESTATE_H */ diff --git a/doomsday/plugins/common/include/p_saveio.h b/doomsday/plugins/common/include/p_saveio.h index 886dd59371..46e59d5884 100644 --- a/doomsday/plugins/common/include/p_saveio.h +++ b/doomsday/plugins/common/include/p_saveio.h @@ -1,25 +1,23 @@ -/**\file p_saveio.h - *\section License - * License: GPL - * Online License Link: http://www.gnu.org/licenses/gpl.html - * - *\author Copyright © 2003-2012 Jaakko Keränen - *\author Copyright © 2005-2012 Daniel Swanson +/** + * @file p_saveio.h + * Game save file IO. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * @authors Copyright © 2003-2012 Jaakko Keränen + * @authors Copyright © 2005-2012 Daniel Swanson * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA */ #ifndef LIBCOMMON_SAVESTATE_INPUT_OUTPUT_H @@ -49,10 +47,10 @@ typedef struct saveheader_s { unsigned int gameId; } saveheader_t; -typedef struct gamesaveinfo_s { +typedef struct saveinfo_s { ddstring_t filePath; ddstring_t name; -} gamesaveinfo_t; +} saveinfo_t; typedef struct savegameparam_s { const ddstring_t* path; @@ -67,6 +65,7 @@ enum { void SV_InitIO(void); void SV_ShutdownIO(void); + void SV_ConfigureSavePaths(void); const char* SV_SavePath(void); #if !__JHEXEN__ @@ -88,7 +87,7 @@ LZFILE* SV_File(void); * \note It is not necessary to call this after a game-save is made, * this module will do so automatically. */ -void SV_UpdateGameSaveInfo(void); +void SV_UpdateAllSaveInfo(void); /** * Lookup a save slot by searching for a match on game-save name. @@ -98,7 +97,7 @@ void SV_UpdateGameSaveInfo(void); * @param name Name of the game-save to look for. Case insensitive. * @return Logical slot number of the found game-save else @c -1 */ -int SV_FindGameSaveSlotForName(const char* name); +int SV_SlotForSaveName(const char* name); /** * Parse the given string and determine whether it references a logical @@ -106,17 +105,17 @@ int SV_FindGameSaveSlotForName(const char* name); * * @param str String to be parsed. Parse is divided into three passes. * Pass 1: Check for a known game-save name which matches this. - * Search is in ascending logical slot order 0..N (where N is the - * number of available save slots in the current game). + * Search is in ascending logical slot order 0..N (where N + * is the number of available save slots). * Pass 2: Check for keyword identifiers. * = The last used slot. * = The currently nominated "quick save" slot. - * = The autosave slot. + * = The "auto save" slot. * Pass 3: Check for a logical save slot number. * * @return Save slot identifier of the slot else @c -1 */ -int SV_ParseGameSaveSlot(const char* str); +int SV_ParseSlotIdentifier(const char* str); /// @return @c true iff @a slot is a valid logical save slot. boolean SV_IsValidSlot(int slot); @@ -125,38 +124,38 @@ boolean SV_IsValidSlot(int slot); boolean SV_IsUserWritableSlot(int slot); /// @return @c true iff a game-save is present for logical save @a slot. -boolean SV_IsGameSaveSlotUsed(int slot); +boolean SV_IsSlotUsed(int slot); #if __JHEXEN__ /** * @return @c true iff a game-save is present and serialized @a map state is * is present for logical save @a slot. */ -boolean SV_HxGameSaveSlotHasMapState(int slot, uint map); +boolean SV_HxHaveMapSaveForSlot(int slot, uint map); #endif /** * @return Game-save info for logical save @a slot. Always returns valid * info even if supplied with an invalid or unused slot identifer. */ -const gamesaveinfo_t* SV_GameSaveInfoForSlot(int slot); +const saveinfo_t* SV_SaveInfoForSlot(int slot); -boolean SV_GameSavePathForSlot(int slot, ddstring_t* path); +boolean SV_ComposeSavePathForSlot(int slot, ddstring_t* path); #if __JHEXEN__ -boolean SV_GameSavePathForMapSlot(uint map, int slot, ddstring_t* path); +boolean SV_ComposeSavePathForMapSlot(uint map, int slot, ddstring_t* path); #else -boolean SV_ClientGameSavePathForGameId(uint gameId, ddstring_t* path); +boolean SV_ComposeSavePathForClientGameId(uint gameId, ddstring_t* path); #endif /** * Deletes all save game files associated with a slot number. */ -void SV_ClearSaveSlot(int slot); +void SV_ClearSlot(int slot); /** * Copies all the save game files from one slot to another. */ -void SV_CopySaveSlot(int sourceSlot, int destSlot); +void SV_CopySlot(int sourceSlot, int destSlot); #if __JHEXEN__ saveptr_t* SV_HxSavePtr(void); diff --git a/doomsday/plugins/common/src/d_netcl.c b/doomsday/plugins/common/src/d_netcl.c index 4c2b96597b..1f1cb18fef 100644 --- a/doomsday/plugins/common/src/d_netcl.c +++ b/doomsday/plugins/common/src/d_netcl.c @@ -838,7 +838,7 @@ void NetCl_SaveGame(Reader* msg) /// @todo: Why not Hexen? #if !__JHEXEN__ - SV_SaveClient(Reader_ReadUInt32(msg)); + SV_SaveGameClient(Reader_ReadUInt32(msg)); #endif #if __JDOOM__ || __JDOOM64__ P_SetMessage(&players[CONSOLEPLAYER], TXT_GAMESAVED, false); @@ -853,7 +853,7 @@ void NetCl_LoadGame(Reader* msg) return; #if !__JHEXEN__ - SV_LoadClient(Reader_ReadUInt32(msg)); + SV_LoadGameClient(Reader_ReadUInt32(msg)); #endif #if __JDOOM__ || __JDOOM64__ P_SetMessage(&players[CONSOLEPLAYER], GET_TXT(TXT_CLNETLOAD), false); diff --git a/doomsday/plugins/common/src/g_game.c b/doomsday/plugins/common/src/g_game.c index 848432a56a..16be6b44f9 100644 --- a/doomsday/plugins/common/src/g_game.c +++ b/doomsday/plugins/common/src/g_game.c @@ -2036,7 +2036,7 @@ void G_StartNewInit(void) /// @todo Do not clear this save slot. Instead we should set a game state /// flag to signal when a new game should be started instead of loading /// the autosave slot. - SV_ClearSaveSlot(AUTO_SLOT); + SV_ClearSlot(AUTO_SLOT); P_ACSInitNewGame(); @@ -2352,9 +2352,9 @@ boolean G_LoadGame(int slot) // no guarantee that the game-save will be accessible come load time. // First ensure we have up-to-date info. - SV_UpdateGameSaveInfo(); + SV_UpdateAllSaveInfo(); - if(!SV_IsGameSaveSlotUsed(slot)) + if(!SV_IsSlotUsed(slot)) { Con_Message("Warning:G_LoadGame: Save slot #%i is not in use, aborting load.\n", slot); return false; @@ -2383,8 +2383,8 @@ void G_DoLoadGame(void) if(IS_NETGAME) return; // Copy the base slot to the autosave slot. - SV_ClearSaveSlot(AUTO_SLOT); - SV_CopySaveSlot(BASE_SLOT, AUTO_SLOT); + SV_ClearSlot(AUTO_SLOT); + SV_CopySlot(BASE_SLOT, AUTO_SLOT); #endif } @@ -2491,7 +2491,7 @@ void G_DoSaveGame(void) else { // No name specified. - const gamesaveinfo_t* info = SV_GameSaveInfoForSlot(gaSaveGameSlot); + const saveinfo_t* info = SV_SaveInfoForSlot(gaSaveGameSlot); if(!gaSaveGameGenerateName && !Str_IsEmpty(&info->name)) { // Slot already in use; reuse the existing name. @@ -3388,13 +3388,13 @@ D_CMD(LoadGame) } // Ensure we have up-to-date info. - SV_UpdateGameSaveInfo(); + SV_UpdateAllSaveInfo(); - slot = SV_ParseGameSaveSlot(argv[1]); - if(SV_IsGameSaveSlotUsed(slot)) + slot = SV_ParseSlotIdentifier(argv[1]); + if(SV_IsSlotUsed(slot)) { // A known used slot identifier. - const gamesaveinfo_t* info; + const saveinfo_t* info; char buf[80]; if(confirm || !cfg.confirmQuickGameSave) @@ -3404,7 +3404,7 @@ D_CMD(LoadGame) return G_LoadGame(slot); } - info = SV_GameSaveInfoForSlot(slot); + info = SV_SaveInfoForSlot(slot); dd_snprintf(buf, 80, QLPROMPT, Str_Text(&info->name)); S_LocalSound(SFX_QUICKLOAD_PROMPT, NULL); @@ -3482,13 +3482,13 @@ D_CMD(SaveGame) } // Ensure we have up-to-date info. - SV_UpdateGameSaveInfo(); + SV_UpdateAllSaveInfo(); - slot = SV_ParseGameSaveSlot(argv[1]); + slot = SV_ParseSlotIdentifier(argv[1]); if(SV_IsUserWritableSlot(slot)) { // A known slot identifier. - const boolean slotIsUsed = SV_IsGameSaveSlotUsed(slot); + const boolean slotIsUsed = SV_IsSlotUsed(slot); const char* name = (argc >= 3 && stricmp(argv[2], "confirm"))? argv[2] : NULL; char buf[80]; @@ -3500,7 +3500,7 @@ D_CMD(SaveGame) } { - const gamesaveinfo_t* info = SV_GameSaveInfoForSlot(slot); + const saveinfo_t* info = SV_SaveInfoForSlot(slot); dd_snprintf(buf, 80, QSPROMPT, Str_Text(&info->name)); S_LocalSound(SFX_QUICKSAVE_PROMPT, NULL); diff --git a/doomsday/plugins/common/src/hu_menu.c b/doomsday/plugins/common/src/hu_menu.c index 691970e5ef..55198a318d 100644 --- a/doomsday/plugins/common/src/hu_menu.c +++ b/doomsday/plugins/common/src/hu_menu.c @@ -3287,7 +3287,7 @@ void Hu_MenuUpdateGameSaveWidgets(void) // Prompt a refresh of the game-save info. We don't yet actively monitor // the contents of the game-save paths, so instead we settle for manual // updates whenever the save/load menu is opened. - SV_UpdateGameSaveInfo(); + SV_UpdateAllSaveInfo(); // Update widgets. page = Hu_MenuFindPageByName("LoadGame"); @@ -3295,7 +3295,7 @@ void Hu_MenuUpdateGameSaveWidgets(void) { mn_object_t* obj = MN_MustFindObjectOnPage(page, 0, saveSlotObjectIds[i]); mndata_edit_t* edit = (mndata_edit_t*) obj->_typedata; - const gamesaveinfo_t* info = SV_GameSaveInfoForSlot(edit->data2); + const saveinfo_t* info = SV_SaveInfoForSlot(edit->data2); const char* text = ""; MNObject_SetFlags(obj, FO_SET, MNF_DISABLED); diff --git a/doomsday/plugins/common/src/p_saveg.c b/doomsday/plugins/common/src/p_saveg.c index b492a25cf0..4d72a5a3a6 100644 --- a/doomsday/plugins/common/src/p_saveg.c +++ b/doomsday/plugins/common/src/p_saveg.c @@ -402,7 +402,7 @@ void SV_Register(void) #if __JHEXEN__ void SV_HxInitBaseSlot(void) { - SV_ClearSaveSlot(BASE_SLOT); + SV_ClearSlot(BASE_SLOT); } #endif @@ -1319,7 +1319,7 @@ Con_Error("SV_WriteMobj: Mobj using tracer. Possibly saved incorrectly."); } #if !__JDOOM64__ -void SV_UpdateReadMobjFlags(mobj_t* mo, int ver) +void SV_TranslateLegacyMobjFlags(mobj_t* mo, int ver) { #if __JDOOM__ || __JHERETIC__ if(ver < 6) @@ -1427,7 +1427,7 @@ static void RestoreMobj(mobj_t *mo, int ver) #if !__JDOOM64__ // Do we need to update this mobj's flag values? if(ver < MOBJ_SAVEVERSION) - SV_UpdateReadMobjFlags(mo, ver); + SV_TranslateLegacyMobjFlags(mo, ver); #endif P_MobjSetOrigin(mo); @@ -4801,14 +4801,14 @@ boolean SV_LoadGame(int slot) // Compose the possibly relative game save path. Str_Init(&path); - SV_GameSavePathForSlot(logicalSlot, &path); + SV_ComposeSavePathForSlot(logicalSlot, &path); #if __JHEXEN__ // Copy all needed save files to the base slot if(slot != BASE_SLOT) { - SV_ClearSaveSlot(BASE_SLOT); - SV_CopySaveSlot(slot, BASE_SLOT); + SV_ClearSlot(BASE_SLOT); + SV_CopySlot(slot, BASE_SLOT); } #endif @@ -4840,14 +4840,14 @@ boolean SV_LoadGame(int slot) return !loadError; } -void SV_SaveClient(uint gameId) +void SV_SaveGameClient(uint gameId) { #if !__JHEXEN__ // unsupported in jHexen player_t* pl = &players[CONSOLEPLAYER]; mobj_t* mo = pl->plr->mo; ddstring_t gameSavePath; - errorIfNotInited("SV_SaveClient"); + errorIfNotInited("SV_SaveGameClient"); if(!IS_CLIENT || !mo) return; @@ -4855,10 +4855,10 @@ void SV_SaveClient(uint gameId) playerHeaderOK = false; // Uninitialized. Str_Init(&gameSavePath); - SV_ClientGameSavePathForGameId(gameId, &gameSavePath); + SV_ComposeSavePathForClientGameId(gameId, &gameSavePath); if(!SV_OpenFile(Str_Text(&gameSavePath), "wp")) { - Con_Message("Warning:SV_SaveClient: Failed opening \"%s\" for writing.\n", Str_Text(&gameSavePath)); + Con_Message("Warning:SV_SaveGameClient: Failed opening \"%s\" for writing.\n", Str_Text(&gameSavePath)); Str_Free(&gameSavePath); return; } @@ -4902,18 +4902,18 @@ void SV_SaveClient(uint gameId) SV_CloseFile(); // Update our game save info. - SV_UpdateGameSaveInfo(); + SV_UpdateAllSaveInfo(); #endif } -void SV_LoadClient(uint gameId) +void SV_LoadGameClient(uint gameId) { #if !__JHEXEN__ // unsupported in jHexen player_t* cpl = players + CONSOLEPLAYER; mobj_t* mo = cpl->plr->mo; ddstring_t gameSavePath; - errorIfNotInited("SV_LoadClient"); + errorIfNotInited("SV_LoadGameClient"); if(!IS_CLIENT || !mo) return; @@ -4921,11 +4921,11 @@ void SV_LoadClient(uint gameId) playerHeaderOK = false; // Uninitialized. Str_Init(&gameSavePath); - SV_ClientGameSavePathForGameId(gameId, &gameSavePath); + SV_ComposeSavePathForClientGameId(gameId, &gameSavePath); if(!SV_OpenFile(Str_Text(&gameSavePath), "rp")) { - Con_Message("Warning:SV_LoadClient: Failed opening \"%s\" for reading.\n", Str_Text(&gameSavePath)); + Con_Message("Warning:SV_LoadGameClient: Failed opening \"%s\" for reading.\n", Str_Text(&gameSavePath)); Str_Free(&gameSavePath); return; } @@ -4935,7 +4935,7 @@ void SV_LoadClient(uint gameId) if(hdr.magic != MY_CLIENT_SAVE_MAGIC) { SV_CloseFile(); - Con_Message("SV_LoadClient: Bad magic!\n"); + Con_Message("SV_LoadGameClient: Bad magic!\n"); return; } @@ -4991,7 +4991,7 @@ static void unarchiveMap(void) // Compose the full path to the saved map. Str_Init(&path); - SV_GameSavePathForMapSlot(gameMap+1, BASE_SLOT, &path); + SV_ComposeSavePathForMapSlot(gameMap+1, BASE_SLOT, &path); #ifdef _DEBUG Con_Printf("unarchiveMap: Reading %s\n", Str_Text(&path)); @@ -5085,7 +5085,7 @@ int SV_SaveGameWorker(void* ptr) // Compose the full name to the saved map file. Str_Init(&mapPath); - SV_GameSavePathForMapSlot(gameMap+1, BASE_SLOT, &mapPath); + SV_ComposeSavePathForMapSlot(gameMap+1, BASE_SLOT, &mapPath); SV_OpenFile(Str_Text(&mapPath), "wp"); P_ArchiveMap(true); // true = save player info @@ -5111,10 +5111,10 @@ int SV_SaveGameWorker(void* ptr) #if __JHEXEN__ // Clear all save files at destination slot. - SV_ClearSaveSlot(param->slot); + SV_ClearSlot(param->slot); // Copy base slot to destination slot. - SV_CopySaveSlot(BASE_SLOT, param->slot); + SV_CopySlot(BASE_SLOT, param->slot); #endif Con_BusyWorkerEnd(); @@ -5147,7 +5147,7 @@ boolean SV_SaveGame(int slot, const char* name) } Str_Init(&path); - SV_GameSavePathForSlot(logicalSlot, &path); + SV_ComposeSavePathForSlot(logicalSlot, &path); params.path = &path; params.name = name; @@ -5167,7 +5167,7 @@ boolean SV_SaveGame(int slot, const char* name) } // Update our game save info. - SV_UpdateGameSaveInfo(); + SV_UpdateAllSaveInfo(); Str_Free(&path); return !saveError; @@ -5192,7 +5192,7 @@ void SV_HxMapTeleport(uint map, uint position) * First, determine whether we've been to this map previously and if so, * whether we need to load the archived map state. */ - if(!deathmatch && SV_HxGameSaveSlotHasMapState(BASE_SLOT, map+1)) + if(!deathmatch && SV_HxHaveMapSaveForSlot(BASE_SLOT, map+1)) revisit = true; else revisit = false; @@ -5212,7 +5212,7 @@ void SV_HxMapTeleport(uint map, uint position) // Compose the full path name to the saved map file. Str_Init(&mapFilePath); - SV_GameSavePathForMapSlot(gameMap+1, BASE_SLOT, &mapFilePath); + SV_ComposeSavePathForMapSlot(gameMap+1, BASE_SLOT, &mapFilePath); SV_OpenFile(Str_Text(&mapFilePath), "wp"); P_ArchiveMap(false); @@ -5228,7 +5228,7 @@ void SV_HxMapTeleport(uint map, uint position) else { // Entering new cluster - clear base slot - SV_ClearSaveSlot(BASE_SLOT); + SV_ClearSlot(BASE_SLOT); } } diff --git a/doomsday/plugins/common/src/p_saveio.c b/doomsday/plugins/common/src/p_saveio.c index 89cee1c814..853d1d8ba1 100644 --- a/doomsday/plugins/common/src/p_saveio.c +++ b/doomsday/plugins/common/src/p_saveio.c @@ -42,14 +42,14 @@ static ddstring_t savePath; // e.g., "savegame/" #if !__JHEXEN__ static ddstring_t clientSavePath; // e.g., "savegame/client/" #endif -static gamesaveinfo_t* gameSaveInfo; -static gamesaveinfo_t autoGameSaveInfo; +static saveinfo_t* saveInfo; +static saveinfo_t autoSaveInfo; #if __JHEXEN__ static saveptr_t saveptr; #endif -static boolean readGameSaveHeader(gamesaveinfo_t* info); +static boolean readGameSaveHeader(saveinfo_t* info); static void errorIfNotInited(const char* callerName) { @@ -59,14 +59,14 @@ static void errorIfNotInited(const char* callerName) exit(1); } -static void initGameSaveInfo(gamesaveinfo_t* info) +static void initSaveInfo(saveinfo_t* info) { if(!info) return; Str_Init(&info->filePath); Str_Init(&info->name); } -static void updateGameSaveInfo(gamesaveinfo_t* info, ddstring_t* savePath) +static void updateSaveInfo(saveinfo_t* info, ddstring_t* savePath) { if(!info) return; @@ -86,7 +86,7 @@ static void updateGameSaveInfo(gamesaveinfo_t* info, ddstring_t* savePath) } } -static void clearGameSaveInfo(gamesaveinfo_t* info) +static void clearSaveInfo(saveinfo_t* info) { if(!info) return; Str_Free(&info->filePath); @@ -205,7 +205,7 @@ void SV_InitIO(void) #if !__JHEXEN__ Str_Init(&clientSavePath); #endif - gameSaveInfo = NULL; + saveInfo = NULL; inited = true; savefile = 0; } @@ -216,17 +216,17 @@ void SV_ShutdownIO(void) SV_CloseFile(); - if(gameSaveInfo) + if(saveInfo) { int i; for(i = 0; i < NUMSAVESLOTS; ++i) { - gamesaveinfo_t* info = &gameSaveInfo[i]; - clearGameSaveInfo(info); + saveinfo_t* info = &saveInfo[i]; + clearSaveInfo(info); } - free(gameSaveInfo); gameSaveInfo = NULL; + free(saveInfo); saveInfo = NULL; - clearGameSaveInfo(&autoGameSaveInfo); + clearSaveInfo(&autoSaveInfo); } Str_Free(&savePath); @@ -301,11 +301,11 @@ void SV_CloseFile(void) } } -void SV_ClearSaveSlot(int slot) +void SV_ClearSlot(int slot) { AutoStr* path; - errorIfNotInited("SV_ClearSaveSlot"); + errorIfNotInited("SV_ClearSlot"); if(!SV_IsValidSlot(slot)) return; { int i; @@ -337,7 +337,7 @@ boolean SV_IsUserWritableSlot(int slot) return SV_IsValidSlot(slot); } -static boolean readGameSaveHeader(gamesaveinfo_t* info) +static boolean readGameSaveHeader(saveinfo_t* info) { boolean found = false; #if __JHEXEN__ @@ -403,26 +403,26 @@ static boolean readGameSaveHeader(gamesaveinfo_t* info) } /// Re-build game-save info by re-scanning the save paths and populating the list. -static void buildGameSaveInfo(void) +static void buildSaveInfo(void) { int i; assert(inited); - if(!gameSaveInfo) + if(!saveInfo) { // Not yet been here. We need to allocate and initialize the game-save info list. - gameSaveInfo = (gamesaveinfo_t*) malloc(NUMSAVESLOTS * sizeof(*gameSaveInfo)); - if(!gameSaveInfo) - Con_Error("buildGameSaveInfo: Failed on allocation of %lu bytes for game-save info list.", - (unsigned long) (NUMSAVESLOTS * sizeof(*gameSaveInfo))); + saveInfo = (saveinfo_t*) malloc(NUMSAVESLOTS * sizeof(*saveInfo)); + if(!saveInfo) + Con_Error("buildSaveInfo: Failed on allocation of %lu bytes for game-save info list.", + (unsigned long) (NUMSAVESLOTS * sizeof(*saveInfo))); // Initialize. for(i = 0; i < NUMSAVESLOTS; ++i) { - gamesaveinfo_t* info = &gameSaveInfo[i]; - initGameSaveInfo(info); + saveinfo_t* info = &saveInfo[i]; + initSaveInfo(info); } - initGameSaveInfo(&autoGameSaveInfo); + initSaveInfo(&autoSaveInfo); } /// Scan the save paths and populate the list. @@ -430,55 +430,55 @@ static void buildGameSaveInfo(void) /// which match the default game-save file naming convention. for(i = 0; i < NUMSAVESLOTS; ++i) { - gamesaveinfo_t* info = &gameSaveInfo[i]; - updateGameSaveInfo(info, composeGameSavePathForSlot(i)); + saveinfo_t* info = &saveInfo[i]; + updateSaveInfo(info, composeGameSavePathForSlot(i)); } - updateGameSaveInfo(&autoGameSaveInfo, composeGameSavePathForSlot(AUTO_SLOT)); + updateSaveInfo(&autoSaveInfo, composeGameSavePathForSlot(AUTO_SLOT)); } /// Given a logical save slot identifier retrieve the assciated game-save info. -static gamesaveinfo_t* findGameSaveInfoForSlot(int slot) +static saveinfo_t* findSaveInfoForSlot(int slot) { - static gamesaveinfo_t invalidInfo = { { "" }, { "" } }; + static saveinfo_t invalidInfo = { { "" }, { "" } }; assert(inited); if(slot == AUTO_SLOT) { // On first call - automatically build and populate game-save info. - if(!gameSaveInfo) - buildGameSaveInfo(); + if(!saveInfo) + buildSaveInfo(); // Retrieve the info for this slot. - return &autoGameSaveInfo; + return &autoSaveInfo; } if(slot >= 0 && slot < NUMSAVESLOTS) { // On first call - automatically build and populate game-save info. - if(!gameSaveInfo) - buildGameSaveInfo(); + if(!saveInfo) + buildSaveInfo(); // Retrieve the info for this slot. - return &gameSaveInfo[slot]; + return &saveInfo[slot]; } return &invalidInfo; } -const gamesaveinfo_t* SV_GameSaveInfoForSlot(int slot) +const saveinfo_t* SV_SaveInfoForSlot(int slot) { - errorIfNotInited("SV_GameSaveInfoForSlot"); - return findGameSaveInfoForSlot(slot); + errorIfNotInited("SV_SaveInfoForSlot"); + return findSaveInfoForSlot(slot); } -void SV_UpdateGameSaveInfo(void) +void SV_UpdateAllSaveInfo(void) { - errorIfNotInited("SV_UpdateGameSaveInfo"); - buildGameSaveInfo(); + errorIfNotInited("SV_UpdateAllSaveInfo"); + buildSaveInfo(); } -int SV_ParseGameSaveSlot(const char* str) +int SV_ParseSlotIdentifier(const char* str) { int slot; // Try game-save name match. - slot = SV_FindGameSaveSlotForName(str); + slot = SV_SlotForSaveName(str); if(slot >= 0) { return slot; @@ -508,24 +508,24 @@ int SV_ParseGameSaveSlot(const char* str) return -1; } -int SV_FindGameSaveSlotForName(const char* name) +int SV_SlotForSaveName(const char* name) { int saveSlot = -1; - errorIfNotInited("SV_FindGameSaveSlotForName"); + errorIfNotInited("SV_SlotForSaveName"); if(name && name[0]) { int i = 0; // On first call - automatically build and populate game-save info. - if(!gameSaveInfo) + if(!saveInfo) { - buildGameSaveInfo(); + buildSaveInfo(); } do { - const gamesaveinfo_t* info = &gameSaveInfo[i]; + const saveinfo_t* info = &saveInfo[i]; if(!Str_CompareIgnoreCase(&info->name, name)) { // This is the one! @@ -536,18 +536,18 @@ int SV_FindGameSaveSlotForName(const char* name) return saveSlot; } -boolean SV_GameSavePathForSlot(int slot, ddstring_t* path) +boolean SV_ComposeSavePathForSlot(int slot, ddstring_t* path) { - errorIfNotInited("SV_GameSavePathForSlot"); + errorIfNotInited("SV_ComposeSavePathForSlot"); if(!path) return false; Str_CopyOrClear(path, composeGameSavePathForSlot(slot)); return !Str_IsEmpty(path); } #if __JHEXEN__ -boolean SV_GameSavePathForMapSlot(uint map, int slot, ddstring_t* path) +boolean SV_ComposeSavePathForMapSlot(uint map, int slot, ddstring_t* path) { - errorIfNotInited("SV_GameSavePathForMapSlot"); + errorIfNotInited("SV_ComposeSavePathForMapSlot"); if(!path) return false; Str_CopyOrClear(path, composeGameSavePathForSlot2(slot, (int)map)); return !Str_IsEmpty(path); @@ -574,26 +574,26 @@ static boolean composeClientGameSavePathForGameId(uint gameId, ddstring_t* path) return true; } -boolean SV_ClientGameSavePathForGameId(uint gameId, ddstring_t* path) +boolean SV_ComposeSavePathForClientGameId(uint gameId, ddstring_t* path) { - errorIfNotInited("SV_GameSavePathForSlot"); + errorIfNotInited("SV_ComposeSavePathForSlot"); if(!path) return false; Str_Clear(path); return composeClientGameSavePathForGameId(gameId, path); } #endif -boolean SV_IsGameSaveSlotUsed(int slot) +boolean SV_IsSlotUsed(int slot) { - const gamesaveinfo_t* info; - errorIfNotInited("SV_IsGameSaveSlotUsed"); + const saveinfo_t* info; + errorIfNotInited("SV_IsSlotUsed"); - info = SV_GameSaveInfoForSlot(slot); + info = SV_SaveInfoForSlot(slot); return !Str_IsEmpty(&info->filePath); } #if __JHEXEN__ -boolean SV_HxGameSaveSlotHasMapState(int slot, uint map) +boolean SV_HxHaveMapSaveForSlot(int slot, uint map) { AutoStr* path = composeGameSavePathForSlot2(slot, (int)map); if(!path || Str_IsEmpty(path)) return false; @@ -601,16 +601,16 @@ boolean SV_HxGameSaveSlotHasMapState(int slot, uint map) } #endif -void SV_CopySaveSlot(int sourceSlot, int destSlot) +void SV_CopySlot(int sourceSlot, int destSlot) { AutoStr* src, *dst; - errorIfNotInited("SV_CopySaveSlot"); + errorIfNotInited("SV_CopySlot"); if(!SV_IsValidSlot(sourceSlot)) { #if _DEBUG - Con_Message("Warning: SV_CopySaveSlot: Source slot %i invalid, save game not copied.\n", sourceSlot); + Con_Message("Warning: SV_CopySlot: Source slot %i invalid, save game not copied.\n", sourceSlot); #endif return; } @@ -618,7 +618,7 @@ void SV_CopySaveSlot(int sourceSlot, int destSlot) if(!SV_IsValidSlot(destSlot)) { #if _DEBUG - Con_Message("Warning: SV_CopySaveSlot: Dest slot %i invalid, save game not copied.\n", destSlot); + Con_Message("Warning: SV_CopySlot: Dest slot %i invalid, save game not copied.\n", destSlot); #endif return; } diff --git a/doomsday/plugins/jdoom/src/p_oldsvg.c b/doomsday/plugins/jdoom/src/p_oldsvg.c index 39da3fb1e8..e6402c51ed 100644 --- a/doomsday/plugins/jdoom/src/p_oldsvg.c +++ b/doomsday/plugins/jdoom/src/p_oldsvg.c @@ -62,7 +62,7 @@ // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- -extern void SV_UpdateReadMobjFlags(mobj_t *mo, int ver); +extern void SV_TranslateLegacyMobjFlags(mobj_t *mo, int ver); // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- @@ -323,7 +323,7 @@ static void SV_ReadMobj(void) SV_ReadLong(); mo->info = info; - SV_UpdateReadMobjFlags(mo, 0); + SV_TranslateLegacyMobjFlags(mo, 0); mo->state = &STATES[PTR2INT(mo->state)]; mo->target = NULL; diff --git a/doomsday/plugins/jheretic/src/p_oldsvg.c b/doomsday/plugins/jheretic/src/p_oldsvg.c index 0333fe1964..befed1357c 100644 --- a/doomsday/plugins/jheretic/src/p_oldsvg.c +++ b/doomsday/plugins/jheretic/src/p_oldsvg.c @@ -65,7 +65,7 @@ // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- -extern void SV_UpdateReadMobjFlags(mobj_t *mo, int ver); +extern void SV_TranslateLegacyMobjFlags(mobj_t *mo, int ver); // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- @@ -344,7 +344,7 @@ static void SV_v13_ReadMobj(void) } mo->info = info; - SV_UpdateReadMobjFlags(mo, 0); + SV_TranslateLegacyMobjFlags(mo, 0); mo->state = &STATES[PTR2INT(mo->state)]; mo->target = NULL;