- fixed savegame loading in Blood.

This commit is contained in:
Christoph Oelckers 2019-11-14 21:22:42 +01:00
parent ba117554b0
commit def63209be
2 changed files with 12 additions and 6 deletions

View file

@ -440,15 +440,19 @@ void MyLoadSave::Save(void)
void LoadSavedInfo(void)
{
FString path = M_GetSavegamesPath() + "%sgame*.sav";
FString path = M_GetSavegamesPath() + "game*.sav";
TArray<FString> saves;
D_AddWildFile(saves, path);
int nCount = 0;
for (auto & savename : saves)
{
auto hFile = fopenFileReader(savename, 0);
OpenSaveGameForRead(savename);
auto hFile = ReadSavegameChunk("snapshot.bld");
if (!hFile.isOpen())
{
FinishSavegameRead();
ThrowError("Error loading save file header.");
}
int vc;
short v4;
vc = 0;
@ -471,6 +475,7 @@ void LoadSavedInfo(void)
strcpy(strRestoreGameStrings[gSaveGameOptions[nCount].nSaveGameSlot], gSaveGameOptions[nCount].szUserGameName);
nCount++;
}
FinishSavegameRead();
}
void UpdateSavedInfo(int nSlot)

View file

@ -41,6 +41,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "screen.h"
#include "sound.h"
#include "view.h"
#include "cmdlib.h"
#include "i_specialpaths.h"
EXTERN_CVAR(Bool, hud_powerupduration)
@ -2120,7 +2121,7 @@ void LoadGame(CGameMenuItemZEditBitmap *pItem, CGameMenuEvent *event)
if (gGameOptions.nGameType > 0)
return;
snprintf(strLoadGameName, BMAX_PATH, "%sgame00%02d.sav", M_GetSavegamesPath().GetChars(), nSlot);
if (!testkopen(strLoadGameName, 0))
if (!FileExists(strLoadGameName))
return;
viewLoadingScreen(2518, "Loading", "Loading Saved Game", strRestoreGameStrings[nSlot]);
videoNextPage();
@ -2135,7 +2136,7 @@ void QuickLoadGame(void)
if (gGameOptions.nGameType > 0)
return;
snprintf(strLoadGameName, BMAX_PATH, "%sgame00%02d.sav", M_GetSavegamesPath().GetChars(), gQuickLoadSlot);
if (!testkopen(strLoadGameName, 0))
if (!FileExists(strLoadGameName))
return;
viewLoadingScreen(2518, "Loading", "Loading Saved Game", strRestoreGameStrings[gQuickLoadSlot]);
videoNextPage();