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
|
/* ScummVM - Scumm Interpreter
* Copyright (C) 2003 The ScummVM project
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header$
*
*/
#include "stdafx.h"
#include "backends/fs/fs.h"
#include "base/gameDetector.h"
#include "base/plugins.h"
#include "common/config-manager.h"
#include "common/file.h"
#include "queen/command.h"
#include "queen/cutaway.h"
#include "queen/display.h"
#include "queen/graphics.h"
#include "queen/input.h"
#include "queen/queen.h"
#include "queen/sound.h"
#include "queen/talk.h"
#include "queen/walk.h"
extern uint16 _debugLevel;
#ifdef _WIN32_WCE
extern bool toolbar_drawn;
extern bool draw_keyboard;
#endif
static const GameSettings queen_settings[] = {
/* Flight of the Amazon Queen */
{ "queen", "Flight of the Amazon Queen", MDT_ADLIB | MDT_NATIVE | MDT_PREFER_NATIVE, 0, "queen.1" },
{ "queencomp", "Flight of the Amazon Queen", MDT_ADLIB | MDT_NATIVE | MDT_PREFER_NATIVE, 0, "queen.1c" },
{ NULL, NULL, MDT_NONE, 0, NULL}
};
GameList Engine_QUEEN_gameList() {
const GameSettings *g = queen_settings;
GameList games;
while (g->gameName)
games.push_back(*g++);
return games;
}
GameList Engine_QUEEN_detectGames(const FSList &fslist) {
GameList detectedGames;
const GameSettings *g = &queen_settings[0];
while(g->detectname) {
// Iterate over all files in the given directory
for (FSList::ConstIterator file = fslist.begin(); file != fslist.end(); ++file) {
const char *gameName = file->displayName().c_str();
if (0 == scumm_stricmp(g->detectname, gameName)) {
// Match found, add to list of candidates, then abort inner loop.
detectedGames.push_back(*g);
break;
}
}
g++;
}
return detectedGames;
}
Engine *Engine_QUEEN_create(GameDetector *detector, OSystem *syst) {
return new Queen::QueenEngine(detector, syst);
}
REGISTER_PLUGIN("Flight of the Amazon Queen", Engine_QUEEN_gameList, Engine_QUEEN_create, Engine_QUEEN_detectGames);
namespace Queen {
QueenEngine::QueenEngine(GameDetector *detector, OSystem *syst)
: Engine(detector, syst) {
if (!_mixer->bindToSystem(syst))
warning("Sound initialisation failed.");
_mixer->setVolume(ConfMan.getInt("sfx_volume"));
_debugMode = ConfMan.hasKey("debuglevel");
_debugLevel = ConfMan.getInt("debuglevel");
_detector = detector;
_fastMode = 0;
_system->init_size(320, 200);
}
QueenEngine::~QueenEngine() {
_timer->removeTimerProc(&timerHandler);
delete _resource;
delete _display;
delete _logic;
delete _graphics;
delete _input;
}
void QueenEngine::errorString(const char *buf1, char *buf2) {
strcpy(buf2, buf1);
}
void QueenEngine::roomChanged() {
// queen.c function SETUP_ROOM, lines 398-428
// This function uses lots of variables in logic, but we can't move it to
// logic because that would cause a circular dependency between Cutaway and
// Logic... :-(
if (_logic->currentRoom() == 7) {
warning("Room 7 not yet handled!");
// _logic->handlePinnacleRoom();
// XXX fadeout(0,223);
}
else if (_logic->currentRoom() == FOTAQ_LOGO && _logic->gameState(VAR_INTRO_PLAYED) == 0) {
bool pcGamesDemo = _resource->isDemo() && !_resource->exists("pclogo.cut");
if (pcGamesDemo) {
_logic->currentRoom(79);
}
_logic->roomDisplay(_logic->roomName(_logic->currentRoom()), RDM_FADE_NOJOE, 100, 2, true);
if (_resource->isDemo()) {
if (pcGamesDemo) {
_logic->playCutaway("clogo.cut");
}
else {
_logic->playCutaway("pclogo.cut");
}
}
else {
_logic->playCutaway("copy.cut");
_logic->playCutaway("clogo.cut");
// TODO enable talking for talkie version
_logic->playCutaway("cdint.cut");
// restore palette colors ranging from 144 to 256
_graphics->loadPanel();
_logic->playCutaway("cred.cut");
}
_logic->currentRoom(ROOM_HOTEL_LOBBY);
_logic->entryObj(584);
_logic->roomDisplay(_logic->roomName(_logic->currentRoom()), RDM_FADE_JOE, 100, 2, true);
_logic->playCutaway("c70d.cut");
_logic->gameState(VAR_INTRO_PLAYED, 1);
_logic->inventorySetup();
_logic->inventoryRefresh();
}
else {
_logic->roomDisplay(_logic->roomName(_logic->currentRoom()), RDM_FADE_JOE, 100, 1, false);
}
_display->mouseCursorShow(true); // _drawMouseFlag = 1;
}
void QueenEngine::go() {
if (!_dump_file)
_dump_file = stdout;
initialise();
_logic->oldRoom(0);
_logic->newRoom(_logic->currentRoom());
for (;;) {
// queen.c lines 4080-4104
if (_logic->newRoom() > 0) {
_graphics->textClear(151, 151);
_logic->update();
_logic->oldRoom(_logic->currentRoom());
_logic->currentRoom(_logic->newRoom());
roomChanged();
// XXX _logic->fullScreen(false);
if (_logic->currentRoom() == _logic->newRoom()) {
_logic->newRoom(0);
}
}
else {
if (_logic->joeWalk() == 2) {
_logic->joeWalk(0);
_logic->command()->executeCurrentAction(true);
}
else {
if (_logic->command()->parse()) {
_logic->command()->clear(true);
}
_logic->joeWalk(0);
_logic->checkPlayer();
}
}
break; // XXX don't loop yet
}
}
void QueenEngine::initialise(void) {
_resource = new Resource(_gameDataPath, _detector->_game.detectname);
_input = new Input(_resource->getLanguage(), _system);
_display = new Display(_system, _input);
_graphics = new Graphics(_display, _input, _resource);
_sound = Sound::giveSound(_mixer, _input, _resource, _resource->compression());
_logic = new Logic(_resource, _graphics, _display, _input, _sound);
_timer->installTimerProc(&timerHandler, 1000000 / 50, this); //call 50 times per second
}
void QueenEngine::timerHandler(void *ptr) {
((QueenEngine *)ptr)->gotTimerTick();
}
void QueenEngine::gotTimerTick() {
_display->handleTimer();
}
} // End of namespace Queen
|