2020-12-21 13:16:29 -03:00
|
|
|
#pragma once
|
|
|
|
#include "ChunkId.h"
|
|
|
|
#include "ChunkReader.h"
|
|
|
|
#include "ChunkWriter.h"
|
|
|
|
#include "LEB128.h"
|
|
|
|
#include "Streams.h"
|
|
|
|
#include "GameFlowScript.h"
|
|
|
|
#include "GameLogicScript.h"
|
|
|
|
|
2021-10-31 21:36:13 +03:00
|
|
|
constexpr auto SAVEGAME_MAX = 16;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-10-31 21:36:13 +03:00
|
|
|
struct Stats
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
|
|
|
unsigned int Timer;
|
|
|
|
unsigned int Distance;
|
|
|
|
unsigned int AmmoUsed;
|
|
|
|
unsigned int AmmoHits;
|
|
|
|
unsigned short Kills;
|
|
|
|
unsigned char Secrets;
|
|
|
|
unsigned char HealthUsed;
|
|
|
|
};
|
|
|
|
|
2021-10-31 21:36:13 +03:00
|
|
|
struct GameStats
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-10-31 21:36:13 +03:00
|
|
|
Stats Game;
|
|
|
|
Stats Level;
|
|
|
|
};
|
|
|
|
|
2021-07-18 15:22:15 +01:00
|
|
|
struct SaveGameHeader
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-10-31 23:55:17 +03:00
|
|
|
std::string LevelName;
|
|
|
|
int Days;
|
|
|
|
int Hours;
|
|
|
|
int Minutes;
|
|
|
|
int Seconds;
|
|
|
|
int Level;
|
|
|
|
int Timer;
|
|
|
|
int Count;
|
|
|
|
bool Present;
|
2020-12-21 13:16:29 -03:00
|
|
|
};
|
|
|
|
|
2021-10-31 21:36:13 +03:00
|
|
|
extern GameStats Statistics;
|
2021-10-31 23:55:17 +03:00
|
|
|
extern SaveGameHeader SavegameInfos[SAVEGAME_MAX];
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-10-31 21:36:13 +03:00
|
|
|
class SaveGame
|
|
|
|
{
|
2020-12-21 13:16:29 -03:00
|
|
|
private:
|
|
|
|
static FileStream* m_stream;
|
|
|
|
static std::vector<LuaVariable> m_luaVariables;
|
|
|
|
|
|
|
|
public:
|
|
|
|
static int LastSaveGame;
|
|
|
|
|
2021-10-15 05:35:44 +02:00
|
|
|
static bool Load(int slot);
|
|
|
|
static bool LoadHeader(int slot, SaveGameHeader* header);
|
|
|
|
static bool Save(int slot);
|
2021-10-31 21:36:13 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
void LoadSavegameInfos();
|