2007-07-29 14:24:31 +00:00
|
|
|
/* 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$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-08-09 19:26:20 +00:00
|
|
|
#include "common/system.h"
|
2007-09-19 08:40:12 +00:00
|
|
|
#include "common/util.h"
|
2007-08-09 19:26:20 +00:00
|
|
|
|
2007-07-29 14:24:31 +00:00
|
|
|
#include "parallaction/parallaction.h"
|
2008-05-14 14:34:01 +00:00
|
|
|
#include "parallaction/input.h"
|
2007-07-29 14:24:31 +00:00
|
|
|
#include "parallaction/sound.h"
|
|
|
|
|
|
|
|
namespace Parallaction {
|
|
|
|
|
2007-08-12 12:24:59 +00:00
|
|
|
|
2008-02-02 12:36:06 +00:00
|
|
|
const char *Parallaction_br::_partNames[] = {
|
2007-08-12 13:27:48 +00:00
|
|
|
"PART0",
|
|
|
|
"PART1",
|
|
|
|
"PART2",
|
|
|
|
"PART3",
|
|
|
|
"PART4"
|
|
|
|
};
|
|
|
|
|
2007-08-12 13:54:01 +00:00
|
|
|
const char *partFirstLocation[] = {
|
|
|
|
"intro",
|
|
|
|
"museo",
|
|
|
|
"start",
|
|
|
|
"bolscoi",
|
|
|
|
"treno"
|
|
|
|
};
|
|
|
|
|
2007-07-29 14:24:31 +00:00
|
|
|
int Parallaction_br::init() {
|
|
|
|
|
|
|
|
_screenWidth = 640;
|
|
|
|
_screenHeight = 400;
|
|
|
|
|
|
|
|
if (getGameType() == GType_BRA) {
|
|
|
|
if (getPlatform() == Common::kPlatformPC) {
|
|
|
|
_disk = new DosDisk_br(this);
|
2007-08-12 13:54:01 +00:00
|
|
|
_disk->setLanguage(2); // NOTE: language is now hardcoded to English. Original used command-line parameters.
|
2008-04-06 07:05:56 +00:00
|
|
|
_soundMan = new DummySoundMan(this);
|
|
|
|
} else {
|
|
|
|
_disk = new AmigaDisk_br(this);
|
|
|
|
_disk->setLanguage(2); // NOTE: language is now hardcoded to English. Original used command-line parameters.
|
|
|
|
_soundMan = new AmigaSoundMan(this);
|
|
|
|
}
|
|
|
|
} else {
|
2007-07-29 14:24:31 +00:00
|
|
|
error("unknown game type");
|
2008-04-06 07:05:56 +00:00
|
|
|
}
|
2007-07-29 14:24:31 +00:00
|
|
|
|
|
|
|
|
2007-07-29 16:29:41 +00:00
|
|
|
initResources();
|
2007-08-11 17:25:57 +00:00
|
|
|
initFonts();
|
2007-08-11 21:08:08 +00:00
|
|
|
initCursors();
|
2007-08-26 09:01:19 +00:00
|
|
|
initOpcodes();
|
2008-05-10 11:11:03 +00:00
|
|
|
_locationParser = new LocationParser_br(this);
|
2008-06-03 00:49:27 +00:00
|
|
|
_locationParser->init();
|
2008-05-10 11:11:03 +00:00
|
|
|
_programParser = new ProgramParser_br(this);
|
2008-06-03 00:49:27 +00:00
|
|
|
_programParser->init();
|
2007-08-26 09:01:19 +00:00
|
|
|
|
2007-08-12 13:10:04 +00:00
|
|
|
_part = -1;
|
|
|
|
|
2008-07-04 00:29:21 +00:00
|
|
|
_subtitle[0] = -1;
|
|
|
|
_subtitle[1] = -1;
|
|
|
|
|
2007-07-29 14:24:31 +00:00
|
|
|
Parallaction::init();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-08-11 17:25:57 +00:00
|
|
|
Parallaction_br::~Parallaction_br() {
|
|
|
|
freeFonts();
|
2007-08-11 21:08:08 +00:00
|
|
|
|
|
|
|
delete _dinoCursor;
|
|
|
|
delete _dougCursor;
|
|
|
|
delete _donnaCursor;
|
|
|
|
|
2007-08-11 17:25:57 +00:00
|
|
|
}
|
|
|
|
|
2007-07-29 18:49:24 +00:00
|
|
|
void Parallaction_br::callFunction(uint index, void* parm) {
|
|
|
|
assert(index < 6); // magic value 6 is maximum # of callables for Big Red Adventure
|
|
|
|
|
|
|
|
(this->*_callables[index])(parm);
|
|
|
|
}
|
|
|
|
|
2007-08-09 19:26:20 +00:00
|
|
|
int Parallaction_br::go() {
|
|
|
|
|
2008-02-05 10:24:22 +00:00
|
|
|
guiSplash("dyna");
|
|
|
|
guiSplash("core");
|
|
|
|
|
2007-08-12 13:10:04 +00:00
|
|
|
while ((_engineFlags & kEngineQuit) == 0) {
|
|
|
|
|
2008-02-02 12:36:06 +00:00
|
|
|
guiStart();
|
2007-08-12 13:10:04 +00:00
|
|
|
|
2008-06-02 21:08:49 +00:00
|
|
|
if (_engineFlags & kEngineQuit)
|
|
|
|
return 0;
|
|
|
|
|
2008-02-02 12:36:06 +00:00
|
|
|
// initCharacter();
|
2007-08-12 13:10:04 +00:00
|
|
|
|
2008-05-14 14:34:01 +00:00
|
|
|
_input->_inputMode = Input::kInputModeGame;
|
2008-02-05 10:24:22 +00:00
|
|
|
while ((_engineFlags & (kEngineReturn | kEngineQuit)) == 0) {
|
|
|
|
runGame();
|
|
|
|
}
|
|
|
|
_engineFlags &= ~kEngineReturn;
|
2007-08-11 19:08:32 +00:00
|
|
|
|
2007-08-12 13:10:04 +00:00
|
|
|
freePart();
|
|
|
|
// freeCharacter();
|
|
|
|
|
|
|
|
}
|
2007-08-11 19:08:32 +00:00
|
|
|
|
2007-08-09 19:26:20 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-08-11 19:08:32 +00:00
|
|
|
|
2007-08-11 17:25:57 +00:00
|
|
|
|
|
|
|
void Parallaction_br::freeFonts() {
|
|
|
|
|
|
|
|
delete _menuFont;
|
|
|
|
delete _dialogueFont;
|
|
|
|
|
|
|
|
return;
|
2007-08-11 20:44:22 +00:00
|
|
|
}
|
|
|
|
|
2007-08-11 21:08:08 +00:00
|
|
|
void Parallaction_br::initCursors() {
|
|
|
|
|
2008-04-06 07:05:56 +00:00
|
|
|
if (getPlatform() == Common::kPlatformPC) {
|
|
|
|
_dinoCursor = _disk->loadPointer("pointer1");
|
|
|
|
_dougCursor = _disk->loadPointer("pointer2");
|
|
|
|
_donnaCursor = _disk->loadPointer("pointer3");
|
2007-08-11 20:44:22 +00:00
|
|
|
|
2008-04-06 07:05:56 +00:00
|
|
|
_mouseArrow = _donnaCursor;
|
|
|
|
} else {
|
|
|
|
// TODO: Where are the Amiga cursors?
|
|
|
|
}
|
2007-08-11 20:44:22 +00:00
|
|
|
|
2007-08-11 21:08:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Parallaction_br::setMousePointer(int16 index) {
|
2008-04-06 07:05:56 +00:00
|
|
|
// FIXME: Where are the Amiga cursors?
|
|
|
|
if (getPlatform() == Common::kPlatformAmiga)
|
|
|
|
return;
|
2007-08-11 21:08:08 +00:00
|
|
|
|
2007-11-22 21:51:33 +00:00
|
|
|
Common::Rect r;
|
|
|
|
_mouseArrow->getRect(0, r);
|
|
|
|
|
|
|
|
_system->setMouseCursor(_mouseArrow->getData(0), r.width(), r.height(), 0, 0, 0);
|
2007-08-11 21:08:08 +00:00
|
|
|
_system->showMouse(true);
|
2007-08-11 20:44:22 +00:00
|
|
|
|
2007-08-11 17:25:57 +00:00
|
|
|
}
|
|
|
|
|
2007-08-12 13:10:04 +00:00
|
|
|
void Parallaction_br::initPart() {
|
|
|
|
|
2007-08-24 20:14:51 +00:00
|
|
|
memset(_counters, 0, ARRAYSIZE(_counters));
|
|
|
|
|
2007-08-12 13:27:48 +00:00
|
|
|
_globalTable = _disk->loadTable("global");
|
|
|
|
_objectsNames = _disk->loadTable("objects");
|
|
|
|
_countersNames = _disk->loadTable("counters");
|
|
|
|
|
|
|
|
// _disk->loadObjects("icone.ico");
|
2007-08-12 13:10:04 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Parallaction_br::freePart() {
|
|
|
|
|
2007-08-12 13:27:48 +00:00
|
|
|
delete _globalTable;
|
|
|
|
delete _objectsNames;
|
|
|
|
delete _countersNames;
|
2007-08-12 13:10:04 +00:00
|
|
|
|
2007-11-18 13:22:38 +00:00
|
|
|
_globalTable = 0;
|
|
|
|
_objectsNames = 0;
|
|
|
|
_countersNames = 0;
|
2007-08-12 13:10:04 +00:00
|
|
|
}
|
|
|
|
|
2007-08-12 13:54:01 +00:00
|
|
|
void Parallaction_br::startPart() {
|
|
|
|
|
|
|
|
initPart();
|
|
|
|
|
|
|
|
strcpy(_location._name, partFirstLocation[_part]);
|
|
|
|
|
|
|
|
parseLocation("common");
|
2008-02-02 21:22:05 +00:00
|
|
|
changeLocation(_location._name);
|
|
|
|
|
2007-08-12 13:54:01 +00:00
|
|
|
}
|
|
|
|
|
2008-02-02 22:45:31 +00:00
|
|
|
void Parallaction_br::runPendingZones() {
|
2008-04-06 05:40:02 +00:00
|
|
|
ZonePtr z;
|
2008-02-02 22:45:31 +00:00
|
|
|
|
|
|
|
if (_activeZone) {
|
|
|
|
z = _activeZone; // speak Zone or sound
|
2008-04-06 05:40:02 +00:00
|
|
|
_activeZone = nullZonePtr;
|
2008-06-04 09:07:55 +00:00
|
|
|
runZone(z); // FIXME: BRA doesn't handle sound yet
|
2008-02-02 22:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_activeZone2) {
|
|
|
|
z = _activeZone2; // speak Zone or sound
|
2008-04-06 05:40:02 +00:00
|
|
|
_activeZone2 = nullZonePtr;
|
2008-02-02 22:45:31 +00:00
|
|
|
runZone(z);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-25 20:34:10 +00:00
|
|
|
void Parallaction_br::changeLocation(char *location) {
|
|
|
|
|
2008-02-02 22:45:31 +00:00
|
|
|
// free open location stuff
|
|
|
|
clearSubtitles();
|
2008-02-03 10:48:07 +00:00
|
|
|
freeBackground();
|
2008-07-09 10:52:46 +00:00
|
|
|
_gfx->clearGfxObjects(kGfxObjNormal | kGfxObjCharacter);
|
2008-05-05 11:02:40 +00:00
|
|
|
_location._programs.clear();
|
2008-02-03 10:48:07 +00:00
|
|
|
freeZones();
|
2008-02-03 11:00:55 +00:00
|
|
|
freeAnimations();
|
2008-02-03 10:48:07 +00:00
|
|
|
// free(_location._comment);
|
|
|
|
// _location._comment = 0;
|
|
|
|
// _location._commands.clear();
|
|
|
|
// _location._aCommands.clear();
|
2008-02-02 21:22:05 +00:00
|
|
|
|
|
|
|
|
2008-02-02 22:45:31 +00:00
|
|
|
// load new location
|
|
|
|
parseLocation(location);
|
|
|
|
runCommands(_location._commands);
|
|
|
|
// doLocationEnterTransition();
|
2008-02-02 21:22:05 +00:00
|
|
|
runCommands(_location._aCommands);
|
|
|
|
|
2008-02-02 22:45:31 +00:00
|
|
|
_engineFlags &= ~kEngineChangeLocation;
|
2007-08-25 20:34:10 +00:00
|
|
|
}
|
|
|
|
|
2008-05-09 01:35:43 +00:00
|
|
|
|
|
|
|
// FIXME: Parallaction_br::parseLocation() is now a verbatim copy of the same routine from Parallaction_ns.
|
|
|
|
void Parallaction_br::parseLocation(const char *filename) {
|
|
|
|
debugC(1, kDebugParser, "parseLocation('%s')", filename);
|
|
|
|
|
|
|
|
allocateLocationSlot(filename);
|
|
|
|
Script *script = _disk->loadLocation(filename);
|
|
|
|
|
|
|
|
_locationParser->parse(script);
|
|
|
|
delete script;
|
|
|
|
|
|
|
|
// this loads animation scripts
|
|
|
|
AnimationList::iterator it = _vm->_location._animations.begin();
|
|
|
|
for ( ; it != _vm->_location._animations.end(); it++) {
|
|
|
|
if ((*it)->_scriptName) {
|
|
|
|
loadProgram(*it, (*it)->_scriptName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
debugC(1, kDebugParser, "parseLocation('%s') done", filename);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-06-03 00:49:27 +00:00
|
|
|
void Parallaction_br::loadProgram(AnimationPtr a, const char *filename) {
|
|
|
|
debugC(1, kDebugParser, "loadProgram(Animation: %s, script: %s)", a->_name, filename);
|
|
|
|
|
|
|
|
Script *script = _disk->loadScript(filename);
|
|
|
|
ProgramPtr program(new Program);
|
|
|
|
program->_anim = a;
|
|
|
|
|
|
|
|
_programParser->parse(script, program);
|
|
|
|
|
|
|
|
delete script;
|
|
|
|
|
|
|
|
_vm->_location._programs.push_back(program);
|
|
|
|
|
|
|
|
debugC(1, kDebugParser, "loadProgram() done");
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-09 01:35:43 +00:00
|
|
|
|
2007-08-25 20:34:10 +00:00
|
|
|
void Parallaction_br::changeCharacter(const char *name) {
|
2008-06-04 09:07:55 +00:00
|
|
|
const char *charName = _char.getName();
|
2008-06-04 09:39:38 +00:00
|
|
|
if (!scumm_stricmp(charName, name)) {
|
2008-06-04 09:07:55 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-08-25 20:34:10 +00:00
|
|
|
|
2008-06-04 09:07:55 +00:00
|
|
|
_char.setName(name);
|
|
|
|
_char._talk = _disk->loadTalk(name);
|
2007-08-25 20:34:10 +00:00
|
|
|
}
|
|
|
|
|
2007-09-23 20:17:50 +00:00
|
|
|
|
|
|
|
void Parallaction_br::setArrowCursor() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Parallaction_br::setInventoryCursor(int pos) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-07-29 14:24:31 +00:00
|
|
|
} // namespace Parallaction
|