ScummVM API documentation
gameloader.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 NGI_GAMELOADER_H
23#define NGI_GAMELOADER_H
24
25#include "common/ptr.h"
26#include "engines/savestate.h"
27
28#include "ngi/objects.h"
29#include "ngi/inventory.h"
30#include "ngi/messages.h"
31
32namespace NGI {
33
34#define NGI_SAVEGAME_VERSION 2
35
36class SceneTag;
37class MctlCompound;
38class InputController;
39class InteractionController;
40class MotionController;
41class MovGraph;
42
43class Sc2 : public CObject {
44 public:
45 int16 _sceneId;
46 int16 _field_2;
47 Scene *_scene;
50 Common::Array<int32> _data1; // FIXME, could be a struct
51 PicAniInfoList _defPicAniInfos;
52 PicAniInfoList _picAniInfos;
53 bool _isLoaded;
54 Common::Array<EntranceInfo> _entranceData;
55
56 public:
57 Sc2();
58 ~Sc2() override;
59 bool load(MfcArchive &file) override;
60};
61
63
65 int preloadId1;
66 int preloadId2;
67 int sceneId;
68 int param;
69};
70
71bool preloadCallback(PreloadItem &pre, int flag);
72
73class PreloadItems : public Common::Array<PreloadItem>, public CObject {
74 public:
75 bool load(MfcArchive &file) override;
76};
77
78
79struct SaveHeader {
80 int32 version;
81 char magic[32];
82 int32 updateCounter;
83 int32 unkField;
84 int32 encSize;
85};
86
87class GameLoader : public CObject {
88 public:
89 GameLoader();
90 ~GameLoader() override;
91
92 bool load(MfcArchive &file) override;
93 bool loadScene(int sceneId);
94 bool gotoScene(int sceneId, int entranceId);
95 bool preloadScene(int sceneId, int entranceId);
96 bool unloadScene(int sceneId);
97
98 void addPreloadItem(const PreloadItem &item);
99
100 void updateSystems(int counterdiff);
101
102 int getSceneTagBySceneId(int sceneId, SceneTag **st);
103 void applyPicAniInfos(Scene *sc, const PicAniInfoList &picAniInfo);
104 void saveScenePicAniInfos(int sceneId);
105 PicAniInfoList savePicAniInfos(Scene *sc, int flag1, int flag2);
106
107 bool readSavegame(const char *fname);
108 bool writeSavegame(Scene *sc, const char *fname, const Common::String &description);
109
110 void addVar(GameVar *var, GameVar *subvar);
111
112 void restoreDefPicAniInfos();
113
115 InteractionController *_interactionController;
116 InputController *_inputController;
117 Inventory2 _inventory;
118 Sc2Array _sc2array;
119 void *_sceneSwitcher;
120 bool (*_preloadCallback)(PreloadItem &pre, int flag);
121 void (*_savegameCallback)(MfcArchive *archive, bool mode);
122 int16 _field_F8;
123 int16 _field_FA;
124 PreloadItems _preloadItems;
125 GameVar *_gameVar;
126 Common::String _gameName;
127 ExCommand _exCommand;
128 int _updateCounter;
129 int _preloadSceneId;
130 int _preloadEntranceId;
131};
132
133
134Inventory2 *getGameLoaderInventory();
135InteractionController *getGameLoaderInteractionController();
136MctlCompound *getSc2MctlCompoundBySceneId(int16 sceneId);
137MovGraph *getSc2MovGraphBySceneId(int16 sceneId);
138MctlCompound *getCurrSceneSc2MotionController();
139
140} // End of namespace NGI
141
142#endif /* NGI_GAMELOADER_H */
Definition: ptr.h:572
Definition: str.h:59
Definition: utils.h:106
Definition: messages.h:59
Definition: gameloader.h:87
Definition: objects.h:76
Definition: input.h:46
Definition: interaction.h:63
Definition: inventory.h:82
Definition: motion.h:94
Definition: utils.h:39
Definition: motion.h:39
Definition: motion.h:270
Definition: gameloader.h:73
Definition: gameloader.h:43
MotionController * _motionController
Definition: gameloader.h:49
Definition: scene.h:32
Definition: scene.h:97
Definition: gameloader.h:64
Definition: gameloader.h:79