ScummVM API documentation
hopkins.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 HOPKINS_HOPKINS_H
23 #define HOPKINS_HOPKINS_H
24 
25 #include "hopkins/anim.h"
26 #include "hopkins/computer.h"
27 #include "hopkins/debugger.h"
28 #include "hopkins/dialogs.h"
29 #include "hopkins/events.h"
30 #include "hopkins/files.h"
31 #include "hopkins/font.h"
32 #include "hopkins/globals.h"
33 #include "hopkins/graphics.h"
34 #include "hopkins/lines.h"
35 #include "hopkins/menu.h"
36 #include "hopkins/objects.h"
37 #include "hopkins/saveload.h"
38 #include "hopkins/script.h"
39 #include "hopkins/sound.h"
40 #include "hopkins/talk.h"
41 
42 #include "common/scummsys.h"
43 #include "common/system.h"
44 #include "common/error.h"
45 #include "common/random.h"
46 #include "common/hash-str.h"
47 #include "common/util.h"
48 #include "engines/engine.h"
49 #include "graphics/surface.h"
50 
59 namespace Hopkins {
60 
61 #define SCREEN_WIDTH 640
62 #define SCREEN_HEIGHT 480
63 
64 enum HOPKINSAction {
65  kActionNone,
66  kActionEscape,
67  kActionInventory,
68  kActionSave,
69  kActionLoad,
70  kActionOptions,
71  kActionBaseForward,
72  kActionBaseBackward,
73  kActionBaseTurnLeft,
74  kActionBaseTurnRight,
75  kActionBaseFire,
76  kActionBaseUse,
77  kActionBaseToggleTextures,
78  kActionBaseMenu
79 };
80 
81 enum HopkinsDebugChannels {
82  kDebugPath = 1,
83  kDebugGraphics,
84 };
85 
90 #define MKTAG24(a0,a1,a2) ((uint32)((a2) | (a1) << 8 | ((a0) << 16)))
91 
92 struct HopkinsGameDescription;
93 class BaseGame;
94 
95 class HopkinsEngine : public Engine {
96 private:
97  friend class BaseGame;
98 
99  const HopkinsGameDescription *_gameDescription;
100  Common::RandomSource _randomSource;
101  bool _inBaseGame;
102 
103  void initializeSystem();
104 
105  void displayNotAvailable();
106  void restoreSystem();
107  void endLinuxDemo();
108  void displayEndDemo();
109  void bombExplosion();
110  void handleConflagration();
111  void playSubmarineCutscene();
112  void playUnderwaterBaseCutscene();
113  void playPlaneCutscene();
114  void playEnding();
115  bool isUnderwaterSubScene();
116 
120  int handleBaseMap();
121 
125  void loadBaseMap();
126 
131  void drawBaseMap();
132 
133  void handleOceanMouseEvents();
134  void setSubmarineSprites();
135  void handleOceanMaze(int16 curExitId, const Common::Path &backgroundFilename, Directions defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId);
136  void loadCredits();
137  void displayCredits(int startPosY, byte *buffer, char color);
138  void displayCredits();
139  void handleNotAvailable(int nextScreen);
140 
141  bool runWin95Demo();
142  bool runLinuxDemo();
143  bool runFull();
144 
148  bool displayAdultDisclaimer();
149 protected:
150  // Engine APIs
151  Common::Error run() override;
152  bool hasFeature(EngineFeature f) const override;
153 
154 public:
155  AnimationManager *_animMan;
156  ComputerManager *_computer;
157  DialogsManager *_dialog;
158  EventsManager *_events;
159  FileManager *_fileIO;
160  FontManager *_fontMan;
161  Globals *_globals;
162  GraphicsManager *_graphicsMan;
163  LinesManager *_linesMan;
164  MenuManager *_menuMan;
165  ObjectsManager *_objectsMan;
166  SaveLoadManager *_saveLoad;
167  ScriptManager *_script;
168  SoundManager *_soundMan;
169  TalkManager *_talkMan;
170 
171 public:
172  HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDesc);
173  ~HopkinsEngine() override;
174  void GUIError(const Common::String &msg);
175 
176  uint32 getFeatures() const;
177  Common::Language getLanguage() const;
178  Common::Platform getPlatform() const;
179  uint16 getVersion() const;
180  bool getIsDemo() const;
181  const Common::String &getTargetName() const;
182 
183  int getRandomNumber(int maxNumber);
184  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
185  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
186  Common::Error loadGameState(int slot) override;
187  Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
188 
189  int _startGameSlot;
190 
194  void playIntro();
195 
199  void syncSoundSettings() override;
200 };
201 
202 } // End of namespace Hopkins
203 
204 #endif /* HOPKINS_HOPKINS_H */
Definition: lines.h:106
Definition: dialogs.h:39
Definition: str.h:59
EngineFeature
Definition: engine.h:282
bool hasFeature(EngineFeature f) const override
Definition: error.h:81
Definition: detection.h:27
Definition: random.h:44
Common::Error loadGameState(int slot) override
Definition: path.h:52
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: anim.h:47
Definition: script.h:33
Definition: talk.h:34
Definition: globals.h:182
Definition: ustr.h:57
Definition: sound.h:77
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave=false) override
Definition: objects.h:147
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: events.h:38
Definition: anim.h:30
Definition: graphics.h:51
Definition: files.h:40
Definition: font.h:58
Definition: saveload.h:48
Definition: menu.h:33
Definition: hopkins.h:95
Definition: system.h:166
Definition: engine.h:149
Definition: base.h:53
Common::Error run() override
void syncSoundSettings() override
Definition: computer.h:35
Platform
Definition: platform.h:93
Language
Definition: language.h:45