ScummVM API documentation
blueforce_logic.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 TSAGE_BLUEFORCE_LOGIC_H
23 #define TSAGE_BLUEFORCE_LOGIC_H
24 
25 #include "common/scummsys.h"
26 #include "tsage/events.h"
27 #include "tsage/core.h"
28 #include "tsage/scenes.h"
29 #include "tsage/globals.h"
30 
31 namespace TsAGE {
32 
33 namespace BlueForce {
34 
35 using namespace TsAGE;
36 
37 #define BF_INVENTORY (*((::TsAGE::BlueForce::BlueForceInvObjectList *)g_globals->_inventory))
38 
39 class BlueForceGame: public Game {
40 public:
41  void start() override;
42  Scene *createScene(int sceneNumber) override;
43  void rightClick() override;
44  void processEvent(Event &event) override;
45  bool canSaveGameStateCurrently() override;
46  bool canLoadGameStateCurrently() override;
47  void restart() override;
48 };
49 
50 #define OBJ_ARRAY_SIZE 10
51 class AObjectArray: public EventHandler {
52 public:
53  EventHandler *_objList[OBJ_ARRAY_SIZE];
54  bool _inUse;
55  int getNewIndex();
56 public:
57  AObjectArray();
58  void clear();
59 
60  Common::String getClassName() override { return "AObjectArray"; }
61  void synchronize(Serializer &s) override;
62  void process(Event &event) override;
63  void dispatch() override;
64 
65  void add(EventHandler *obj);
66  void remove(EventHandler *obj);
67  // The following line prevents compiler warnings about hiding the remove()
68  // method from the parent class.
69  void remove() override { EventHandler::remove(); }
70 };
71 
72 class Timer: public EventHandler {
73 public:
74  Action *_tickAction;
75  EventHandler *_endHandler;
76  uint32 _endFrame;
77 public:
78  Timer();
79  void set(uint32 delay, EventHandler *endHandler);
80 
81  Common::String getClassName() override { return "Timer"; }
82  void synchronize(Serializer &s) override;
83  void remove() override;
84  void signal() override;
85  void dispatch() override;
86 };
87 
88 class TimerExt: public Timer {
89 public:
90  Action *_newAction;
91 public:
92  TimerExt();
93  void set(uint32 delay, EventHandler *endHandler, Action *action);
94 
95  Common::String getClassName() override { return "TimerExt"; }
96  void synchronize(Serializer &s) override;
97  void remove() override;
98  void signal() override;
99 };
100 
101 
103 public:
104  int _state;
105 
106  SceneHotspotExt() { _state = 0; }
107  Common::String getClassName() override { return "SceneHotspotExt"; }
108  void synchronize(Serializer &s) override {
109  SceneHotspot::synchronize(s);
110  s.syncAsSint16LE(_state);
111  }
112 };
113 
115 public:
116  virtual void startMove(SceneObject *sceneObj, va_list va);
117 };
118 
119 class NamedObject: public SceneObject {
120 public:
121  Common::String getClassName() override { return "NamedObject"; }
122  void synchronize(Serializer &s) override;
123  void postInit(SceneObjectList *OwnerList = NULL) override;
124  bool startAction(CursorType action, Event &event) override;
125 };
126 
128 public:
129  int _flag;
130 
131  NamedObjectExt() { _flag = 0; }
132  Common::String getClassName() override { return "NamedObjectExt"; }
133  void synchronize(Serializer &s) override {
134  NamedObject::synchronize(s);
135  s.syncAsSint16LE(_flag);
136  }
137 };
138 
139 class NamedObject2: public NamedObject {
140 public:
141  int _talkCount;
142 
143  NamedObject2() { _talkCount = 0; }
144  Common::String getClassName() override { return "NamedObject2"; }
145  void synchronize(Serializer &s) override {
146  NamedObject::synchronize(s);
147  if (s.getVersion() < 12) {
148  int useless = 0;
149  s.syncAsSint16LE(useless);
150  }
151  s.syncAsSint16LE(_talkCount);
152  }
153 };
154 
156 public:
157  int _countDown;
158  CountdownObject();
159  void fixCountdown(int mode, ...);
160 
161  Common::String getClassName() override { return "CountdownObject"; }
162  void synchronize(Serializer &s) override;
163  void dispatch() override;
164 };
165 
167 public:
168  SceneObject *_object;
169  FollowerObject();
170 
171  Common::String getClassName() override { return "FollowerObject"; }
172  void synchronize(Serializer &s) override;
173  void remove() override;
174  void dispatch() override;
175  void reposition() override;
176 
177  void setup(SceneObject *object, int visage, int frameNum, int yDiff);
178 };
179 
180 class FocusObject: public NamedObject {
181 public:
182  GfxSurface _img;
183 
184  FocusObject();
185  void postInit(SceneObjectList *OwnerList = NULL) override;
186  void synchronize(Serializer &s) override;
187  void remove() override;
188  void process(Event &event) override;
189 };
190 
191 enum ExitFrame { EXITFRAME_N = 1, EXITFRAME_NE = 2, EXITFRAME_E = 3, EXITFRAME_SE = 4,
192  EXITFRAME_S = 5, EXITFRAME_SW = 6, EXITFRAME_W = 7, EXITFRAME_NW = 8 };
193 
194 class SceneExt: public Scene {
195 private:
196  static void startStrip();
197  static void endStrip();
198 public:
199  AObjectArray _timerList, _objArray2;
200  bool _savedPlayerEnabled;
201  bool _savedUiEnabled;
202  bool _savedCanWalk;
203 
204  EventHandler *_focusObject;
205  Visage _cursorVisage;
206 public:
207  SceneExt();
208 
209  Common::String getClassName() override { return "SceneExt"; }
210  void postInit(SceneObjectList *OwnerList = NULL) override;
211  void remove() override;
212  void process(Event &event) override;
213  void dispatch() override;
214  void loadScene(int sceneNum) override;
215  virtual void checkGun();
216 
217  void addTimer(EventHandler *timer) { _timerList.add(timer); }
218  void removeTimer(EventHandler *timer) { _timerList.remove(timer); }
219  bool display(CursorType action);
220  void fadeOut();
221  void gunDisplay();
222  void clearScreen();
223 };
224 
225 class PalettedScene: public SceneExt {
226 public:
227  ScenePalette _palette;
228  bool _hasFader;
229 public:
230  PalettedScene();
231 
232  void synchronize(Serializer &s) override;
233  void postInit(SceneObjectList *OwnerList = NULL) override;
234  void remove() override;
235  PaletteFader *addFader(const byte *arrBufferRGB, int step, Action *action);
236  void add2Faders(const byte *arrBufferRGB, int step, int paletteNum, Action *action);
237  void transition(const byte *arrBufferRGB, int arg8, int paletteNum, Action *action, int fromColor1, int fromColor2, int toColor1, int toColor2, bool flag);
238 };
239 
241 public:
242  void postInit(SceneObjectList *OwnerList = NULL) override;
243  void process(Event &event) override;
244 
245  void playerAction(Event &event) override;
246  void processEnd(Event &event) override;
247 };
248 
250 private:
251  static bool SelectItem(int objectNumber);
252 public:
253  InvObject _none;
254  InvObject _colt45;
255  InvObject _ammoClip;
256  InvObject _spareClip;
257  InvObject _handcuffs;
258  InvObject _greensGun;
259  InvObject _ticketBook;
260  InvObject _mirandaCard;
261  InvObject _forestRap;
262  InvObject _greenId;
263  InvObject _baseballCard;
264  InvObject _bookingGreen;
265  InvObject _flare;
266  InvObject _cobbRap;
267  InvObject _bullet22;
268  InvObject _autoRifle;
269  InvObject _wig;
270  InvObject _frankieId;
271  InvObject _tyroneId;
272  InvObject _snub22;
273  InvObject _bug;
274  InvObject _bookingFrankie;
275  InvObject _bookingGang;
276  InvObject _fbiTeletype;
277  InvObject _daNote;
278  InvObject _printOut;
279  InvObject _warehouseKeys;
280  InvObject _centerPunch;
281  InvObject _tranqGun;
282  InvObject _hook;
283  InvObject _rags;
284  InvObject _jar;
285  InvObject _screwdriver;
286  InvObject _dFloppy;
287  InvObject _blankDisk;
288  InvObject _stick;
289  InvObject _crate1;
290  InvObject _crate2;
291  InvObject _shoebox;
292  InvObject _badge;
293  InvObject _bug2;
294  InvObject _rentalCoupon;
295  InvObject _nickel;
296  InvObject _lyleCard;
297  InvObject _carterNote;
298  InvObject _mugshot;
299  InvObject _clipping;
300  InvObject _microfilm;
301  InvObject _waveKeys;
302  InvObject _rentalKeys;
303  InvObject _napkin;
304  InvObject _dmvPrintout;
305  InvObject _fishingNet;
306  InvObject _id;
307  InvObject _bullets9mm;
308  InvObject _schedule;
309  InvObject _grenades;
310  InvObject _yellowCord;
311  InvObject _halfYellowCord;
312  InvObject _blackCord;
313  InvObject _bug3;
314  InvObject _halfBlackCord;
315  InvObject _warrant;
316  InvObject _jacket;
317  InvObject _greensKnife;
318  InvObject _dogWhistle;
319  InvObject _ammoBelt;
320  InvObject _alleyCatKey;
321 
323  void reset();
324  void setObjectScene(int objectNum, int sceneNumber);
325  void alterInventory(int mode);
326 
327  Common::String getClassName() override { return "BlueForceInvObjectList"; }
328 };
329 
330 class NamedHotspot : public SceneHotspot {
331 public:
332  NamedHotspot();
333 
334  bool startAction(CursorType action, Event &event) override;
335  Common::String getClassName() override { return "NamedHotspot"; }
336  void synchronize(Serializer &s) override;
337 };
338 
340 public:
341  int _flag;
342  NamedHotspotExt() { _flag = 0; }
343 
344  Common::String getClassName() override { return "NamedHotspot"; }
345  void synchronize(Serializer &s) override {
346  NamedHotspot::synchronize(s);
347  s.syncAsSint16LE(_flag);
348  }
349 };
350 
351 class SceneMessage: public Action {
352 private:
353  Common::String _message;
354 
355  void draw();
356  void clear();
357 public:
358  void setup(const Common::String &msg) { _message = msg; }
359 
360  Common::String getClassName() override { return "SceneMessage"; }
361  void remove() override;
362  void signal() override;
363  void process(Event &event) override;
364 };
365 
366 class IntroSceneText: public SceneText {
367 public:
368  Action *_action;
369  uint32 _frameNumber;
370  int _diff;
371 public:
372  IntroSceneText();
373  void setup(const Common::String &msg, Action *action);
374 
375  Common::String getClassName() override { return "BFIntroText"; }
376  void synchronize(Serializer &s) override;
377  void dispatch() override;
378 };
379 
380 } // End of namespace BlueForce
381 
382 } // End of namespace TsAGE
383 
384 #endif
Definition: blueforce_logic.h:339
Definition: core.h:75
Definition: core.h:443
Definition: str.h:59
Definition: blueforce_logic.h:127
Definition: core.h:115
Definition: core.h:736
Definition: blueforce_logic.h:88
Definition: core.h:355
Definition: blueforce_logic.h:225
Definition: blueforce_logic.h:166
Definition: blueforce_logic.h:249
Definition: core.h:134
Definition: blueforce_logic.h:330
Definition: blueforce_logic.h:51
Definition: blueforce_logic.h:180
Definition: blueforce_logic.h:155
Definition: blueforce_logic.h:240
Definition: blueforce_logic.h:102
Definition: core.h:472
Definition: blueforce_logic.h:351
Definition: graphics.h:79
Definition: blueforce_logic.h:39
Definition: core.h:47
Definition: events.h:47
Definition: blueforce_logic.h:72
Definition: blueforce_logic.h:366
Definition: blueforce_dialogs.h:30
Definition: blueforce_logic.h:194
Version getVersion() const
Definition: serializer.h:172
Definition: blueforce_logic.h:139
Definition: saveload.h:63
Definition: core.h:895
Definition: scenes.h:33
Definition: core.h:519
Definition: blueforce_logic.h:114
Definition: core.h:625
Definition: core.h:340
Definition: blueforce_logic.h:119
Definition: scenes.h:109