ScummVM API documentation
hypno.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 HYPNO_H
23 #define HYPNO_H
24 
25 #include "common/array.h"
26 #include "common/compression/installshieldv3_archive.h"
27 #include "common/random.h"
28 #include "common/serializer.h"
29 #include "common/str-array.h"
30 #include "common/stream.h"
31 #include "engines/engine.h"
32 #include "graphics/font.h"
33 #include "graphics/fontman.h"
34 #include "graphics/surface.h"
35 #include "video/subtitles.h"
36 
37 #include "hypno/grammar.h"
38 #include "hypno/libfile.h"
39 
40 namespace Audio {
41 class SeekableAudioStream;
42 }
43 
44 namespace Image {
45 class ImageDecoder;
46 }
47 
48 struct ADGameDescription;
49 
50 namespace Hypno {
51 
52 // debug channels
53 enum {
54  kHypnoDebugMedia = 1,
55  kHypnoDebugParser,
56  kHypnoDebugArcade,
57  kHypnoDebugScene,
58 };
59 
60 // Player positions
61 
62 enum PlayerPosition {
63  kPlayerTop = 'T',
64  kPlayerBottom = 'B',
65  kPlayerLeft = 'L',
66  kPlayerRight = 'R'
67 };
68 
69 // Common colors
70 enum HypnoColors {
71  kHypnoNoColor = -1,
72  kHypnoColorRed = 250,
73  kHypnoColorGreen = 251,
74  kHypnoColorWhiteOrBlue = 252,
75  kHypnoColorYellow = 253,
76  kHypnoColorBlack = 254,
77  kHypnoColorCyan = 255
78 };
79 
80 // Spider colors
81 enum SpiderColors {
82  kSpiderColorWhite = 248,
83  kSpiderColorBlue = 252,
84 };
85 
86 enum HYPNOActions {
87  kActionNone,
88  kActionSkipIntro,
89  kActionSkipCutscene,
90  kActionPrimaryShoot,
91  kActionSkipLevel,
92  kActionKillPlayer,
93  kActionPause,
94  kActionLeft,
95  kActionDown,
96  kActionRight,
97  kActionUp,
98  kActionYes,
99  kActionNo,
100  kActionDifficultyChump,
101  kActionDifficultyPunk,
102  kActionDifficultyBadass,
103  kActionDifficultExit,
104  kActionRetry,
105  kActionRestart,
106  kActionNewMission,
107  kActionQuit,
108  kActionCredits,
109  kActionSelect,
110 };
111 
112 class HypnoEngine;
113 
114 class CursorCache {
115 private:
116  HypnoEngine *_vm;
117  Common::String _filename;
118  uint32 _frame;
119  byte *_palette;
120  Graphics::Surface *_surface;
121 
122 public:
123  CursorCache(HypnoEngine *vm) : _vm(vm), _filename(""), _frame(0), _palette(nullptr), _surface(nullptr) {}
124 
125  ~CursorCache() {
126  if (_surface) {
127  _surface->free();
128  delete _surface;
129  }
130  free(_palette);
131  }
132 
133  Graphics::Surface *getCursor(const Common::String &cursor, uint32 n, byte **palette);
134 };
135 
136 class HypnoEngine : public Engine {
137 private:
138  Image::ImageDecoder *_image;
139 
140 public:
141  HypnoEngine(OSystem *syst, const ADGameDescription *gd);
142  ~HypnoEngine();
143 
144  const ADGameDescription *_gameDescription;
145  bool isDemo() const;
146  Common::Language _language;
147  Common::Platform _platform;
148  Common::String _variant;
149  bool _cheatsEnabled;
150  bool _infiniteHealthCheat;
151  bool _infiniteAmmoCheat;
152  bool _unlockAllLevels;
153  bool _restoredContentEnabled;
154 
155  Audio::SoundHandle _soundHandle, _musicHandle;
156  Common::InstallShieldV3 _installerArchive;
157  Common::List<LibFile*> _archive;
158 
159  Common::Error run() override;
160  Levels _levels;
162  virtual void resetSceneState();
163  bool checkSceneCompleted();
164  bool checkLevelWon();
165  void runLevel(Common::String &name);
166  void runScene(Scene *scene);
167  virtual void runBeforeArcade(ArcadeShooting *arc);
168  virtual void runAfterArcade(ArcadeShooting *arc);
169  void runArcade(ArcadeShooting *arc);
170  // For some menus and hardcoded puzzles
171  virtual void runCode(Code *code);
172  // Level transitions
173  void runTransition(Transition *trans);
174 
175  void restartGame();
176  void clearAreas();
177  void initializePath(const Common::FSNode &gamePath) override;
178  virtual void loadAssets();
179 
180  // Parsing
181  void splitArcadeFile(const Common::String &filename, Common::String &arc, Common::String &list);
182  void parseArcadeShooting(const Common::String &prefix, const Common::String &name, const Common::String &data);
183  SegmentShootsSequence parseShootList(const Common::String &name, const Common::String &data);
184  void loadArcadeLevel(const Common::String &current, const Common::String &nextWin, const Common::String &nextLose, const Common::String &prefix);
185  void loadSceneLevel(const Common::String &current, const Common::String &next, const Common::String &prefix);
186  void loadSceneLevel(const char *buf, const Common::String &name, const Common::String &next, const Common::String &prefix);
187 
188  LibFile *loadLib(const Common::Path &prefix, const Common::Path &filename, bool encrypted);
189 
190  // User input
191  void clickedHotspot(Common::Point);
192  virtual bool hoverHotspot(Common::Point);
193 
194  // Cursors
195  bool cursorPauseMovie(Common::Point);
196  bool cursorExit(Common::Point);
197  bool cursorMask(Common::Point);
198 
199  virtual void loadGame(const Common::String &nextLevel, int score, int puzzleDifficulty, int combatDifficulty);
200  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override { return (isDemo() ? false : true); }
201  bool canSaveAutosaveCurrently() override { return false; }
202  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override { return (isDemo() ? false : true); }
203  Common::String _checkpoint;
204 
205  bool _useSubtitles;
206  Video::Subtitles *_subtitles;
207  void adjustSubtitleSize();
208  void loadSubtitles(const Common::Path &path);
209 
210  Common::Path _prefixDir;
211  Common::Path convertPath(const Common::String &);
212  void playVideo(MVideo &video);
213  void skipVideo(MVideo &video);
214 
215  Graphics::Surface *decodeFrame(const Common::String &name, int frame, byte **palette = nullptr);
216  Frames decodeFrames(const Common::String &name);
217  void loadImage(const Common::String &file, int x, int y, bool transparent, bool palette = false, int frameNumber = 0);
218  void drawImage(Graphics::Surface &image, int x, int y, bool transparent);
219  void loadPalette(const Common::String &fname);
220  void loadPalette(const byte *palette, uint32 offset, uint32 size);
221  byte *getPalette(uint32 idx);
222 
223  // Cursors
224  Common::String _defaultCursor;
225  uint32 _defaultCursorIdx;
226  CursorCache *_cursorCache;
227  void disableCursor();
228  void defaultCursor();
229  virtual void changeCursor(const Common::String &cursor, uint32 n, bool centerCursor = false);
230  virtual void changeCursor(const Common::String &cursor);
231  virtual void changeCursor(const Graphics::Surface &entry, byte *palette, bool centerCursor = false);
232 
233  // Actions
234  virtual void runMenu(Hotspots *hs, bool only_menu = false);
235  void runBackground(Background *a);
236  void runOverlay(Overlay *a);
237  void runMice(Mice *a);
238  void runEscape();
239  void runSave(Save *a);
240  void runLoad(Load *a);
241  void runLoadCheckpoint(LoadCheckpoint *a);
242  void runTimer(Timer *a);
243  void runQuit(Quit *a);
244  void runCutscene(Cutscene *a);
245  void runIntro(Intro *a);
246  void runPlay(Play *a);
247  void runSound(Sound *a);
248  void runPalette(Palette *a);
249  void runAmbient(Ambient *a);
250  void runWalN(WalN *a);
251  bool runGlobal(Global *a);
252  void runTalk(Talk *a);
253  void runSwapPointer(SwapPointer *a);
254  void runChangeLevel(ChangeLevel *a);
255  virtual void drawBackToMenu(Hotspot *h);
256 
257  // Screen
258  int _screenW, _screenH;
259  Graphics::PixelFormat _pixelFormat;
260  void changeScreenMode(const Common::String &mode);
261  Graphics::Surface *_compositeSurface;
262  uint32 _transparentColor;
263  Common::Rect screenRect;
264  void updateScreen(MVideo &video);
265  void updateVideo(MVideo &video);
266  void drawScreen();
267 
268  // intros
269  void runIntro(MVideo &video);
270  void runIntros(Videos &videos);
271  void runIntrosWithSubtitles(Videos &videos);
273 
274  // levels
275  Common::String _nextLevel;
276  Common::String _currentLevel;
277  virtual Common::String findNextLevel(const Common::String &level);
278  virtual Common::String findNextLevel(const Transition *trans);
279  uint32 _levelId;
280 
281  // hotspots
282  Hotspots *_nextHotsToAdd;
283  Hotspots *_nextHotsToRemove;
284  HotspotsStack stack;
285 
286  // Movies
287  Videos _nextSequentialVideoToPlay;
288  Videos _nextParallelVideoToPlay;
289  Videos _escapeSequentialVideoToPlay;
290  Videos _videosPlaying;
291  Videos _videosLooping;
292  MVideo *_masks;
293  MVideo *_additionalVideo;
294  const Graphics::Surface *_mask;
295 
296  // Sounds
297  Filename _soundPath;
298  Audio::SeekableAudioStream *loadAudioStream(const Filename &filename, uint32 sampleRate = 22050, bool stereo = false);
299  void playSound(const Filename &filename, uint32 loops, uint32 sampleRate = 22050, bool stereo = false);
300  void playMusic(const Filename &filename, uint32 sampleRate = 22050, bool stereo = false);
301  void stopSound();
302  void stopMusic();
303  bool isMusicActive();
304 
305  // Arcade
306  Common::String _arcadeMode;
307  MVideo *_background;
308  Filename _currentPalette;
309  virtual bool availableObjectives();
310  virtual bool checkArcadeObjectives();
311  ArcadeTransitions _transitions;
312  virtual bool checkTransition(ArcadeTransitions &transitions, ArcadeShooting *arc);
313  virtual Common::Point getPlayerPosition(bool needsUpdate);
314  virtual Common::Point computeTargetPosition(const Common::Point &mousePos);
315  virtual int detectTarget(const Common::Point &mousePos);
316  virtual void pressedKey(const int keycode);
317  virtual bool clickedPrimaryShoot(const Common::Point &mousePos);
318  virtual bool clickedSecondaryShoot(const Common::Point &mousePos);
319  virtual void drawShoot(const Common::Point &mousePos);
320  virtual bool shoot(const Common::Point &mousePos, ArcadeShooting *arc, bool secondary);
321  virtual void hitPlayer();
322  virtual void missedTarget(Shoot *s, ArcadeShooting *arc);
323  virtual void missNoTarget(ArcadeShooting *arc);
324  virtual byte *getTargetColor(Common::String name, int levelId);
325  virtual bool checkRButtonUp();
326  virtual void setRButtonUp(const bool val);
327  virtual void disableGameKeymaps();
328  virtual void enableGameKeymaps();
329 
330  // Segments
331  Segments _segments;
332  uint32 _segmentIdx;
333  uint32 _segmentOffset;
334  uint32 _segmentRepetition;
335  uint32 _segmentRepetitionMax;
336  uint32 _segmentShootSequenceOffset;
337  uint32 _segmentShootSequenceMax;
338  ShootSequence _shootSequence;
339  virtual void findNextSegment(ArcadeShooting *arc);
340  virtual void initSegment(ArcadeShooting *arc);
341 
342  ArcadeStats _stats;
343  void resetStatistics();
344  void incLivesUsed();
345  void incShotsFired();
346  void incEnemyHits();
347  void incEnemyTargets();
348  void incTargetsDestroyed();
349  void incTargetsMissed();
350  void incFriendliesEncountered();
351  void incInfoReceived();
352 
353  void incScore(int inc);
354  void incBonus(int inc);
355 
356  uint32 killRatio();
357  uint32 accuracyRatio();
358 
359  Common::String _difficulty;
360  bool _skipLevel;
361  bool _loseLevel;
362  bool _skipDefeatVideo;
363  bool _skipNextVideo;
364 
365  virtual void drawCursorArcade(const Common::Point &mousePos);
366  virtual void drawPlayer();
367  virtual void drawHealth();
368  virtual void drawAmmo();
369  int _health;
370  int _maxHealth;
371 
372  int _ammo;
373  int _maxAmmo;
374 
375  int _score;
376  int _bonus;
377  int _lives;
378 
379  Common::String _healthString;
380  Common::String _scoreString;
381  Common::String _objString;
382  Common::String _targetString;
383  Common::String _directionString;
384  Common::String _enterNameString;
385 
386  Filename _shootSound;
387  Filename _hitSound;
388  Filename _additionalSound;
389  Shoots _shoots;
390  Frames _playerFrames;
391  int _playerFrameIdx;
392  Common::List<int> _playerFrameSeps;
393  int _playerFrameStart;
394  int _playerFrameSep;
395  int _playerFrameEnd;
396 
397  // Objectives
398  uint32 _objIdx;
399  uint32 _objKillsCount[2];
400  uint32 _objMissesCount[2];
401  uint32 _objKillsRequired[2];
402  uint32 _objMissesAllowed[2];
403 
404  // Fonts
405  Common::BitArray _font05;
406  Common::BitArray _font08;
407  virtual void loadFonts(const Common::String &prefix = "");
408  virtual void drawString(const Filename &name, const Common::String &str, int x, int y, int w, uint32 c);
409 
410  // Conversation
411  Actions _conversation;
412  bool _refreshConversation;
413  virtual void showConversation();
414  virtual void endConversation();
415  virtual void rightClickedConversation(const Common::Point &mousePos);
416  virtual void leftClickedConversation(const Common::Point &mousePos);
417  virtual bool hoverConversation(const Common::Point &mousePos);
418  // Credits
419  virtual void showCredits();
420 
421  // Timers
422  int32 _countdown;
423  bool _timerStarted;
424  bool _keepTimerDuringScenes;
425  bool startAlarm(uint32, Common::String *);
426  bool startCountdown(uint32);
427  void removeTimers();
428 
429  // Random
430  Common::RandomSource *_rnd;
431 };
432 
433 struct chapterEntry {
434  int id;
435  int energyPos[2];
436  int scorePos[2];
437  int objectivesPos[2];
438  int ammoPos[2];
439  int ammoOffset;
440  int targetColor;
441 };
442 
443 class WetEngine : public HypnoEngine {
444 public:
445  WetEngine(OSystem *syst, const ADGameDescription *gd);
446  ~WetEngine();
448  Common::Array<int> _ids;
449  int _lastLevel;
450  Common::String _name;
451 
452  void loadAssets() override;
453  void loadAssetsDemoDisc();
454  void loadAssetsEarlyDemo();
455  void loadAssetsGen4();
456  void loadAssetsPCW();
457  void loadAssetsPCG();
458  void loadAssetsFullGame();
459  void loadAssetsNI();
460 
461  void loadFonts(const Common::String &prefix = "") override;
462  void drawString(const Filename &name, const Common::String &str, int x, int y, int w, uint32 c) override;
463  void changeCursor(const Common::String &cursor) override;
464 
465  void showCredits() override;
466  bool clickedSecondaryShoot(const Common::Point &mousePos) override;
467  void drawShoot(const Common::Point &target) override;
468  void drawPlayer() override;
469  void drawHealth() override;
470  void drawAmmo() override;
471  void hitPlayer() override;
472  void drawCursorArcade(const Common::Point &mousePos) override;
473  Common::Point computeTargetPosition(const Common::Point &mousePos) override;
474  void missedTarget(Shoot *s, ArcadeShooting *arc) override;
475  void missNoTarget(ArcadeShooting *arc) override;
476 
477  void runCode(Code *code) override;
478  Common::String findNextLevel(const Common::String &level) override;
479  Common::String findNextLevel(const Transition *trans) override;
480 
481  // Saves
482  Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
483  Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
484  bool loadProfile(const Common::String &name);
485  void saveProfile(const Common::String &name, int levelId);
486 
487  // Arcade
488  Common::Point getPlayerPosition(bool needsUpdate) override;
489  bool checkTransition(ArcadeTransitions &transitions, ArcadeShooting *arc) override;
490  void pressedKey(const int keycode) override;
491  void runBeforeArcade(ArcadeShooting *arc) override;
492  void runAfterArcade(ArcadeShooting *arc) override;
493  void findNextSegment(ArcadeShooting *arc) override;
494  void initSegment(ArcadeShooting *arc) override;
495  byte *getTargetColor(Common::String name, int levelId) override;
496  bool checkRButtonUp() override;
497  void setRButtonUp(const bool val) override;
498  void disableGameKeymaps() override;
499  void enableGameKeymaps() override;
500 
501 
502  bool hasFeature(EngineFeature f) const override {
503  return (f == kSupportsReturnToLauncher);
504  }
505 
506 private:
507  Common::String getLocalizedString(const Common::String &name);
508  uint16 getNextChar(const Common::String &str, uint32 &c);
509  void drawGlyph(const Common::BitArray &font, int x, int y, int bitoffset, int width, int height, int pitch, uint32 color, bool invert);
510  void drawKoreanChar(uint16 chr, int &curx, int y, uint32 color);
511  void runMainMenu(Code *code);
512  void runLevelMenu(Code *code);
513  void runCheckLives(Code *code);
514  void endCredits(Code *code);
515  void showDemoScore();
516  uint32 findPaletteIndexZones(uint32 id);
517 
518  Common::List<int> _scoreMilestones;
519  void restoreScoreMilestones(int score);
520  bool checkScoreMilestones(int score);
521 
522 
523  Frames _c33PlayerCursor;
524  Common::Point _c33PlayerPosition;
525  Common::List<PlayerPosition> _c33PlayerDirection;
526  bool _c33UseMouse;
527  void generateStaticEffect();
528 
529  Common::BitArray _fontg9a;
530  Common::Array<uint32> _c40SegmentPath;
531  Common::Array<uint32> _c40SegmentNext;
532  int _c40SegmentIdx;
533  int _c40lastTurn;
534  int _c50LeftTurns;
535  int _c50RigthTurns;
536 
537  bool _rButtonUp;
538 };
539 
540 class SpiderEngine : public HypnoEngine {
541 public:
542  SpiderEngine(OSystem *syst, const ADGameDescription *gd);
543  ~SpiderEngine();
544  void loadAssets() override;
545  void loadAssetsDemo();
546  void loadAssetsFullGame();
547  void showCredits() override;
548 
549  void drawCursorArcade(const Common::Point &mousePos) override;
550  void drawShoot(const Common::Point &target) override;
551  void drawPlayer() override;
552  void drawHealth() override;
553  void missedTarget(Shoot *s, ArcadeShooting *arc) override;
554  void hitPlayer() override;
555 
556  // Arcade
557  void pressedKey(const int keycode) override;
558  void runBeforeArcade(ArcadeShooting *arc) override;
559  void runAfterArcade(ArcadeShooting *arc) override;
560  void findNextSegment(ArcadeShooting *arc) override;
561  void initSegment(ArcadeShooting *arc) override;
562  byte *getTargetColor(Common::String name, int levelId) override;
563 
564  void drawBackToMenu(Hotspot *h) override;
565  void runCode(Code *code) override;
566  Common::String findNextLevel(const Common::String &level) override;
567  Common::String findNextLevel(const Transition *trans) override;
568 
569  void loadFonts(const Common::String &prefix = "") override;
570  void drawString(const Filename &name, const Common::String &str, int x, int y, int w, uint32 c) override;
571 
572  void showConversation() override;
573  void endConversation() override;
574  void rightClickedConversation(const Common::Point &mousePos) override;
575  void leftClickedConversation(const Common::Point &mousePos) override;
576  bool hoverConversation(const Common::Point &mousePos) override;
577 
578  void loadGame(const Common::String &nextLevel, int score, int puzzleDifficulty, int combatDifficulty) override;
579  Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
580  Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
581  bool canSaveAutosaveCurrently() override {
582  return false; // No hypno engine should perform autosave using the default implementation
583  }
584 
585  bool hasFeature(EngineFeature f) const override {
586  return (f == kSupportsSavingDuringRuntime || f == kSupportsLoadingDuringRuntime || f == kSupportsReturnToLauncher);
587  }
588 
589 private:
590  void runMatrix(Code *code);
591  void addIngredient(Code *code);
592  void checkMixture(Code *code);
593  void runNote(Code *code);
594  void runFusePanel(Code *code);
595  void runRecept(Code *code);
596  void runOffice(Code *code);
597  void runFileCabinet(Code *code);
598  void runLock(Code *code);
599  void runFuseBox(Code *code);
600  void runGiveUp();
601  void showScore(const Common::String &prefix);
602 
603  uint32 _currentPlayerPosition;
604  uint32 _lastPlayerPosition;
605 
606  bool _fuseState[2][10] = {};
607  bool _isFuseRust = true;
608  bool _isFuseUnreadable = false;
609  bool ingredients[7] = {};
610 
611  Common::Rect _h1Area;
612  Common::Rect _h2Area;
613  Common::Rect _h3Area;
614 
615  const Graphics::Font *_font;
616 };
617 
618 class BoyzEngine : public HypnoEngine {
619 public:
620  BoyzEngine(OSystem *syst, const ADGameDescription *gd);
621  ~BoyzEngine();
622  Common::String _name;
623  Common::Array<int> _ids;
624  int _lastLevel;
625  bool _flashbackMode;
626  void loadAssets() override;
627  void runCode(Code *code) override;
628  Common::String findNextLevel(const Common::String &level) override;
629  Common::String findNextLevel(const Transition *trans) override;
630 
631  // Scenes
632  void resetSceneState() override;
633  void runMenu(Hotspots *hs, bool only_menu = false) override;
634  bool hoverHotspot(Common::Point) override;
635 
636  // Arcade
637  void runBeforeArcade(ArcadeShooting *arc) override;
638  void runAfterArcade(ArcadeShooting *arc) override;
639  void pressedKey(const int keycode) override;
640  int detectTarget(const Common::Point &mousePos) override;
641  void drawCursorArcade(const Common::Point &mousePos) override;
642  bool shoot(const Common::Point &mousePos, ArcadeShooting *arc, bool secondary) override;
643  bool clickedSecondaryShoot(const Common::Point &mousePos) override;
644  void showCredits() override;
645  // Stats
646  void showArcadeStats(int territory, const ArcadeStats &data);
647  ArcadeStats _lastStats;
648  ArcadeStats _globalStats;
649 
650  void missedTarget(Shoot *s, ArcadeShooting *arc) override;
651  void drawHealth() override;
652  void drawAmmo() override;
653  void drawShoot(const Common::Point &target) override;
654  void hitPlayer() override;
655  void drawPlayer() override;
656  void findNextSegment(ArcadeShooting *arc) override;
657  void initSegment(ArcadeShooting *arc) override;
658  bool checkTransition(ArcadeTransitions &transitions, ArcadeShooting *arc) override;
659 
660  void drawString(const Filename &name, const Common::String &str, int x, int y, int w, uint32 c) override;
661 
662  // Saves
663  Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
664  Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
665  Common::StringArray listProfiles();
666  bool loadProfile(const Common::String &name);
667  void saveProfile(const Common::String &name, int levelId);
668 
669  private:
670  void renderHighlights(Hotspots *hs);
671  void waitForUserClick(uint32 timeout);
672  int pickABox();
673  int _selectedCorrectBox;
674  char selectDirection();
675 
676  void runMainMenu(Code *code);
677  bool runExitMenu();
678  void runRetryMenu(Code *code);
679  void runCheckC3(Code *code);
680  void runCheckHo(Code *code);
681  void runCheckC5(Code *code);
682  void runAlarmC5(Code *code);
683  void runDifficultyMenu(Code *code);
684  void endCredits(Code *code);
685  int getTerritory(const Common::String &level);
686  Common::String lastLevelTerritory(const Common::String &level);
687  Common::String firstLevelTerritory(const Common::String &level);
688 
689  void loadSceneState(Common::SeekableReadStream *stream);
690  void saveSceneState(Common::WriteStream *stream);
691  void unlockAllLevels();
692 
693  int _previousHealth;
694  Graphics::Surface _healthBar[7];
695  Graphics::Surface _ammoBar[7];
696  Graphics::Surface _portrait[7];
697  Filename _deathDay[7];
698  Filename _deathNight[7];
699 
700  Filename _weaponShootSound[8];
701  Filename _weaponReloadSound[8];
702  Filename _heySound[7];
703  int _weaponMaxAmmo[8];
704 
705  byte *_crosshairsPalette;
706  Graphics::Surface _crosshairsInactive[8];
707  Graphics::Surface _crosshairsActive[8];
708  Graphics::Surface _crosshairsTarget[8];
709  Graphics::Surface _leftArrowPointer;
710  Graphics::Surface _rightArrowPointer;
711  Graphics::Surface _crossPointer;
712 
713  void updateFromScript();
714  bool checkCup(const Common::String &name);
715 
716  Script _currentScript;
717  ScriptMode _currentMode;
718  uint32 _currentActor;
719  uint32 _currentWeapon;
720  Common::Array<Filename> _warningVideosDay;
721  Common::Array<Filename> _warningVideosNight;
722  Common::Array<Filename> _warningAlarmVideos;
723  Filename _warningHostage;
724 
725  Common::Array<Filename> _deathVideo;
726  Common::HashMap<Common::String, bool> _shootsDestroyed;
727 
728  bool hasFeature(EngineFeature f) const override {
729  return (f == kSupportsReturnToLauncher);
730  }
731 };
732 
733 } // End of namespace Hypno
734 
735 #endif
bool canSaveAutosaveCurrently() override
Definition: hypno.h:581
Definition: grammar.h:732
Definition: image_decoder.h:53
Definition: grammar.h:333
Definition: str.h:59
Definition: installshieldv3_archive.h:35
Definition: font.h:83
Definition: hypno.h:618
Definition: surface.h:67
Definition: grammar.h:359
EngineFeature
Definition: engine.h:258
Definition: grammar.h:121
Definition: libfile.h:39
Definition: stream.h:77
Definition: error.h:81
Definition: grammar.h:221
Definition: grammar.h:244
Definition: grammar.h:440
Definition: pixelformat.h:138
Definition: grammar.h:152
Definition: advancedDetector.h:164
Definition: random.h:44
Definition: hypno.h:433
Definition: grammar.h:214
Definition: grammar.h:235
Definition: hypno.h:540
Definition: list.h:44
Definition: rect.h:524
Definition: path.h:52
Definition: grammar.h:707
Definition: stream.h:745
Definition: audiostream.h:212
Definition: subtitles.h:78
Definition: grammar.h:228
Definition: mixer.h:49
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: hypno.h:200
Definition: hypno.h:443
Definition: grammar.h:187
Definition: grammar.h:48
Definition: hypno.h:136
Definition: grammar.h:262
Definition: hashmap.h:85
Definition: ustr.h:57
Definition: grammar.h:311
Definition: fs.h:69
Definition: bitarray.h:29
Definition: rect.h:144
Definition: grammar.h:35
Definition: grammar.h:253
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: hypno.h:202
Definition: grammar.h:132
bool hasFeature(EngineFeature f) const override
Definition: hypno.h:502
Definition: grammar.h:600
Definition: grammar.h:745
Definition: grammar.h:141
Definition: grammar.h:277
Definition: grammar.h:207
Definition: grammar.h:104
bool hasFeature(EngineFeature f) const override
Definition: hypno.h:585
Definition: system.h:164
Definition: hypno.h:114
bool canSaveAutosaveCurrently() override
Definition: hypno.h:201
Definition: movie_decoder.h:32
Definition: engine.h:144
Definition: grammar.h:395
Definition: system.h:38
Definition: grammar.h:170
Platform
Definition: platform.h:93
Definition: grammar.h:294
Language
Definition: language.h:45