2021-05-17 18:47:39 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
2021-12-26 17:47:58 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2021-05-17 18:47:39 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* aint32 with this program; if not, write to the Free Software
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Based on the original sources
|
|
|
|
* Faery Tale II -- The Halls of the Dead
|
|
|
|
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SAGA2_LOADSAVE_H
|
|
|
|
#define SAGA2_LOADSAVE_H
|
|
|
|
|
2021-07-14 03:12:07 +00:00
|
|
|
#include "common/memstream.h"
|
|
|
|
|
2021-05-17 18:47:39 +00:00
|
|
|
namespace Saga2 {
|
|
|
|
|
2021-07-14 03:12:07 +00:00
|
|
|
#define CHUNK_BEGIN Common::MemoryWriteStreamDynamic *out = new Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES)
|
|
|
|
|
2021-07-25 14:47:54 +00:00
|
|
|
#define CHUNK_END outS->writeUint32LE(out->pos()); \
|
|
|
|
outS->write(out->getData(), out->pos()); \
|
2021-07-14 03:12:07 +00:00
|
|
|
delete out
|
|
|
|
|
2021-07-12 15:07:43 +00:00
|
|
|
/* ===================================================================== *
|
|
|
|
SaveFileHeader class
|
|
|
|
* ===================================================================== */
|
|
|
|
|
|
|
|
// This structure represents the first 128 bytes written to a save game
|
|
|
|
// file. It stores the game ID and the long name of the saved game state.
|
|
|
|
|
|
|
|
struct SaveFileHeader {
|
|
|
|
enum {
|
|
|
|
kSaveNameSize = 40,
|
|
|
|
kHeaderSize = 128
|
|
|
|
};
|
|
|
|
|
2021-09-11 09:13:35 +00:00
|
|
|
ChunkID gameID; // ID of game (FTA2 or DINO)
|
2021-07-12 15:07:43 +00:00
|
|
|
Common::String saveName; // The long name of the saved
|
|
|
|
|
|
|
|
void read(Common::InSaveFile *in);
|
|
|
|
void write(Common::OutSaveFile *out);
|
|
|
|
};
|
|
|
|
|
2021-05-17 18:47:39 +00:00
|
|
|
// Load initial game state
|
2021-09-11 09:13:35 +00:00
|
|
|
void initGameState();
|
2021-05-17 18:47:39 +00:00
|
|
|
|
|
|
|
// Save the current game state
|
2021-07-15 19:22:52 +00:00
|
|
|
void saveGame(Common::OutSaveFile *out, Common::String saveName);
|
2021-05-17 18:47:39 +00:00
|
|
|
|
|
|
|
// Load a previously saved game state
|
|
|
|
void loadSavedGameState(int16 saveNo);
|
|
|
|
|
2021-08-20 11:04:57 +00:00
|
|
|
// Perform a cleanup and load process with fade-in
|
|
|
|
void loadGame(int16 saveNo);
|
|
|
|
|
2021-05-17 18:47:39 +00:00
|
|
|
// Cleanup the game state
|
2021-09-11 09:13:35 +00:00
|
|
|
void cleanupGameState();
|
2021-05-17 18:47:39 +00:00
|
|
|
|
2021-06-08 17:00:13 +00:00
|
|
|
void checkRestartGame(const char *exeName);
|
2021-09-11 09:13:35 +00:00
|
|
|
void loadRestartGame();
|
2021-05-17 18:47:39 +00:00
|
|
|
|
|
|
|
} // end of namespace Saga2
|
|
|
|
|
|
|
|
#endif
|