mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Saves: implement isAutoSave for headers
git-svn-id: https://svn.eduke32.com/eduke32@6743 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
b80501b2c2
commit
b437636528
3 changed files with 14 additions and 9 deletions
|
@ -6803,7 +6803,7 @@ MAIN_LOOP_RESTART:
|
|||
G_DrawRooms(myconnectindex, 65536);
|
||||
g_screenCapture = 0;
|
||||
|
||||
G_SavePlayerMaybeMulti(g_lastautosave);
|
||||
G_SavePlayerMaybeMulti(g_lastautosave, true);
|
||||
g_quickload = &g_lastautosave;
|
||||
|
||||
OSD_Printf("Saved: %s\n", g_lastautosave.path);
|
||||
|
|
|
@ -176,6 +176,8 @@ static void ReadSaveGameHeaders_CACHE1D(CACHE1D_FIND_REC *f)
|
|||
else
|
||||
msv.isOldVer = 0;
|
||||
|
||||
msv.isAutoSave = h.isAutoSave();
|
||||
|
||||
if (k >= 0 && h.savename[0] != '\0')
|
||||
{
|
||||
memcpy(msv.brief.name, h.savename, ARRAY_SIZE(msv.brief.name));
|
||||
|
@ -412,7 +414,7 @@ static void G_SavePalette(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
int32_t G_SavePlayer(savebrief_t & sv)
|
||||
int32_t G_SavePlayer(savebrief_t & sv, bool isAutoSave)
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
G_SavePalette();
|
||||
|
@ -471,7 +473,7 @@ int32_t G_SavePlayer(savebrief_t & sv)
|
|||
VM_OnEvent(EVENT_SAVEGAME, g_player[screenpeek].ps->i, screenpeek);
|
||||
|
||||
// SAVE!
|
||||
sv_saveandmakesnapshot(fil, sv.name, 0, 0, 0, 0);
|
||||
sv_saveandmakesnapshot(fil, sv.name, 0, 0, 0, 0, isAutoSave);
|
||||
|
||||
fclose(fil);
|
||||
|
||||
|
@ -523,7 +525,7 @@ void G_LoadPlayerMaybeMulti(savebrief_t & sv)
|
|||
}
|
||||
}
|
||||
|
||||
void G_SavePlayerMaybeMulti(savebrief_t & sv)
|
||||
void G_SavePlayerMaybeMulti(savebrief_t & sv, bool isAutoSave)
|
||||
{
|
||||
CONFIG_WriteSetup(2);
|
||||
|
||||
|
@ -534,7 +536,7 @@ void G_SavePlayerMaybeMulti(savebrief_t & sv)
|
|||
}
|
||||
else
|
||||
{
|
||||
G_SavePlayer(sv);
|
||||
G_SavePlayer(sv, isAutoSave);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1315,7 +1317,7 @@ static void SV_AllocSnap(int32_t allocinit)
|
|||
}
|
||||
|
||||
// make snapshot only if spot < 0 (demo)
|
||||
int32_t sv_saveandmakesnapshot(FILE *fil, char const *name, int8_t spot, int8_t recdiffsp, int8_t diffcompress, int8_t synccompress)
|
||||
int32_t sv_saveandmakesnapshot(FILE *fil, char const *name, int8_t spot, int8_t recdiffsp, int8_t diffcompress, int8_t synccompress, bool isAutoSave)
|
||||
{
|
||||
savehead_t h;
|
||||
|
||||
|
@ -1338,6 +1340,8 @@ int32_t sv_saveandmakesnapshot(FILE *fil, char const *name, int8_t spot, int8_t
|
|||
h.majorver = SV_MAJOR_VER;
|
||||
h.minorver = SV_MINOR_VER;
|
||||
h.ptrsize = sizeof(intptr_t);
|
||||
if (isAutoSave)
|
||||
h.ptrsize |= 1u<<7u;
|
||||
h.bytever = BYTEVERSION;
|
||||
h.userbytever = ud.userbytever;
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ struct menusave_t
|
|||
{
|
||||
savebrief_t brief;
|
||||
uint8_t isOldVer = 0;
|
||||
uint8_t isAutoSave = 0;
|
||||
};
|
||||
|
||||
extern savebrief_t g_lastautosave, g_lastusersave, g_freshload;
|
||||
|
@ -111,13 +112,13 @@ int32_t sv_readdiff(int32_t fil);
|
|||
uint32_t sv_writediff(FILE *fil);
|
||||
int32_t sv_loadheader(int32_t fil, int32_t spot, savehead_t *h);
|
||||
int32_t sv_loadsnapshot(int32_t fil, int32_t spot, savehead_t *h);
|
||||
int32_t sv_saveandmakesnapshot(FILE *fil, char const *name, int8_t spot, int8_t recdiffsp, int8_t diffcompress, int8_t synccompress);
|
||||
int32_t sv_saveandmakesnapshot(FILE *fil, char const *name, int8_t spot, int8_t recdiffsp, int8_t diffcompress, int8_t synccompress, bool isAutoSave = false);
|
||||
void sv_freemem();
|
||||
int32_t G_SavePlayer(savebrief_t & sv);
|
||||
int32_t G_SavePlayer(savebrief_t & sv, bool isAutoSave);
|
||||
int32_t G_LoadPlayer(savebrief_t & sv);
|
||||
int32_t G_LoadSaveHeaderNew(char const *fn, savehead_t *saveh);
|
||||
void ReadSaveGameHeaders(void);
|
||||
void G_SavePlayerMaybeMulti(savebrief_t & sv);
|
||||
void G_SavePlayerMaybeMulti(savebrief_t & sv, bool isAutoSave = false);
|
||||
void G_LoadPlayerMaybeMulti(savebrief_t & sv);
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
|
|
Loading…
Reference in a new issue