mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 04:00:42 +00:00
- cleaned out the remains of the old savegame code.
This commit is contained in:
parent
67dff2a863
commit
1d6d58538c
4 changed files with 34 additions and 113 deletions
|
@ -268,13 +268,6 @@ void FuncMummy(int nSector, int edx, int nRun);
|
|||
|
||||
// object
|
||||
|
||||
enum
|
||||
{
|
||||
kMaxPoints = 1024,
|
||||
kMaxSlides = 128,
|
||||
kMaxElevs = 1024
|
||||
};
|
||||
|
||||
enum kStatus
|
||||
{
|
||||
kStatDestructibleSprite = 97,
|
||||
|
@ -487,12 +480,6 @@ void FuncSpider(int a, int b, int nRun);
|
|||
|
||||
// switch
|
||||
|
||||
enum
|
||||
{
|
||||
kMaxLinks = 1024,
|
||||
kMaxSwitches = 1024
|
||||
};
|
||||
|
||||
void InitLink();
|
||||
void InitSwitch();
|
||||
|
||||
|
|
|
@ -223,19 +223,6 @@ const uint32_t kSpiritX = 106;
|
|||
const uint32_t kSpiritY = 97;
|
||||
const uint32_t WorktileSize = kSpiritX * 2 * kSpiritY * 2;
|
||||
|
||||
struct SavegameHelper
|
||||
{
|
||||
FString Name;
|
||||
TArray<std::pair<void*, size_t>> Elements;
|
||||
SavegameHelper(const char* name, ...);
|
||||
void Load();
|
||||
void Save();
|
||||
};
|
||||
|
||||
#define SV(v) &v, sizeof(v)
|
||||
#define SA(a) &a, sizeof(a)
|
||||
|
||||
|
||||
|
||||
struct GameInterface : ::GameInterface
|
||||
{
|
||||
|
@ -248,8 +235,6 @@ struct GameInterface : ::GameInterface
|
|||
bool StartGame(FNewGameStartup& gs) override;
|
||||
FSavegameInfo GetSaveSig() override;
|
||||
void SerializeGameState(FSerializer& arc);
|
||||
bool LoadGame() override;
|
||||
bool SaveGame() override;
|
||||
bool CanSave() override;
|
||||
ReservedSpace GetReservedScreenSpace(int viewsize) override { return { 0, 24 }; }
|
||||
void QuitToTitle() override;
|
||||
|
|
|
@ -36,6 +36,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "statistics.h"
|
||||
#include "v_draw.h"
|
||||
#include <string>
|
||||
#include "mapinfo.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
@ -75,6 +76,7 @@ unsigned int menu_RandomBit2()
|
|||
|
||||
void InitEnergyTile()
|
||||
{
|
||||
word_9AB5B = 0;
|
||||
memset(energytile, 96, sizeof(energytile));
|
||||
}
|
||||
|
||||
|
|
|
@ -63,60 +63,44 @@ void SerializeSet(FSerializer& arc);
|
|||
void SerializeSpider(FSerializer& arc);
|
||||
void SerializeWasp(FSerializer& arc);
|
||||
|
||||
static TArray<SavegameHelper*> sghelpers(TArray<SavegameHelper*>::NoInit);
|
||||
|
||||
bool GameInterface::SaveGame()
|
||||
{
|
||||
for (auto sgh : sghelpers) sgh->Save();
|
||||
return 1; // CHECKME
|
||||
}
|
||||
|
||||
void GameInterface::SerializeGameState(FSerializer& arc)
|
||||
{
|
||||
if (arc.BeginObject("exhumed"))
|
||||
{
|
||||
SerializeState(arc);
|
||||
SerializeAnim(arc);
|
||||
SerializeBubbles(arc);
|
||||
SerializeBullet(arc);
|
||||
SerializeGrenade(arc);
|
||||
SerializeGun(arc);
|
||||
SerializeInit(arc);
|
||||
SerializeItems(arc);
|
||||
SerializeMove(arc);
|
||||
SerializeLighting(arc);
|
||||
SerializeObjects(arc);
|
||||
SerializePlayer(arc);
|
||||
SerializeRa(arc);
|
||||
SerializeRand(arc);
|
||||
SerializeRunList(arc);
|
||||
SerializeSequence(arc);
|
||||
SerializeSnake(arc);
|
||||
SerializeSwitch(arc);
|
||||
SerializeView(arc);
|
||||
SerializeState(arc);
|
||||
SerializeAnim(arc);
|
||||
SerializeBubbles(arc);
|
||||
SerializeBullet(arc);
|
||||
SerializeGrenade(arc);
|
||||
SerializeGun(arc);
|
||||
SerializeInit(arc);
|
||||
SerializeItems(arc);
|
||||
SerializeMove(arc);
|
||||
SerializeLighting(arc);
|
||||
SerializeObjects(arc);
|
||||
SerializePlayer(arc);
|
||||
SerializeRa(arc);
|
||||
SerializeRand(arc);
|
||||
SerializeRunList(arc);
|
||||
SerializeSequence(arc);
|
||||
SerializeSnake(arc);
|
||||
SerializeSwitch(arc);
|
||||
SerializeView(arc);
|
||||
|
||||
SerializeAnubis(arc);
|
||||
SerializeFish(arc);
|
||||
SerializeLavadude(arc);
|
||||
SerializeLion(arc);
|
||||
SerializeMummy(arc);
|
||||
SerializeQueen(arc);
|
||||
SerializeRat(arc);
|
||||
SerializeRex(arc);
|
||||
SerializeRoach(arc);
|
||||
SerializeScorpion(arc);
|
||||
SerializeSet(arc);
|
||||
SerializeSpider(arc);
|
||||
SerializeWasp(arc);
|
||||
SerializeAnubis(arc);
|
||||
SerializeFish(arc);
|
||||
SerializeLavadude(arc);
|
||||
SerializeLion(arc);
|
||||
SerializeMummy(arc);
|
||||
SerializeQueen(arc);
|
||||
SerializeRat(arc);
|
||||
SerializeRex(arc);
|
||||
SerializeRoach(arc);
|
||||
SerializeScorpion(arc);
|
||||
SerializeSet(arc);
|
||||
SerializeSpider(arc);
|
||||
SerializeWasp(arc);
|
||||
}
|
||||
}
|
||||
|
||||
bool GameInterface::LoadGame()
|
||||
{
|
||||
|
||||
for (auto sgh : sghelpers) sgh->Load();
|
||||
FinishSavegameRead();
|
||||
|
||||
// reset the sky in case it hasn't been done yet.
|
||||
psky_t* pSky = tileSetupSky(DEFAULTPSKY);
|
||||
pSky->tileofs[0] = 0;
|
||||
|
@ -146,43 +130,6 @@ bool GameInterface::LoadGame()
|
|||
}
|
||||
|
||||
Mus_ResumeSaved();
|
||||
return 1; // CHECKME
|
||||
}
|
||||
|
||||
|
||||
SavegameHelper::SavegameHelper(const char* name, ...)
|
||||
{
|
||||
Name = name;
|
||||
sghelpers.Push(this);
|
||||
va_list ap;
|
||||
va_start(ap, name);
|
||||
for(;;)
|
||||
{
|
||||
void* addr = va_arg(ap, void*);
|
||||
if (!addr) break;
|
||||
size_t size = va_arg(ap, size_t);
|
||||
Elements.Push(std::make_pair(addr, size));
|
||||
}
|
||||
}
|
||||
|
||||
void SavegameHelper::Load()
|
||||
{
|
||||
auto fr = ReadSavegameChunk(Name);
|
||||
if (!fr.isOpen()) return;
|
||||
for (auto& entry : Elements)
|
||||
{
|
||||
auto read = fr.Read(entry.first, entry.second);
|
||||
if (read != entry.second) I_Error("Save game read error in %s", Name.GetChars());
|
||||
}
|
||||
}
|
||||
void SavegameHelper::Save()
|
||||
{
|
||||
auto fw = WriteSavegameChunk(Name);
|
||||
for (auto& entry : Elements)
|
||||
{
|
||||
auto write = fw->Write(entry.first, entry.second);
|
||||
if (write != entry.second) I_Error("Save game write error in %s", Name.GetChars());
|
||||
}
|
||||
}
|
||||
|
||||
END_PS_NS
|
||||
|
|
Loading…
Reference in a new issue