scummvm/engines/saga2/saveload.h

81 lines
2.5 KiB
C
Raw Normal View History

2021-05-17 20:47:39 +02: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.
*
* 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 2
* of the License, or (at your option) any later version.
*
* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* 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 12:12:07 +09:00
#include "common/memstream.h"
2021-05-17 20:47:39 +02:00
namespace Saga2 {
2021-07-14 12:12:07 +09:00
#define CHUNK_BEGIN Common::MemoryWriteStreamDynamic *out = new Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES)
2021-07-25 23:47:54 +09:00
#define CHUNK_END outS->writeUint32LE(out->pos()); \
outS->write(out->getData(), out->pos()); \
2021-07-14 12:12:07 +09:00
delete out
/* ===================================================================== *
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
};
ChunkID gameID; // ID of game (FTA2 of DINO).
Common::String saveName; // The long name of the saved
void read(Common::InSaveFile *in);
void write(Common::OutSaveFile *out);
};
2021-05-17 20:47:39 +02:00
// Load initial game state
void initGameState(void);
// Save the current game state
void saveGame(Common::OutSaveFile *out, Common::String saveName);
2021-05-17 20:47:39 +02:00
// Load a previously saved game state
void loadSavedGameState(int16 saveNo);
2021-08-20 20:04:57 +09:00
// Perform a cleanup and load process with fade-in
void loadGame(int16 saveNo);
2021-05-17 20:47:39 +02:00
// Cleanup the game state
void cleanupGameState(void);
2021-06-09 02:00:13 +09:00
void checkRestartGame(const char *exeName);
2021-05-17 20:47:39 +02:00
void loadRestartGame(void);
} // end of namespace Saga2
#endif