ScummVM API documentation
saga2.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 SAGA2_H
23 #define SAGA2_H
24 
25 #include "common/debug.h"
26 #include "common/random.h"
27 #include "common/serializer.h"
28 #include "common/system.h"
29 
30 #include "engines/advancedDetector.h"
31 #include "engines/engine.h"
32 
33 #include "saga2/gfx.h"
34 #include "saga2/idtypes.h"
35 #include "saga2/weapons.h"
36 #include "saga2/vdraw.h"
37 
38 namespace Video {
39 class SmackerDecoder;
40 }
41 
42 namespace Common {
43 class MemoryWriteStreamDynamic;
44 }
45 
46 namespace Saga2 {
47 
48 class ContainerManager;
49 class Console;
50 class Timer;
51 class TimerList;
52 class BandList;
53 class ActorAppearance;
54 class PathRequest;
55 class MotionTask;
56 class MotionTaskList;
57 class CMassWeightIndicator;
58 class GrabInfo;
59 class CImageCache;
60 class SensorList;
61 class Sensor;
62 class EffectDisplayPrototypeList;
63 class SpellDisplayPrototypeList;
64 class DisplayNodeList;
65 class SpellDisplayList;
66 class gMousePointer;
67 class ActiveRegion;
68 class gToolBase;
69 class Properties;
70 class PlayerActor;
71 class ProtoObj;
72 class ActorProto;
73 class HandleArray;
74 class TileActivityTaskList;
75 class TaskStackList;
76 class TaskList;
77 class Deejay;
78 class frameSmoother;
79 class frameCounter;
80 class CMapFeature;
81 class AudioInterface;
82 class PaletteManager;
83 class ActorManager;
84 class CalendarTime;
85 class TileModeManager;
86 struct SAGA2GameDescription;
87 
88 enum {
89  kDebugResources = 1 << 0,
90  kDebugActors = 1 << 1,
91  kDebugScripts = 1 << 2,
92  kDebugEventLoop = 1 << 3,
93  kDebugInit = 1 << 4,
94  kDebugTiles = 1 << 5,
95  kDebugPalettes = 1 << 6,
96  kDebugLoading = 1 << 7,
97  kDebugTimers = 1 << 8,
98  kDebugPath = 1 << 9,
99  kDebugTasks = 1 << 10,
100  kDebugSound = 1 << 11,
101  kDebugSaveload = 1 << 12,
102  kDebugSensors = 1 << 13
103 };
104 
105 #define TICKSPERSECOND (728L/10L)
106 
107 class Saga2Engine : public Engine {
108 public:
109  Saga2Engine(OSystem *syst, const SAGA2GameDescription *desc);
110  ~Saga2Engine();
111 
112  Common::Error run() override;
113  bool hasFeature(EngineFeature f) const override;
114  const ADGameFileDescription *getFilesDescriptions() const;
115  int getGameId() const;
116  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override { return true; }
117  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override { return true; }
118  Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
119  Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
120  Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave) override;
121  Common::Error loadGameState(int slot) override;
122  void syncSoundSettings() override;
123 
124  Common::String getSavegameFile(int num);
125 
126  void syncGameStream(Common::Serializer &s);
127 
128  void loadExeResources();
129  void freeExeResources();
130 
131  void startVideo(const char *fileName, int x, int y);
132  bool checkVideo();
133  void endVideo();
134  void abortVideo();
135 
136  void readConfig();
137  void saveConfig();
138 
139 public:
140  // We need random numbers
141  Common::RandomSource *_rnd;
142  Console *_console;
143  Renderer *_renderer;
144  AudioInterface *_audio;
145  PaletteManager *_pal;
146  ActorManager *_act;
147  CalendarTime *_calendar;
148  TileModeManager *_tmm;
149  ContainerManager *_cnm;
150 
151  WeaponStuff _weaponRack[kMaxWeapons];
152  weaponID _loadedWeapons;
153  Common::Array<char *> _nameList;
154  Common::Array<PlayerActor *> _playerList;
155  Common::Array<ProtoObj *> _objectProtos;
156  Common::Array<ActorProto *> _actorProtos;
157  Common::Array<CMapFeature *> _mapFeatures;
158  Common::List<TimerList *> _timerLists;
159  Common::List<Timer *> _timers;
160  Common::List<ActorAppearance *> _appearanceLRU;
161  Common::List<PathRequest *> _pathQueue;
162  Common::List<SensorList *> _sensorListList;
163  Common::List<Sensor *> _sensorList;
165  Common::List<int> _platformLRU;
166  BandList *_bandList;
167  MotionTaskList *_mTaskList;
168  CImageCache *_imageCache;
169  GrabInfo *_mouseInfo;
170  EffectDisplayPrototypeList *_edpList;
171  SpellDisplayPrototypeList *_sdpList;
172  DisplayNodeList *_mainDisplayList;
173  SpellDisplayList *_activeSpells;
174  gMousePointer *_pointer;
175  ActiveRegion *_activeRegionList;
176  gToolBase *_toolBase;
177  Properties *_properties;
178  HandleArray *_tileImageBanks;
179  TileActivityTaskList *_aTaskList;
180  TaskStackList *_stackList;
181  TaskList *_taskList;
182  Deejay *_grandMasterFTA;
183  frameSmoother *_frate;
184  frameCounter *_lrate;
185 
186  gDisplayPort _mainPort;
187  gPort _backPort;
188  gPixelMap _tileDrawMap;
189 
190  bool _gameRunning;
191  bool _autoAggression;
192  bool _autoWeapon;
193  bool _showNight;
194  bool _speechText;
195  bool _speechVoice;
196 
197  bool _teleportOnClick;
198  bool _teleportOnMap;
199  bool _showPosition;
200  bool _showStats;
201  bool _showStatusMsg;
202 
203  bool _indivControlsFlag;
204  bool _userControlsSetup;
205  int _fadeDepth;
206  int _currentMapNum;
207 
208 
209 private:
210  const SAGA2GameDescription *_gameDescription;
211  Video::SmackerDecoder *_smkDecoder;
212  int _videoX, _videoY;
213 };
214 
215 extern Saga2Engine *g_vm;
216 
217 } // End of namespace Saga2
218 
219 #endif
Definition: motion.h:536
Definition: gamerate.h:84
Definition: str.h:59
EngineFeature
Definition: engine.h:253
Definition: console.h:33
Definition: gamerate.h:35
Definition: gpointer.h:33
Definition: stream.h:77
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: saga2.h:116
Definition: error.h:84
Definition: tilemode.h:58
Definition: random.h:44
Definition: actor.h:32
Definition: gdraw.h:56
Definition: gdraw.h:178
Definition: vdraw.h:33
Definition: imagcach.h:61
Definition: list.h:44
Definition: calendar.h:35
Definition: stream.h:745
Definition: smk_decoder.h:76
Definition: serializer.h:79
Definition: spelshow.h:333
Definition: saga2.h:107
Definition: detection.h:42
Definition: tile.h:606
Definition: spelshow.h:183
Definition: panel.h:467
Definition: ustr.h:57
Definition: property.h:403
Definition: algorithm.h:29
Definition: actor.h:1129
Definition: vpal.h:60
Definition: audio.h:50
Definition: gfx.h:35
Definition: band.h:63
Definition: weapons.h:83
Definition: objects.h:857
Definition: system.h:161
Definition: avi_frames.h:36
Definition: contain.h:471
Definition: beegee.h:58
Definition: spelshow.h:272
Definition: oncall.h:31
Definition: grabinfo.h:35
Definition: paletteman.h:47
Definition: engine.h:144
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: saga2.h:117
Definition: dispnode.h:86
Definition: advancedDetector.h:78