2019-11-14 20:07:43 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-04-11 21:54:33 +00:00
|
|
|
#include "resourcefile.h"
|
2020-11-21 20:31:50 +00:00
|
|
|
#include "build.h"
|
|
|
|
|
|
|
|
extern FixedBitArray<MAXSPRITES> activeSprites;
|
2019-11-14 20:07:43 +00:00
|
|
|
|
2019-11-26 23:41:26 +00:00
|
|
|
// Savegame utilities
|
|
|
|
class FileReader;
|
|
|
|
|
|
|
|
FString G_BuildSaveName (const char *prefix);
|
2019-12-10 21:22:59 +00:00
|
|
|
int G_ValidateSavegame(FileReader &fr, FString *savetitle, bool formenu);
|
2019-11-26 23:41:26 +00:00
|
|
|
|
2021-05-11 22:31:49 +00:00
|
|
|
void G_LoadGame(const char* filename, bool hidecon = false);
|
2021-05-11 22:21:26 +00:00
|
|
|
void G_SaveGame(const char* fn, const char* desc);
|
|
|
|
void G_DoSaveGame(bool okForQuicksave, bool forceQuicksave, const char* filename, const char* description);
|
2021-05-11 22:31:49 +00:00
|
|
|
void G_DoLoadGame();
|
2020-10-07 16:32:57 +00:00
|
|
|
|
2020-10-04 16:31:48 +00:00
|
|
|
void M_Autosave();
|
2020-01-21 18:22:38 +00:00
|
|
|
|
2019-11-26 23:41:26 +00:00
|
|
|
#define SAVEGAME_EXT ".dsave"
|
2019-11-30 18:23:54 +00:00
|
|
|
|
2021-04-02 09:55:23 +00:00
|
|
|
|
|
|
|
inline FSerializer& Serialize(FSerializer& arc, const char* keyname, spritetype*& w, spritetype** def)
|
|
|
|
{
|
|
|
|
int ndx = w ? int(w - sprite) : -1;
|
|
|
|
arc(keyname, ndx);
|
|
|
|
w = ndx == -1 ? nullptr : sprite + ndx;
|
|
|
|
return arc;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline FSerializer& Serialize(FSerializer& arc, const char* keyname, sectortype*& w, sectortype** def)
|
|
|
|
{
|
|
|
|
int ndx = w ? int(w - sector) : -1;
|
|
|
|
arc(keyname, ndx);
|
|
|
|
w = ndx == -1 ? nullptr : sector + ndx;
|
|
|
|
return arc;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline FSerializer& Serialize(FSerializer& arc, const char* keyname, walltype*& w, walltype** def)
|
|
|
|
{
|
|
|
|
int ndx = w ? int(w - wall) : -1;
|
|
|
|
arc(keyname, ndx);
|
|
|
|
w = ndx == -1 ? nullptr : wall + ndx;
|
|
|
|
return arc;
|
|
|
|
}
|
|
|
|
|