ScummVM API documentation
saveload.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * aint32 with this program; if not, write to the Free Software
19  *
20  *
21  * Based on the original sources
22  * Faery Tale II -- The Halls of the Dead
23  * (c) 1993-1996 The Wyrmkeep Entertainment Co.
24  */
25 
26 #ifndef SAGA2_LOADSAVE_H
27 #define SAGA2_LOADSAVE_H
28 
29 #include "common/memstream.h"
30 
31 namespace Saga2 {
32 
33 #define CHUNK_BEGIN Common::MemoryWriteStreamDynamic *out = new Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES)
34 
35 #define CHUNK_END outS->writeUint32LE(out->pos()); \
36  outS->write(out->getData(), out->pos()); \
37  delete out
38 
39 /* ===================================================================== *
40  SaveFileHeader class
41  * ===================================================================== */
42 
43 // This structure represents the first 128 bytes written to a save game
44 // file. It stores the game ID and the long name of the saved game state.
45 
47  enum {
48  kSaveNameSize = 40,
49  kHeaderSize = 128
50  };
51 
52  ChunkID gameID; // ID of game (FTA2 or DINO)
53  Common::String saveName; // The long name of the saved
54 
55  void read(Common::InSaveFile *in);
56  void write(Common::OutSaveFile *out);
57 };
58 
59 // Load initial game state
60 void initGameState();
61 
62 // Save the current game state
63 void saveGame(Common::OutSaveFile *out, Common::String saveName);
64 
65 // Load a previously saved game state
66 void loadSavedGameState(int16 saveNo);
67 
68 // Perform a cleanup and load process with fade-in
69 void loadGame(int16 saveNo);
70 
71 // Cleanup the game state
72 void cleanupGameState();
73 
74 void checkRestartGame(const char *exeName);
75 void loadRestartGame();
76 
77 } // end of namespace Saga2
78 
79 #endif
Definition: str.h:59
Definition: saveload.h:46
Definition: savefile.h:54
Definition: actor.h:32
Definition: stream.h:745