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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef HOPKINS_HOPKINS_H
24 #define HOPKINS_HOPKINS_H
25 
26 #include "hopkins/anim.h"
27 #include "hopkins/computer.h"
28 #include "hopkins/debugger.h"
29 #include "hopkins/dialogs.h"
30 #include "hopkins/events.h"
31 #include "hopkins/files.h"
32 #include "hopkins/font.h"
33 #include "hopkins/globals.h"
34 #include "hopkins/graphics.h"
35 #include "hopkins/lines.h"
36 #include "hopkins/menu.h"
37 #include "hopkins/objects.h"
38 #include "hopkins/saveload.h"
39 #include "hopkins/script.h"
40 #include "hopkins/sound.h"
41 #include "hopkins/talk.h"
42 
43 #include "common/scummsys.h"
44 #include "common/system.h"
45 #include "common/error.h"
46 #include "common/random.h"
47 #include "common/hash-str.h"
48 #include "common/util.h"
49 #include "engines/engine.h"
50 #include "graphics/surface.h"
51 
52 /**
53  * This is the namespace of the Hopkins engine.
54  *
55  * Status of this engine: In Development
56  *
57  * Games using this engine:
58  * - Hopkins FBI
59  */
60 namespace Hopkins {
61 
62 #define SCREEN_WIDTH 640
63 #define SCREEN_HEIGHT 480
64 
65 enum HopkinsDebugChannels {
66 	kDebugPath     = 1 << 0,
67 	kDebugGraphics = 1 << 1
68 };
69 
70 /**
71  * A wrapper macro used around three character constants, like 'END', to
72  * ensure portability. Typical usage: MKTAG24('E','N','D').
73  */
74 #define MKTAG24(a0,a1,a2) ((uint32)((a2) | (a1) << 8 | ((a0) << 16)))
75 
76 struct HopkinsGameDescription;
77 
78 class HopkinsEngine : public Engine {
79 private:
80 	const HopkinsGameDescription *_gameDescription;
81 	Common::RandomSource _randomSource;
82 
83 	void initializeSystem();
84 
85 	void displayNotAvailable();
86 	void restoreSystem();
87 	void endLinuxDemo();
88 	void displayEndDemo();
89 	void bombExplosion();
90 	void handleConflagration();
91 	void playSubmarineCutscene();
92 	void playUnderwaterBaseCutscene();
93 	void playPlaneCutscene();
94 	void playEnding();
95 	bool isUnderwaterSubScene();
96 
97 	/**
98 	 * Displays the map screen in the underground base.
99 	 */
100 	int  handleBaseMap();
101 
102 	/**
103 	 * Loads the base map from the PBASE file
104 	 */
105 	void loadBaseMap();
106 
107 	/**
108 	 * Draws a simple base map for the Windows version, which implemented a 'Wolfenstein 3D'
109 	 * style shooter for the base, rather than having a map
110 	 */
111 	void drawBaseMap();
112 
113 	void handleOceanMouseEvents();
114 	void setSubmarineSprites();
115 	void handleOceanMaze(int16 curExitId, Common::String backgroundFilename, Directions defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId);
116 	void loadCredits();
117 	void displayCredits(int startPosY, byte *buffer, char color);
118 	void displayCredits();
119 	void handleNotAvailable(int nextScreen);
120 
121 	bool runWin95Demo();
122 	bool runLinuxDemo();
123 	bool runFull();
124 
125 	/**
126 	 * Show warning screen about the game being adults only.
127 	 */
128 	bool displayAdultDisclaimer();
129 protected:
130 	// Engine APIs
131 	virtual Common::Error run();
132 	virtual bool hasFeature(EngineFeature f) const;
133 
getDebugger()134 	GUI::Debugger *getDebugger() { return _debug; }
135 
136 public:
137 	AnimationManager *_animMan;
138 	ComputerManager *_computer;
139 	DialogsManager *_dialog;
140 	Debugger *_debug;
141 	EventsManager *_events;
142 	FileManager *_fileIO;
143 	FontManager *_fontMan;
144 	Globals *_globals;
145 	GraphicsManager *_graphicsMan;
146 	LinesManager *_linesMan;
147 	MenuManager *_menuMan;
148 	ObjectsManager *_objectsMan;
149 	SaveLoadManager *_saveLoad;
150 	ScriptManager *_script;
151 	SoundManager *_soundMan;
152 	TalkManager *_talkMan;
153 
154 public:
155 	HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDesc);
156 	virtual ~HopkinsEngine();
157 	void GUIError(const Common::String &msg);
158 
159 	uint32 getFeatures() const;
160 	Common::Language getLanguage() const;
161 	Common::Platform getPlatform() const;
162 	uint16 getVersion() const;
163 	bool getIsDemo() const;
164 	const Common::String &getTargetName() const;
165 
166 	int getRandomNumber(int maxNumber);
167 	Common::String generateSaveName(int slotNumber);
168 	virtual bool canLoadGameStateCurrently();
169 	virtual bool canSaveGameStateCurrently();
170 	virtual Common::Error loadGameState(int slot);
171 	virtual Common::Error saveGameState(int slot, const Common::String &desc);
172 	int _startGameSlot;
173 	/**
174 	 * Run the introduction sequence
175 	 */
176 	void playIntro();
177 
178 	/**
179 	 * Synchronizes the sound settings from ScummVM into the engine
180 	 */
181 	virtual void syncSoundSettings();
182 };
183 
184 } // End of namespace Hopkins
185 
186 #endif /* HOPKINS_HOPKINS_H */
187