ScummVM API documentation
save_game_file.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  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef BAGEL_BAGLIB_SAVE_GAME_FILE_H
23 #define BAGEL_BAGLIB_SAVE_GAME_FILE_H
24 
25 #include "common/serializer.h"
26 #include "bagel/spacebar/boflib/dat_file.h"
27 
28 namespace Bagel {
29 namespace SpaceBar {
30 
31 #define MAX_SAVED_GAMES 40
32 #define MAX_SAVE_TITLE 128
33 #define MAX_USER_NAME 64
34 
36  char _szTitle[MAX_SAVE_TITLE] = { '\0' };
37  char _szUserName[MAX_USER_NAME] = { '\0' };
38  uint32 _bUsed = 0;
39 
40  void synchronize(Common::Serializer &s);
41  static int size() {
42  return MAX_SAVE_TITLE + MAX_USER_NAME + 4;
43  }
44 };
45 
46 #define MAX_SDEV_NAME 40
47 #define MAX_CLOSEUP_DEPTH 4
48 
49 #define MAX_VARS 1000
50 #define MAX_VAR_NAME 40
51 #define MAX_VAR_VALUE 60
52 
53 struct StVar {
54  char _szName[MAX_VAR_NAME];
55  char _szValue[MAX_VAR_VALUE];
56  uint16 _nType;
57 
58  byte _bGlobal;
59  byte _bConstant;
60  byte _bReference;
61  byte _bTimer;
62 
63  byte _bRandom;
64  byte _bNumeric;
65  byte _bAttached;
66 
67  byte _bUsed; // If this entry is used or not
68 
69  void synchronize(Common::Serializer &s);
70  void clear();
71 };
72 
73 #define MAX_OBJ_NAME 40
74 #define MAX_SDEV_NAME 40
75 #define MAX_OBJS 1000
76 
77 struct StObj {
78  char _szName[MAX_OBJ_NAME];
79  char _szSDev[MAX_SDEV_NAME];
80  uint32 _lState;
81 
82  uint32 _lProperties;
83  uint32 _lType;
84 
85  uint32 _lLoop;
86  uint32 _lSpeed;
87 
88  byte _bAttached;
89  byte _bUsed;
90 
91  uint16 _nFlags; // Flags for kicks...
92 
93  void synchronize(Common::Serializer &s);
94  void clear();
95 };
96 
97 // Flags for the st_obj structure
98 
99 #define mIsMsgWaiting 0x0001
100 
104 struct StBagelSave {
105  StVar _stVarList[MAX_VARS];
106  StObj _stObjList[MAX_OBJS];
107  StObj _stObjListEx[MAX_OBJS];
108  char _szScript[MAX_FNAME]; // Name of current world file (no path)
109  uint32 _nLocType; // TYPE_PAN, TYPE_CLOSEUP, etc...
110  char _szLocStack[MAX_CLOSEUP_DEPTH][MAX_SDEV_NAME]; // Your storage device stack
111  uint16 _nLocX; // X Location in PAN
112  uint16 _nLocY; // Y Location in PAN
113  uint16 _bUseEx;
114  uint16 _nFiller; // Make structs align
115 
116  void synchronize(Common::Serializer &s);
117  void clear();
118 
119  static int size() {
120  return 318432;
121  }
122 };
123 
129 public:
130  CBagSaveGameFile(bool isSaving);
131 
132  int32 getNumSavedGames() const {
133  return getNumberOfRecs();
134  }
135  int32 getActualNumSaves();
136  bool anySavedGames();
137 
141  ErrorCode writeSavedGame();
142 
146  ErrorCode readSavedGame(int32 slotNum);
147 
151  ErrorCode readTitle(int32 lSlot, StSavegameHeader *pSavedGame);
152 
153  ErrorCode readTitleOnly(int32 lSlot, char *pGameTitle);
154 };
155 
156 } // namespace SpaceBar
157 } // namespace Bagel
158 
159 #endif
Definition: save_game_file.h:128
Definition: dat_file.h:74
Definition: save_game_file.h:53
Definition: serializer.h:79
Definition: save_game_file.h:77
Definition: afxwin.h:27
Definition: save_game_file.h:104
Definition: save_game_file.h:35