aboutsummaryrefslogtreecommitdiff
path: root/engines/pegasus/pegasus.h
blob: b4f4d8f98e4bf9eb4d4b974f7815d075a9fbaf45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * $URL$
 * $Id$
 *
 */

#ifndef PEGASUS_H
#define PEGASUS_H

#include "common/macresman.h"
#include "common/scummsys.h"
#include "common/system.h"
#include "common/rect.h"
#include "common/util.h"

#include "engines/engine.h"

#include "pegasus/sound.h"
#include "pegasus/graphics.h"
#include "pegasus/video.h"

namespace Pegasus {

struct PegasusGameDescription;
class SoundManager;
class VideoManager;
class GraphicsManager;

enum ItemLocation {
	kItemLocationCaldoria = 0,
	kItemLocationTSA = 1,
	kItemLocationNorad = 4, // ???
	kItemLocationMars = 5,
	kItemLocationWSC = 6,
	kItemLocationPrehistoric = 7,
	kItemLocationBuiltIn = 0xffff
};

struct ItemLocationData {
	uint16 id;
	ItemLocation location;
	uint16 u0;
	byte u1;
};

struct View {
	uint16 u0;
	byte u1;
	byte u2;
	uint32 frameTime;
};

struct Door {
	uint16 u0;
	uint16 u1;
	uint32 startTime;
	uint32 endTime;
	uint16 u2;
};

struct SoundSpot {
	uint16 u0;
	uint16 u1;
	uint16 u2;
	uint32 startTime;
	uint32 endTime;
	uint16 u3;
};

struct Zoom {
	uint16 u0;
	uint32 startTime;
	uint32 endTime;
	uint16 u1;
	uint16 u2;
};

struct Extra {
	uint32 u0;
	uint32 startTime;
	uint32 endTime;
};

struct InventoryPanelEntry {
	uint32 startTime;
	uint32 endTime;
};

struct InventoryItemData {
	uint32 leftFrameTime;
	uint32 rightStartTime;
	uint32 rightEndTime;
	uint16 pict;        // Cannot use item at this spot
	uint16 usablePict;  // Can use item at this spot
};

struct InventoryExtra {
	uint32 id;
	uint16 movie;
	uint32 startTime;
	uint32 endTime;
};

struct LeftAreaData {
	uint16 frame;
	uint32 time;
};

struct MiddleAreaData {
	uint16 id;
	uint32 time;
};

struct RightAreaData {
	uint16 frame;
	uint32 time;
};

enum TimeZone {
	kLocPrehistoric = 0,
	kLocMars = 1,
	kLocWSC = 2,
	kLocTinyTSA = 3,
	kLocFullTSA = 4,
	kLocNoradAlpha = 5,
	kLocCaldoria = 6,
	kLocNoradDelta = 7
};

// Taken from JMP PP Resources
enum Item {
	kAIBiochip = 128,
	kInterfaceBiochip = 129, // NOT USED!
	kMapBiochip = 130,
	kOpticalBiochip = 131,
	kPegasusBiochip = 132,
	kRetinalScanBiochip = 133,
	kShieldBiochip = 134,
	kAirMask = 135,
	kAntidote = 136,
	kArgonCanister = 137,
	kCardBomb = 138,
	kCrowbar = 139,
	kGasCanister = 140,
	kHistoricalLog = 141,
	kJourneymanKey = 142,
	kKeyCard = 143,
	kMachineGun = 144, // What the hell is this?
	kMarsCard = 145,
	kNitrogenCanister = 146,
	kOrangeJuiceGlassFull = 147,
	kOrangeJuiceGlassEmpty = 148,
	kPoisonDart = 149,
	kSinclairKey = 150,
	kStunGun = 151,
	kArgonPickup = 152 // ???
};

enum GameMode {
	kMainMenuMode,
	kMainGameMode,
	kCreditsMode,
	kInterfaceOverviewMode,
	kRestoreMode,
	kQuitMode
};

class PegasusEngine : public ::Engine {
protected:
	Common::Error run();

public:
	PegasusEngine(OSystem *syst, const PegasusGameDescription *gamedesc);
	virtual ~PegasusEngine();
	
	const PegasusGameDescription *_gameDescription;
	bool hasFeature(EngineFeature f) const;
	
	VideoManager *_video;
	SoundManager *_sound;
	GraphicsManager *_gfx;
	Common::MacResManager *_resFork, *_inventoryLid, *_biochipLid;

	bool isDemo() const;

private:
	// Intro
	void runIntro();
	void runMainMenu();
	void drawMenu(int buttonSelected);
	void drawMenuButtonHighlighted(int buttonSelected);
	void drawMenuButtonSelected(int buttonSelected);
	//void runInterfaceOverview();
	void setGameMode(int buttonSelected);

	// Interface
	void drawInterface();
	//void drawCompass();
	//void runPauseMenu();

	// Interface Overview
	void drawInterfaceOverview();

	// Main Game Functions
	void mainGameLoop();
	void loadItemLocationData();
	void changeLocation(TimeZone timeZone);
	void loadViews(TimeZone timeZone);
	void loadDoors(TimeZone timeZone);
	void loadSoundSpots(TimeZone timeZone);
	void loadZooms(TimeZone timeZone);
	void loadExtras(TimeZone timeZone);

	// Misc Functions
	static Common::String getTimeZoneDesc(TimeZone timeZone);

	// Game Variables
	bool _adventureMode;
	GameMode _gameMode;
	TimeZone _timeZone;
	Common::Array<ItemLocationData> _itemLocationData;
	Common::Array<View> _currentViews;
	Common::Array<Door> _currentDoors;
	Common::Array<SoundSpot> _currentSoundSpots;
	Common::Array<Zoom> _currentZooms;
	Common::Array<Extra> _currentExtras;
};

} // End of namespace Pegasus

#endif