ScummVM API documentation
project_item.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 TITANIC_PROJECT_ITEM_H
23#define TITANIC_PROJECT_ITEM_H
24
25#include "common/scummsys.h"
26#include "common/str.h"
27#include "engines/savestate.h"
28#include "graphics/surface.h"
29#include "titanic/support/simple_file.h"
30#include "titanic/core/dont_save_file_item.h"
31#include "titanic/core/file_item.h"
32#include "titanic/core/list.h"
33#include "titanic/core/room_item.h"
34
35namespace Titanic {
36
38 uint8 _version;
39 CString _saveName;
40 Graphics::Surface *_thumbnail;
41 int _year, _month, _day;
42 int _hour, _minute;
43 int _totalFrames;
44
46
50 void clear();
51};
52
53
54class CGameManager;
55class CPetControl;
56class CViewItem;
57
61class CFileListItem : public ListItem {
62public:
63 CString _name;
64public:
65 CLASSDEF;
66
70 void save(SimpleFile *file, int indent) override;
71
75 void load(SimpleFile *file) override;
76};
77
81class CFileList: public List<CFileListItem> {
82};
83
84class CProjectItem : public CFileItem {
85 DECLARE_MESSAGE_MAP;
86private:
87 CString _filename;
88 CFileList _files;
89 int _nextRoomNumber;
90 int _nextMessageNumber;
91 int _nextObjectNumber;
92 CGameManager *_gameManager;
93
97 void buildFilesList();
98
102 void preLoad();
103
107 void postLoad();
108
112 void preSave();
113
117 void postSave();
118
122 CTreeItem *findChildInstance(ClassDef *classDef) const;
123
127 CTreeItem *findSiblingChildInstanceOf(ClassDef *classDef, CTreeItem *startItem) const;
128private:
132 CProjectItem *loadData(SimpleFile *file);
133
137 void saveData(SimpleFile *file, CTreeItem *item) const;
138
142 static Graphics::Surface *createThumbnail();
143public:
147 static SaveStateList getSavegameList(const MetaEngine *metaEngine, const Common::String &target);
148
153
157 WARN_UNUSED_RESULT static bool readSavegameHeader(SimpleFile *file, TitanicSavegameHeader &header, bool skipThumbnail = true);
158public:
159 CLASSDEF;
160 CProjectItem();
161 ~CProjectItem() override { destroyChildren(); }
162
166 void save(SimpleFile *file, int indent) override;
167
171 void load(SimpleFile *file) override;
172
176 CGameManager *getGameManager() const override;
177
181 void setGameManager(CGameManager *gameManager);
182
187
192
196 void loadGame(int slotId);
197
201 void saveGame(int slotId, const CString &desc);
202
206 void clear();
207
211 void setFilename(const CString &name) { _filename = name; }
212
217
221 CRoomItem *findNextRoom(CRoomItem *priorRoom) const;
222
227
232
236 CViewItem *findView(int roomNumber, int nodeNumber, int viewNumber);
237
242 CViewItem *parseView(const CString &viewString);
243
247 bool changeView(const CString &viewName, const CString &clipName);
248
252 bool changeView(const CString &viewName);
253};
254
255} // End of namespace Titanic
256
257#endif /* TITANIC_PROJECT_ITEM_H */
Definition: str.h:59
Definition: metaengine.h:202
Definition: dont_save_file_item.h:29
Definition: file_item.h:31
Definition: project_item.h:81
Definition: project_item.h:61
void save(SimpleFile *file, int indent) override
void load(SimpleFile *file) override
Definition: game_manager.h:48
Definition: pet_control.h:45
Definition: project_item.h:84
CViewItem * findView(int roomNumber, int nodeNumber, int viewNumber)
void save(SimpleFile *file, int indent) override
static void writeSavegameHeader(SimpleFile *file, TitanicSavegameHeader &header)
CRoomItem * findNextRoom(CRoomItem *priorRoom) const
CDontSaveFileItem * getDontSaveFileItem() const
bool changeView(const CString &viewName, const CString &clipName)
CRoomItem * findHiddenRoom()
void setGameManager(CGameManager *gameManager)
CGameManager * getGameManager() const override
static SaveStateList getSavegameList(const MetaEngine *metaEngine, const Common::String &target)
void setFilename(const CString &name)
Definition: project_item.h:211
void loadGame(int slotId)
void load(SimpleFile *file) override
bool changeView(const CString &viewName)
void saveGame(int slotId, const CString &desc)
CViewItem * parseView(const CString &viewString)
static WARN_UNUSED_RESULT bool readSavegameHeader(SimpleFile *file, TitanicSavegameHeader &header, bool skipThumbnail=true)
CRoomItem * findFirstRoom() const
CPetControl * getPetControl() const
Definition: room_item.h:33
Definition: string.h:40
Definition: tree_item.h:37
Definition: view_item.h:32
Definition: saveable_object.h:35
Definition: list.h:71
Definition: list.h:35
Definition: simple_file.h:49
bool skipThumbnail(Common::SeekableReadStream &in)
Definition: surface.h:67
Definition: project_item.h:37