ScummVM API documentation
globals.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_GLOBALS_H
23 #define TSAGE_GLOBALS_H
24 
25 #include "common/random.h"
26 #include "tsage/core.h"
27 #include "tsage/scenes.h"
28 #include "tsage/events.h"
29 #include "tsage/sound.h"
30 #include "tsage/saveload.h"
31 #include "tsage/screen.h"
32 #include "tsage/user_interface.h"
33 
34 namespace TsAGE {
35 
36 class Globals : public SavedObject {
37 private:
38  static void dispatchSound(ASound *obj);
39 public:
40  Screen _screen;
41  GfxManager _gfxManagerInstance;
42  Common::List<GfxManager *> _gfxManagers;
43  SceneHandler *_sceneHandler;
44  Game *_game;
45  EventsClass _events;
46  SceneManager _sceneManager;
47  ScenePalette _scenePalette;
48  SceneRegions _sceneRegions;
49  SceneItemList _sceneItems;
50  SceneObjectList _sceneObjectsInstance;
51  SceneObjectList *_sceneObjects;
52  SynchronizedList<SceneObjectList *> _sceneObjects_queue;
53  SceneText _sceneText;
54  int _gfxFontNumber;
55  GfxColors _gfxColors;
56  GfxColors _fontColors;
57  byte _color1, _color2, _color3;
58  SoundManager _soundManager;
59  Common::Point _dialogCenter;
60  WalkRegions _walkRegions;
62  bool _flags[256];
63  Player _player;
64  ASound _soundHandler;
65  InvObjectList *_inventory;
66  Region _paneRegions[2];
67  int _paneRefreshFlag[2];
68  Common::Point _sceneOffset;
69  Common::Point _prevSceneOffset;
70  SceneObject *_scrollFollower;
71  SequenceManager _sequenceManager;
72  Common::RandomSource _randomSource;
73  int _stripNum;
74  int _gfxEdgeAdjust;
75 public:
76  Globals();
77  ~Globals() override;
78 
79  void setFlag(int flagNum) {
80  assert((flagNum >= 0) && (flagNum < MAX_FLAGS));
81  _flags[flagNum] = true;
82  }
83  void clearFlag(int flagNum) {
84  assert((flagNum >= 0) && (flagNum < MAX_FLAGS));
85  _flags[flagNum] = false;
86  }
87  bool getFlag(int flagNum) const {
88  assert((flagNum >= 0) && (flagNum < MAX_FLAGS));
89  return _flags[flagNum];
90  }
91 
92  GfxManager &gfxManager() { return **_gfxManagers.begin(); }
93  Common::String getClassName() override { return "Globals"; }
94  void synchronize(Serializer &s) override;
95  virtual void reset();
96 
97  void dispatchSounds();
98 };
99 
100 typedef bool (*SelectItemProc)(int objectNumber);
101 
105 class TsAGE2Globals: public Globals {
106 public:
107  UIElements _uiElements;
108  SelectItemProc _onSelectItem;
109  int _interfaceY;
110  ASoundExt _inventorySound;
111 
112  TsAGE2Globals();
113  void reset() override;
114  void synchronize(Serializer &s) override;
115 };
116 
117 extern Globals *g_globals;
118 
119 #define GLOBALS (*::TsAGE::g_globals)
120 #define T2_GLOBALS (*((::TsAGE::TsAGE2Globals *)g_globals))
121 #define BF_GLOBALS (*((::TsAGE::BlueForce::BlueForceGlobals *)g_globals))
122 #define R2_GLOBALS (*((::TsAGE::Ringworld2::Ringworld2Globals *)g_globals))
123 
124 // Note: Currently this can't be part of the g_globals structure, since it needs to be constructed
125 // prior to many of the fields in Globals execute their constructors
126 extern ResourceManager *g_resourceManager;
127 
128 
129 namespace BlueForce {
130 
131 using namespace TsAGE;
132 
133 enum Bookmark {
134  bNone,
135  bStartOfGame, bCalledToDomesticViolence, bArrestedGreen, bLauraToParamedics,
136  bBookedGreen, bStoppedFrankie, bBookedFrankie, bBookedFrankieEvidence,
137  bEndOfWorkDayOne, bTalkedToGrannyAboutSkipsCard, bLyleStoppedBy, bEndDayOne,
138  bInspectionDone, bCalledToDrunkStop, bArrestedDrunk, bEndDayTwo,
139  bFlashBackOne, bFlashBackTwo, bFlashBackThree, bDroppedOffLyle, bEndDayThree,
140  bDoneWithIsland, bDoneAtLyles, bEndDayFour, bInvestigateBoat, bFinishedWGreen,
141  bAmbushed, bAmbushOver, bEndOfGame
142 };
143 
144 enum Flag {
145  JAKE_FILE_COPIED, gunClean, onBike, onDuty, fShowedIdToKate, fLateToMarina,
146  fCalledBackup, fWithLyle, gunDrawn, fBackupArrived340, fBriefedBackup,
147  fGotAllSkip340, fToldToLeave340, fBackupIn350, fNetInBoat, fForbesWaiting,
148  fWithCarter, fTalkedToTony, fMugOnKate, takenWeasel, gotTrailer450,
149  showEugeneNapkin, showRapEugene, fMgrCallsWeasel, fCarterMetLyle,
150  fGunLoaded, fLoadedSpare, showEugeneID, fRandomShot350, examinedFile810,
151  shownLyleCrate1, shownLyleRapsheet, shownLyleDisk, shownLylePO,
152  fCanDrawGun, fGotAutoWeapon, fGotBulletsFromDash, fShotSuttersDesk,
153  greenTaken, fLateToDrunkStop, didDrunk, fSearchedTruck, seenFolder,
154  showMugAround, frankInJail, fTalkedCarterDay3, fDecryptedBluePrints,
155  fTalkedToDrunkInCar, fToldLyleOfSchedule, fTalkedShooterNoBkup,
156  fTalkedDriverNoBkup, fDriverOutOfTruck, readGreenRights, readFrankRights,
157  talkedToHarrisAboutDrunk, unlockBoat, fShootGoon, fBlowUpGoon,
158  fTalkedToBarry, fTalkedToLarry, fLeftTraceIn920, fLeftTraceIn900,
159  fBackupAt340, fShotNicoIn910, fGotPointsForTktBook, fGotPointsForMCard,
160  fShowedBluePrint, fGotPointsForPunch, fGotPointsForBox, fGotPointsForBank,
161  fGotPointsForCombo, fGotPointsForCoin, fGotPointsForCPU, fGotPointsForBoots,
162  fGotPointsForCrate, fGotPointsForBlackCord, fGotPointsForGeneratorPlug,
163  fGotPointsForFuseBoxPlug, fGotPointsForStartGenerator, fGotPointsForLightsOn,
164  fGotPointsForOpeningDoor, fGotPointsForClosingDoor, fGotPointsForLightsOff,
165  fGotPointsForGeneratorOff, fGotPointsForCordOnForklift, fGotPointsForCuffingNico,
166  fGotPointsForCuffingDA, fGotPointsForSearchingNico, fGotPointsForSearchingDA,
167  fLeftTraceIn910, fBookedGreenEvidence, fGotPointsForCleaningGun,
168  fGotPointsForMemo, fGotPointsForFBI, fTookTrailerAmmo, fAlertedGreen355,
169  fGotGreen355fTalkedToGrannyDay3, shownFax, beenToJRDay2, shownLyleCrate1Day1,
170  fLyleOnIsland, iWasAmbushed, fGangInCar, fArrivedAtGangStop, ticketVW,
171  f1015Marina, fCan1015Marina, f1015Frankie, fCan1015Frankie, f1015Drunk,
172  fCan1015Drunk, f1027Marina, fCan1027Marina, f1027Frankie, fCan1027Frankie,
173  f1027Drunk, fCan1027Drunk, f1035Marina, fCan1035Marina, f1035Frankie,
174  fCan1035Frankie, f1035Drunk, fCan1035Drunk, f1097Marina, fCan1097Marina,
175  f1097Frankie, fCan1097Frankie, f1097Drunk, fCan1097Drunk, f1098Marina,
176  fCan1098Marina, f1098Frankie, fCan1098Frankie, f1098Drunk, fCan1098Drunk,
177  fCuffedFrankie, fGotPointsForTrapDog, fGotPointsForUnlockGate,
178  fGotPointsForUnlockWarehouse, fGotPointsForLockWarehouse, fGotPointsForLockGate,
179  fGotPointsForFreeDog, fGotPointsForWhistleDog, fGivenNapkin, fCan1004Marina,
180  fCan1004Drunk, fHasLeftDrunk, fHasDrivenFromDrunk, fCrateOpen, fSawGuns,
181  hookPoints
182 };
183 
185 public:
186  ASoundExt _sound1, _sound3;
187  StripProxy _stripProxy;
188  int _dayNumber;
189  int _tonyDialogCtr;
190  int _marinaWomanCtr;
191  int _kateDialogCtr;
192  int _v4CEB6;
193  int _safeCombination;
194  int _gateStatus;
195  int _greenDay5TalkCtr;
196  int _v4CEC8;
197  int _v4CECA;
198  int _v4CECC;
199  int8 _breakerBoxStatusArr[18];
200  int _hiddenDoorStatus;
201  int _nico910State;
202  int _stuart910State;
203  int _nico910Talk;
204  int _stuart910Talk;
205  int _deziTopic;
206  int _deathReason;
207  int _driveFromScene;
208  int _driveToScene;
209  uint8 _subFlagBitArr1;
210  uint8 _subFlagBitArr2;
211  bool _scene410HarrisonTalkFl;
212  int _scene410Action1Count;
213  int _scene410TalkCount;
214  bool _scene410HarrisonMovedFl;
215  Bookmark _bookmark;
216  int _mapLocationId;
217  int _clip1Bullets, _clip2Bullets;
218 
220  bool getHasBullets();
221 
222  Common::String getClassName() override { return "BFGlobals"; }
223  void reset() override;
224  void synchronize(Serializer &s) override;
225  void set2Flags(int flagNum);
226  bool removeFlag(int flagNum);
227 };
228 
229 } // End of namespace BlueForce
230 
231 namespace Ringworld2 {
232 
233 #define SPEECH_TEXT 1
234 #define SPEECH_VOICE 2
235 
236 class ScannerDialog;
237 
238 struct VampireData {
239  bool _isAlive;
240  int _shotsRequired;
241  Common::Point _position;
242 };
243 
245 public:
246  ASoundExt _sound1, _sound2, _sound3, _sound4;
247  PlayStream _playStream;
248  StripProxy _stripProxy;
249  bool _fadePaletteFlag;
250  byte _fadePaletteMap[10][256];
251  byte _paletteMap[4096];
252  int _insetUp;
253  int _frameEdgeColor;
254  int _animationCtr;
255  int _electromagnetChangeAmount;
256  int _electromagnetZoom;
257  bool _tractorField;
258  bool _cableAttached;
259  int _foodCount;
260  int _rimLocation;
261  int _rimTransportLocation;
262  byte _stripModifier;
263  byte _spillLocation[14];
264  VampireData _vampireData[18];
265  byte _flubMazeArea;
266  byte _flubMazeEntryDirection;
267  int _maze3800SceneNumb;
268  byte _landerSuitNumber;
269  byte _desertStepsRemaining;
270  byte _desertCorrectDirection;
271  byte _desertPreviousDirection;
272  byte _desertMovements[1000];
273  int _desertWrongDirCtr;
274  byte _balloonAltitude;
275  int _scene1925CurrLevel; //_v56A9C
276  int _walkwaySceneNumber;
277  byte _mirandaJailState;
278  byte _scientistConvIndex;
279  Common::Point _ventCellPos;
280  byte _ductMazePanel1State;
281  byte _ductMazePanel2State;
282  byte _ductMazePanel3State;
283  int _scene180Mode; // _v575f7
284  int _v57709;
285  int _v5780C;
286  int _mouseCursorId;
287  int _v57810;
288  int _speechSubtitles;
289  Common::Point _s1550PlayerArea[3]; // only used for Quinn and Seeker
290  byte _scannerFrequencies[4];
291  byte _stripManager_lookupList[12];
292  byte _scene1550JunkLocations[508];
293  Common::Point _balloonPosition;
294  bool _debugCardGame; // moved from scene 1337 so it can be easily set in the debugger
295 
296  ScannerDialog *_scannerDialog;
297 
299  ~Ringworld2Globals() override;
300  void reset() override;
301  void synchronize(Serializer &s) override;
302 };
303 
304 } // End of namespace Ringworld2
305 
306 } // End of namespace TsAGE
307 
308 #endif
Definition: core.h:75
Definition: scenes.h:69
Definition: graphics.h:57
Definition: globals.h:238
Definition: str.h:59
Definition: saveload.h:98
Definition: core.h:703
Definition: screen.h:38
Definition: core.h:736
Definition: ringworld2_logic.h:467
Definition: sound.h:170
Definition: core.h:355
Definition: random.h:44
Definition: graphics.h:257
Definition: user_interface.h:32
Definition: list.h:44
Definition: sound.h:366
Definition: sound.h:405
Definition: globals.h:36
Definition: resources.h:167
Definition: globals.h:184
iterator begin()
Definition: list.h:227
Definition: user_interface.h:116
Definition: rect.h:45
Definition: saveload.h:115
Definition: blueforce_dialogs.h:30
Definition: saveload.h:63
Definition: core.h:895
Definition: core.h:729
Definition: globals.h:105
Definition: core.h:519
Definition: events.h:121
Definition: core.h:788
Definition: globals.h:244
Definition: sound.h:418
Definition: core.h:625
Definition: core.h:649
Definition: converse.h:38
Definition: core.h:837
Definition: scenes.h:109