2003-09-28 15:50:47 +00:00
|
|
|
/* 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 "queen/queen.h"
|
2003-10-16 19:40:29 +00:00
|
|
|
#include "queen/cutaway.h"
|
|
|
|
#include "queen/talk.h"
|
|
|
|
#include "queen/walk.h"
|
|
|
|
#include "queen/graphics.h"
|
2003-10-08 21:59:23 +00:00
|
|
|
#include "common/config-manager.h"
|
2003-09-28 15:50:47 +00:00
|
|
|
#include "common/file.h"
|
|
|
|
#include "base/gameDetector.h"
|
2003-09-28 17:48:07 +00:00
|
|
|
#include "base/plugins.h"
|
2003-10-16 13:54:48 +00:00
|
|
|
#include "queen/display.h"
|
2003-10-11 10:24:12 +00:00
|
|
|
#include "queen/graphics.h"
|
2003-09-28 15:50:47 +00:00
|
|
|
|
|
|
|
extern uint16 _debugLevel;
|
|
|
|
|
|
|
|
#ifdef _WIN32_WCE
|
|
|
|
|
|
|
|
extern bool toolbar_drawn;
|
|
|
|
extern bool draw_keyboard;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2003-10-12 18:40:12 +00:00
|
|
|
static const GameSettings queen_settings[] = {
|
2003-09-28 15:50:47 +00:00
|
|
|
/* Flight of the Amazon Queen */
|
|
|
|
{ "queen", "Flight of the Amazon Queen", GID_QUEEN_FIRST, 99, MDT_ADLIB | MDT_NATIVE | MDT_PREFER_NATIVE, 0, "queen.1" },
|
|
|
|
{ NULL, NULL, 0, 0, MDT_NONE, 0, NULL}
|
|
|
|
};
|
|
|
|
|
2003-10-12 18:40:12 +00:00
|
|
|
const GameSettings *Engine_QUEEN_targetList() {
|
2003-09-28 15:50:47 +00:00
|
|
|
return queen_settings;
|
|
|
|
}
|
|
|
|
|
|
|
|
Engine *Engine_QUEEN_create(GameDetector *detector, OSystem *syst) {
|
2003-10-03 19:47:41 +00:00
|
|
|
return new Queen::QueenEngine(detector, syst);
|
2003-09-28 15:50:47 +00:00
|
|
|
}
|
|
|
|
|
2003-09-28 17:48:07 +00:00
|
|
|
REGISTER_PLUGIN("Flight of the Amazon Queen", Engine_QUEEN_targetList, Engine_QUEEN_create);
|
|
|
|
|
2003-10-03 19:47:41 +00:00
|
|
|
namespace Queen {
|
|
|
|
|
2003-09-28 15:50:47 +00:00
|
|
|
QueenEngine::QueenEngine(GameDetector *detector, OSystem *syst)
|
|
|
|
: Engine(detector, syst) {
|
|
|
|
|
|
|
|
_game = detector->_game.id;
|
|
|
|
|
|
|
|
if (!_mixer->bindToSystem(syst))
|
|
|
|
warning("Sound initialisation failed.");
|
|
|
|
|
2003-10-08 21:59:23 +00:00
|
|
|
_mixer->setVolume(ConfMan.getInt("sfx_volume"));
|
2003-09-28 15:50:47 +00:00
|
|
|
|
2003-10-14 07:52:34 +00:00
|
|
|
_debugMode = ConfMan.hasKey("debuglevel");
|
2003-10-08 21:59:23 +00:00
|
|
|
_debugLevel = ConfMan.getInt("debuglevel");
|
2003-09-28 15:50:47 +00:00
|
|
|
_detector = detector;
|
|
|
|
|
|
|
|
_fastMode = 0;
|
|
|
|
|
|
|
|
_system->init_size(320, 200);
|
|
|
|
}
|
|
|
|
|
|
|
|
QueenEngine::~QueenEngine() {
|
2003-10-16 13:54:48 +00:00
|
|
|
delete _resource;
|
|
|
|
delete _display;
|
2003-10-11 10:24:12 +00:00
|
|
|
delete _graphics;
|
2003-10-05 16:07:07 +00:00
|
|
|
delete _logic;
|
2003-09-28 15:50:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QueenEngine::errorString(const char *buf1, char *buf2) {
|
|
|
|
strcpy(buf2, buf1);
|
|
|
|
}
|
|
|
|
|
2003-10-16 19:40:29 +00:00
|
|
|
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!");
|
|
|
|
// XXX R_MAP();
|
|
|
|
// XXX fadeout(0,223);
|
|
|
|
}
|
|
|
|
else if (_logic->currentRoom() == 95 && _logic->gameState(117) == 0) {
|
|
|
|
char nextFilename[20];
|
|
|
|
|
|
|
|
_logic->roomDisplay(_logic->roomName(_logic->currentRoom()), RDM_FADE_NOJOE, 100, 2, true);
|
|
|
|
|
|
|
|
if (_resource->isDemo()) {
|
|
|
|
if (_resource->exists("pclogo.cut"))
|
|
|
|
Cutaway::run("pclogo.cut", nextFilename, _graphics, _logic, _resource);
|
|
|
|
else
|
|
|
|
Cutaway::run("clogo.cut", nextFilename, _graphics, _logic, _resource);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Cutaway::run("copy.cut", nextFilename, _graphics, _logic, _resource);
|
|
|
|
Cutaway::run("clogo.cut", nextFilename, _graphics, _logic, _resource);
|
|
|
|
|
|
|
|
// TODO enable talking for talkie version
|
|
|
|
|
|
|
|
Cutaway::run("cdint.cut", nextFilename, _graphics, _logic, _resource);
|
|
|
|
|
|
|
|
// XXX _graphics->panelLoad();
|
|
|
|
|
|
|
|
Cutaway::run("cred.cut", nextFilename, _graphics, _logic, _resource);
|
|
|
|
}
|
|
|
|
|
|
|
|
_logic->currentRoom(73);
|
|
|
|
// XXX _entryObj = 584;
|
|
|
|
|
2003-10-16 19:51:19 +00:00
|
|
|
_logic->roomDisplay(_logic->roomName(_logic->currentRoom()), RDM_FADE_JOE, 100, 2, true);
|
2003-10-16 19:40:29 +00:00
|
|
|
Cutaway::run("c70d.cut", nextFilename, _graphics, _logic, _resource);
|
|
|
|
|
2003-10-17 03:59:55 +00:00
|
|
|
_logic->gameState(117, 1);
|
2003-10-16 19:40:29 +00:00
|
|
|
|
|
|
|
// XXX setupItems();
|
|
|
|
// XXX inventory();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
_logic->roomDisplay(_logic->roomName(_logic->currentRoom()), RDM_FADE_JOE, 100, 1, false);
|
|
|
|
}
|
|
|
|
// XXX _drawMouseFlag = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-09-28 15:50:47 +00:00
|
|
|
void QueenEngine::go() {
|
|
|
|
|
|
|
|
if (!_dump_file)
|
|
|
|
_dump_file = stdout;
|
|
|
|
|
|
|
|
initialise();
|
2003-10-16 19:40:29 +00:00
|
|
|
|
|
|
|
_logic->oldRoom(0);
|
|
|
|
_logic->newRoom(_logic->currentRoom());
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
// queen.c lines 4080-4104
|
|
|
|
if (_logic->newRoom() > 0) {
|
|
|
|
_graphics->textClear(151, 151);
|
|
|
|
_graphics->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);
|
|
|
|
// XXX executeAction(yes);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// XXX if (_parse == 1)
|
|
|
|
// XXX clearCommand(1);
|
|
|
|
_logic->joeWalk(0);
|
|
|
|
// XXX checkPlayer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break; // XXX don't loop yet
|
|
|
|
}
|
|
|
|
|
2003-09-28 15:50:47 +00:00
|
|
|
while (1) { //main loop
|
|
|
|
delay(1000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void QueenEngine::initialise(void) {
|
2003-10-05 16:07:07 +00:00
|
|
|
_resource = new Resource(_gameDataPath);
|
2003-10-16 13:54:48 +00:00
|
|
|
_display = new Display(_system);
|
|
|
|
_graphics = new Graphics(_display, _resource);
|
|
|
|
_logic = new Logic(_resource, _graphics, _display);
|
2003-10-05 16:07:07 +00:00
|
|
|
//_sound = new Sound(_mixer, _detector->_sfx_volume);
|
2003-09-28 15:50:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QueenEngine::delay(uint amount) {
|
|
|
|
|
|
|
|
OSystem::Event event;
|
|
|
|
|
|
|
|
uint32 start = _system->get_msecs();
|
|
|
|
uint32 cur = start;
|
|
|
|
_key_pressed = 0; //reset
|
|
|
|
|
|
|
|
do {
|
|
|
|
while (_system->poll_event(&event)) {
|
|
|
|
switch (event.event_code) {
|
|
|
|
case OSystem::EVENT_KEYDOWN:
|
|
|
|
if (event.kbd.flags == OSystem::KBD_CTRL) {
|
|
|
|
if (event.kbd.keycode == 'f') {
|
|
|
|
_fastMode ^= 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (event.kbd.keycode == 'g') {
|
|
|
|
_fastMode ^= 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Make sure backspace works right (this fixes a small issue on OS X)
|
|
|
|
if (event.kbd.keycode == 8)
|
|
|
|
_key_pressed = 8;
|
|
|
|
else
|
|
|
|
_key_pressed = (byte)event.kbd.ascii;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OSystem::EVENT_MOUSEMOVE:
|
|
|
|
_sdl_mouse_x = event.mouse.x;
|
|
|
|
_sdl_mouse_y = event.mouse.y;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OSystem::EVENT_LBUTTONDOWN:
|
|
|
|
#ifdef _WIN32_WCE
|
|
|
|
_sdl_mouse_x = event.mouse.x;
|
|
|
|
_sdl_mouse_y = event.mouse.y;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OSystem::EVENT_RBUTTONDOWN:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OSystem::EVENT_QUIT:
|
|
|
|
_system->quit();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (amount == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
{
|
|
|
|
uint this_delay = 20; // 1?
|
|
|
|
if (this_delay > amount)
|
|
|
|
this_delay = amount;
|
|
|
|
_system->delay_msecs(this_delay);
|
|
|
|
}
|
|
|
|
cur = _system->get_msecs();
|
|
|
|
} while (cur < start + amount);
|
|
|
|
}
|
|
|
|
|
2003-10-03 19:47:41 +00:00
|
|
|
} // End of namespace Queen
|