diff options
-rw-r--r-- | engines/parallaction/callables_ns.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/dialogue.cpp | 6 | ||||
-rw-r--r-- | engines/parallaction/exec_br.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/exec_ns.cpp | 26 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 30 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 4 | ||||
-rw-r--r-- | engines/parallaction/parallaction_ns.cpp | 8 | ||||
-rw-r--r-- | engines/parallaction/parser_br.cpp | 172 | ||||
-rw-r--r-- | engines/parallaction/parser_ns.cpp | 265 | ||||
-rw-r--r-- | engines/parallaction/sound.cpp | 6 |
10 files changed, 369 insertions, 154 deletions
diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp index faddecd874..8f5c80fc0c 100644 --- a/engines/parallaction/callables_ns.cpp +++ b/engines/parallaction/callables_ns.cpp @@ -519,7 +519,7 @@ void Parallaction_ns::_c_endIntro(void *parm) { _gfx->setFont(_menuFont); - debugC(1, kDebugLocation, "endIntro()"); + debugC(1, kDebugExec, "endIntro()"); for (uint16 _si = 0; _si < 6; _si++) { _gfx->displayCenteredString(80, _credits[_si]._role); @@ -538,7 +538,7 @@ void Parallaction_ns::_c_endIntro(void *parm) { _gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); } - debugC(1, kDebugLocation, "endIntro(): done showing credits"); + debugC(1, kDebugExec, "endIntro(): done showing credits"); if ((getFeatures() & GF_DEMO) == 0) { _gfx->displayCenteredString(80, "CLICK MOUSE BUTTON TO START"); diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index 7539d89368..15a280d3be 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -103,7 +103,7 @@ protected: }; uint16 DialogueManager::askPassword() { - debugC(1, kDebugDialogue, "checkDialoguePassword()"); + debugC(3, kDebugExec, "checkDialoguePassword()"); char password[100]; uint16 passwordLen; @@ -241,7 +241,7 @@ uint16 DialogueManager::getAnswer() { clear(); - debugC(1, kDebugDialogue, "runDialogue: user selected answer #%i", answer); + debugC(3, kDebugExec, "runDialogue: user selected answer #%i", answer); return answer; } @@ -361,7 +361,7 @@ int16 DialogueManager::getHoverAnswer(int16 x, int16 y) { void Parallaction::runDialogue(SpeakData *data) { - debugC(1, kDebugDialogue, "runDialogue: starting dialogue '%s'", data->_name); + debugC(1, kDebugExec, "runDialogue: starting dialogue '%s'", data->_name); _gfx->setFont(_dialogueFont); diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp index 21064d30f4..7862a4a0c6 100644 --- a/engines/parallaction/exec_br.cpp +++ b/engines/parallaction/exec_br.cpp @@ -46,7 +46,7 @@ typedef OpcodeImpl<Parallaction_br> OpcodeV2; #define DECLARE_INSTRUCTION_OPCODE(op) void Parallaction_br::instOp_##op() void Parallaction_br::setupSubtitles(char *s, char *s2, int y) { - debugC(5, kDebugLocation, "setupSubtitles(%s, %s, %i)", s, s2, y); + debugC(5, kDebugExec, "setupSubtitles(%s, %s, %i)", s, s2, y); if (!scumm_stricmp("clear", s)) { diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp index 7bf9c69332..2b88469702 100644 --- a/engines/parallaction/exec_ns.cpp +++ b/engines/parallaction/exec_ns.cpp @@ -359,7 +359,7 @@ void Parallaction_ns::jobDisplayAnimations(void *parm, Job *j) { else _si = _gfx->queryMask(v18->_top + v18->height()); - debugC(9, kDebugLocation, "jobDisplayAnimations(%s, x:%i, y:%i, z:%i, w:%i, h:%i, f:%i/%i, %p)", v18->_label._text, v18->_left, v18->_top, _si, v14.w, v14.h, + debugC(9, kDebugExec, "jobDisplayAnimations(%s, x:%i, y:%i, z:%i, w:%i, h:%i, f:%i/%i, %p)", v18->_label._text, v18->_left, v18->_top, _si, v14.w, v14.h, frame, v18->getFrameNum(), v14.pixels); _gfx->blitCnv(&v14, v18->_left, v18->_top, _si, Gfx::kBitBack); @@ -381,7 +381,7 @@ void Parallaction_ns::jobDisplayAnimations(void *parm, Job *j) { void Parallaction_ns::jobEraseAnimations(void *arg_0, Job *j) { - debugC(3, kDebugJobs, "jobEraseAnimations"); + debugC(9, kDebugExec, "jobEraseAnimations"); for (AnimationList::iterator it = _animations.begin(); it != _animations.end(); it++) { @@ -405,7 +405,7 @@ void Parallaction_ns::jobEraseAnimations(void *arg_0, Job *j) { void Parallaction_ns::jobRunScripts(void *parm, Job *j) { - debugC(3, kDebugJobs, "jobRunScripts"); + debugC(9, kDebugExec, "jobRunScripts"); static uint16 modCounter = 0; @@ -422,7 +422,7 @@ void Parallaction_ns::jobRunScripts(void *parm, Job *j) { InstructionList::iterator inst = a->_program->_ip; while (((*inst)->_index != INST_SHOW) && (a->_flags & kFlagsActing)) { - debugC(9, kDebugJobs, "Animation: %s, instruction: %s", a->_label._text, _instructionNamesRes[(*inst)->_index - 1]); + debugC(9, kDebugExec, "Animation: %s, instruction: %s", a->_label._text, _instructionNamesRes[(*inst)->_index - 1]); _instRunCtxt.inst = inst; _instRunCtxt.a = a; @@ -454,7 +454,7 @@ label1: void Parallaction::runCommands(CommandList& list, Zone *z) { - debugC(1, kDebugLocation, "runCommands"); + debugC(3, kDebugExec, "runCommands"); CommandList::iterator it = list.begin(); for ( ; it != list.end(); it++) { @@ -472,7 +472,7 @@ void Parallaction::runCommands(CommandList& list, Zone *z) { if ((cmd->_flagsOn & v8) != cmd->_flagsOn) continue; if ((cmd->_flagsOff & ~v8) != cmd->_flagsOff) continue; - debugC(1, kDebugLocation, "runCommands[%i]: %s (on: %x, off: %x)", cmd->_id, _commandsNamesRes[cmd->_id-1], cmd->_flagsOn, cmd->_flagsOff); + debugC(3, kDebugExec, "runCommands[%i]: %s (on: %x, off: %x)", cmd->_id, _commandsNamesRes[cmd->_id-1], cmd->_flagsOn, cmd->_flagsOff); _cmdRunCtxt.z = z; _cmdRunCtxt.cmd = cmd; @@ -480,7 +480,7 @@ void Parallaction::runCommands(CommandList& list, Zone *z) { (*_commandOpcodes[cmd->_id])(); } - debugC(1, kDebugLocation, "runCommands completed"); + debugC(3, kDebugExec, "runCommands completed"); return; @@ -567,11 +567,11 @@ void Parallaction::displayItemComment(ExamineData *data) { uint16 Parallaction::runZone(Zone *z) { - debugC(3, kDebugLocation, "runZone (%s)", z->_label._text); + debugC(3, kDebugExec, "runZone (%s)", z->_label._text); uint16 subtype = z->_type & 0xFFFF; - debugC(3, kDebugLocation, "type = %x, object = %x", subtype, (z->_type & 0xFFFF0000) >> 16); + debugC(3, kDebugExec, "type = %x, object = %x", subtype, (z->_type & 0xFFFF0000) >> 16); switch(subtype) { case kZoneExamine: @@ -607,7 +607,7 @@ uint16 Parallaction::runZone(Zone *z) { } - debugC(3, kDebugLocation, "runZone completed"); + debugC(3, kDebugExec, "runZone completed"); return 0; } @@ -856,7 +856,7 @@ void Parallaction_ns::initOpcodes() { void Parallaction_ns::jobDisplayLabel(void *parm, Job *j) { Label *label = (Label*)parm; - debugC(9, kDebugJobs, "jobDisplayLabel (%p)", (const void*) label); + debugC(9, kDebugExec, "jobDisplayLabel (%p)", (const void*) label); _gfx->drawLabel(*label); @@ -866,7 +866,7 @@ void Parallaction_ns::jobDisplayLabel(void *parm, Job *j) { void Parallaction_ns::jobEraseLabel(void *parm, Job *j) { Label *label = (Label*)parm; - debugC(9, kDebugJobs, "jobEraseLabel (%p)", (const void*) label); + debugC(9, kDebugExec, "jobEraseLabel (%p)", (const void*) label); int16 _si, _di; @@ -905,7 +905,7 @@ void Parallaction_ns::jobWaitRemoveJob(void *parm, Job *j) { static uint16 count = 0; - debugC(3, kDebugJobs, "jobWaitRemoveJob: count = %i", count); + debugC(9, kDebugExec, "jobWaitRemoveJob: count = %i", count); _engineFlags |= kEngineBlockInput; diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index f74fec578d..9b2ac2a6a1 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -105,11 +105,11 @@ Parallaction::Parallaction(OSystem *syst) : Common::File::addDefaultDirectory( _gameDataPath ); Common::addSpecialDebugLevel(kDebugDialogue, "dialogue", "Dialogues debug level"); - Common::addSpecialDebugLevel(kDebugLocation, "location", "Location debug level"); + Common::addSpecialDebugLevel(kDebugParser, "parser", "Parser debug level"); Common::addSpecialDebugLevel(kDebugDisk, "disk", "Disk debug level"); Common::addSpecialDebugLevel(kDebugWalk, "walk", "Walk debug level"); Common::addSpecialDebugLevel(kDebugGraphics, "gfx", "Gfx debug level"); - Common::addSpecialDebugLevel(kDebugJobs, "jobs", "Jobs debug level"); + Common::addSpecialDebugLevel(kDebugExec, "exec", "Execution debug level"); Common::addSpecialDebugLevel(kDebugInput, "input", "Input debug level"); Common::addSpecialDebugLevel(kDebugAudio, "audio", "Audio debug level"); Common::addSpecialDebugLevel(kDebugMenu, "menu", "Menu debug level"); @@ -652,7 +652,7 @@ void Parallaction::changeCursor(int32 index) { void Parallaction::freeCharacter() { - debugC(3, kDebugLocation, "freeCharacter()"); + debugC(1, kDebugExec, "freeCharacter()"); if (!IS_DUMMY_CHARACTER(_characterName)) { if (_objectsNames) @@ -689,7 +689,7 @@ int compareJobPriority(const JobPointer &j1, const JobPointer &j2) { } Job *Parallaction::addJob(uint functionId, void *parm, uint16 tag) { - debugC(3, kDebugJobs, "addJob(%i)", tag); + debugC(9, kDebugExec, "addJob(%i)", tag); Job *v8 = new Job; @@ -706,21 +706,21 @@ Job *Parallaction::addJob(uint functionId, void *parm, uint16 tag) { } void Parallaction::removeJob(Job *j) { - debugC(3, kDebugJobs, "addJob(%i)", j->_tag); + debugC(9, kDebugExec, "addJob(%i)", j->_tag); j->_finished = 1; return; } void Parallaction::pauseJobs() { - debugC(3, kDebugJobs, "pausing jobs execution"); + debugC(9, kDebugExec, "pausing jobs execution"); _engineFlags |= kEnginePauseJobs; return; } void Parallaction::resumeJobs() { - debugC(3, kDebugJobs, "resuming jobs execution"); + debugC(9, kDebugExec, "resuming jobs execution"); _engineFlags &= ~kEnginePauseJobs; return; @@ -742,7 +742,7 @@ void Parallaction::runJobs() { it = _jobs.begin(); while (it != _jobs.end()) { Job *job = (*it)->_job; - debugC(9, kDebugJobs, "runJobs: %i", job->_tag); + debugC(9, kDebugExec, "runJobs: %i", job->_tag); (*(*it))(); it++; } @@ -830,7 +830,7 @@ void Parallaction::parseStatement() { _lookup = _currentStatements->lookup(_tokens[0]); - debugC(9, kDebugLocation, "parseStatement: %s (lookup = %i)", _tokens[0], _lookup); + debugC(9, kDebugParser, "parseStatement: %s (lookup = %i)", _tokens[0], _lookup); (*(*_currentOpcodes)[_lookup])(); } @@ -896,7 +896,7 @@ void Parallaction::allocateLocationSlot(const char *name) { void Parallaction::freeLocation() { - debugC(7, kDebugLocation, "freeLocation"); + debugC(2, kDebugExec, "freeLocation"); _soundMan->stopSfx(0); _soundMan->stopSfx(1); @@ -1029,10 +1029,10 @@ void Parallaction::showSlide(const char *name) { // fades towards game palette // void Parallaction::doLocationEnterTransition() { - debugC(1, kDebugLocation, "doLocationEnterTransition"); + debugC(2, kDebugExec, "doLocationEnterTransition"); if (_localFlags[_currentLocationIndex] & kFlagsVisited) { - debugC(3, kDebugLocation, "skipping location transition"); + debugC(2, kDebugExec, "skipping location transition"); return; // visited } @@ -1060,7 +1060,7 @@ void Parallaction::doLocationEnterTransition() { _gfx->updateScreen(); } - debugC(1, kDebugLocation, "doLocationEnterTransition completed"); + debugC(2, kDebugExec, "doLocationEnterTransition completed"); return; } @@ -1078,7 +1078,7 @@ Zone *Parallaction::findZone(const char *name) { void Parallaction::freeZones() { - debugC(1, kDebugLocation, "freeZones: kEngineQuit = %i", _engineFlags & kEngineQuit); + debugC(2, kDebugExec, "freeZones: kEngineQuit = %i", _engineFlags & kEngineQuit); ZoneList::iterator it = _zones.begin(); @@ -1096,7 +1096,7 @@ void Parallaction::freeZones() { ))) && ((_engineFlags & kEngineQuit) == 0)) { - debugC(1, kDebugLocation, "freeZones preserving zone '%s'", z->_label._text); + debugC(2, kDebugExec, "freeZones preserving zone '%s'", z->_label._text); it++; diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 2c04bd4430..10d38e89d8 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -47,10 +47,10 @@ namespace Parallaction { enum { kDebugDisk = 1 << 0, kDebugWalk = 1 << 1, - kDebugLocation = 1 << 2, + kDebugParser = 1 << 2, kDebugDialogue = 1 << 3, kDebugGraphics = 1 << 4, - kDebugJobs = 1 << 5, + kDebugExec = 1 << 5, kDebugInput = 1 << 6, kDebugAudio = 1 << 7, kDebugMenu = 1 << 8 diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp index 6775553887..46161c5021 100644 --- a/engines/parallaction/parallaction_ns.cpp +++ b/engines/parallaction/parallaction_ns.cpp @@ -228,7 +228,7 @@ int Parallaction_ns::go() { is commented out, and would definitely crash the current implementation. */ void Parallaction_ns::changeLocation(char *location) { - debugC(1, kDebugLocation, "changeLocation(%s)", location); + debugC(1, kDebugExec, "changeLocation(%s)", location); _soundMan->playLocationMusic(location); @@ -323,14 +323,14 @@ void Parallaction_ns::changeLocation(char *location) { if (_hasLocationSound) _soundMan->playSfx(_locationSound, 0, true); - debugC(1, kDebugLocation, "changeLocation() done"); + debugC(1, kDebugExec, "changeLocation() done"); return; } void Parallaction_ns::changeCharacter(const char *name) { - debugC(1, kDebugLocation, "changeCharacter(%s)", name); + debugC(1, kDebugExec, "changeCharacter(%s)", name); char baseName[20]; if (IS_MINI_CHARACTER(name)) { @@ -374,7 +374,7 @@ void Parallaction_ns::changeCharacter(const char *name) { strcpy(_characterName1, fullName); - debugC(1, kDebugLocation, "changeCharacter() done"); + debugC(1, kDebugExec, "changeCharacter() done"); return; } diff --git a/engines/parallaction/parser_br.cpp b/engines/parallaction/parser_br.cpp index 673d3ed8f2..94f5b0d790 100644 --- a/engines/parallaction/parser_br.cpp +++ b/engines/parallaction/parser_br.cpp @@ -87,7 +87,9 @@ namespace Parallaction { #define DECLARE_LOCATION_PARSER(sig) void Parallaction_br::locParse_##sig() -DECLARE_LOCATION_PARSER(location) { +DECLARE_LOCATION_PARSER(location) { + debugC(7, kDebugParser, "LOCATION_PARSER(location) "); + strcpy(_location._name, _tokens[1]); bool flip = false; @@ -125,7 +127,9 @@ DECLARE_LOCATION_PARSER(location) { -DECLARE_LOCATION_PARSER(zone) { +DECLARE_LOCATION_PARSER(zone) { + debugC(7, kDebugParser, "LOCATION_PARSER(zone) "); + parseZone(*_locParseCtxt.script, _zones, _tokens[1]); _locParseCtxt.z->_index = _locParseCtxt.numZones++; @@ -139,7 +143,9 @@ DECLARE_LOCATION_PARSER(zone) { } -DECLARE_LOCATION_PARSER(animation) { +DECLARE_LOCATION_PARSER(animation) { + debugC(7, kDebugParser, "LOCATION_PARSER(animation) "); + parseAnimation(*_locParseCtxt.script, _animations, _tokens[1]); _locParseCtxt.a->_index = _locParseCtxt.numZones++; @@ -153,7 +159,9 @@ DECLARE_LOCATION_PARSER(animation) { } -DECLARE_LOCATION_PARSER(localflags) { +DECLARE_LOCATION_PARSER(localflags) { + debugC(7, kDebugParser, "LOCATION_PARSER(localflags) "); + int _si = 1; while (_tokens[_si][0] != '\0') { _localFlagNames->addData(_tokens[_si]); @@ -162,7 +170,9 @@ DECLARE_LOCATION_PARSER(localflags) { } -DECLARE_LOCATION_PARSER(flags) { +DECLARE_LOCATION_PARSER(flags) { + debugC(7, kDebugParser, "LOCATION_PARSER(flags) "); + if ((_localFlags[_currentLocationIndex] & kFlagsVisited) == 0) { // only for 1st visit _localFlags[_currentLocationIndex] = 0; @@ -180,46 +190,64 @@ DECLARE_LOCATION_PARSER(flags) { } -DECLARE_LOCATION_PARSER(comment) { +DECLARE_LOCATION_PARSER(comment) { + debugC(7, kDebugParser, "LOCATION_PARSER(comment) "); + _location._comment = parseComment(*_locParseCtxt.script); } -DECLARE_LOCATION_PARSER(endcomment) { +DECLARE_LOCATION_PARSER(endcomment) { + debugC(7, kDebugParser, "LOCATION_PARSER(endcomment) "); + _location._endComment = parseComment(*_locParseCtxt.script); } -DECLARE_LOCATION_PARSER(sound) { +DECLARE_LOCATION_PARSER(sound) { + debugC(7, kDebugParser, "LOCATION_PARSER(sound) "); + // _soundMan->loadSound(_tokens[1]); } -DECLARE_LOCATION_PARSER(music) { +DECLARE_LOCATION_PARSER(music) { + debugC(7, kDebugParser, "LOCATION_PARSER(music) "); + // _soundMan->loadMusic(_tokens[1]); } -DECLARE_LOCATION_PARSER(redundant) { +DECLARE_LOCATION_PARSER(redundant) { + debugC(7, kDebugParser, "LOCATION_PARSER(redundant) "); + warning("redundant '%s' line found in script '%s'", _tokens[0], _locParseCtxt.filename); } -DECLARE_LOCATION_PARSER(character) { +DECLARE_LOCATION_PARSER(character) { + debugC(7, kDebugParser, "LOCATION_PARSER(character) "); + // changeCharacter(character); } -DECLARE_LOCATION_PARSER(ifchar) { +DECLARE_LOCATION_PARSER(ifchar) { + debugC(7, kDebugParser, "LOCATION_PARSER(ifchar) "); + skip(_locParseCtxt.script, "ENDIF"); } -DECLARE_LOCATION_PARSER(null) { +DECLARE_LOCATION_PARSER(null) { + debugC(7, kDebugParser, "LOCATION_PARSER(null) "); + } -DECLARE_LOCATION_PARSER(mask) { +DECLARE_LOCATION_PARSER(mask) { + debugC(7, kDebugParser, "LOCATION_PARSER(mask) "); + _disk->loadScenery(*_backgroundInfo, NULL, _tokens[1], NULL); _gfx->setMask(&_backgroundInfo->mask); @@ -229,18 +257,24 @@ DECLARE_LOCATION_PARSER(mask) { } -DECLARE_LOCATION_PARSER(path) { +DECLARE_LOCATION_PARSER(path) { + debugC(7, kDebugParser, "LOCATION_PARSER(path) "); + _disk->loadScenery(*_backgroundInfo, NULL, NULL, _tokens[1]); _pathBuffer = &_backgroundInfo->path; } -DECLARE_LOCATION_PARSER(escape) { +DECLARE_LOCATION_PARSER(escape) { + debugC(7, kDebugParser, "LOCATION_PARSER(escape) "); + parseCommands(*_locParseCtxt.script, _location._escapeCommands); } -DECLARE_LOCATION_PARSER(zeta) { +DECLARE_LOCATION_PARSER(zeta) { + debugC(7, kDebugParser, "LOCATION_PARSER(zeta) "); + _zeta0 = atoi(_tokens[1]); _zeta1 = atoi(_tokens[2]); @@ -251,18 +285,24 @@ DECLARE_LOCATION_PARSER(zeta) { } } -DECLARE_COMMAND_PARSER(ifchar) { +DECLARE_COMMAND_PARSER(ifchar) { + debugC(7, kDebugParser, "COMMAND_PARSER(ifchar) "); + if (!scumm_stricmp(_characterName, _tokens[1])) skip(_locParseCtxt.script, "endif"); } -DECLARE_COMMAND_PARSER(endif) { +DECLARE_COMMAND_PARSER(endif) { + debugC(7, kDebugParser, "COMMAND_PARSER(endif) "); + } -DECLARE_COMMAND_PARSER(location) { +DECLARE_COMMAND_PARSER(location) { + debugC(7, kDebugParser, "COMMAND_PARSER(location) "); + createCommand(_lookup); _locParseCtxt.cmd->u._string = strdup(_tokens[1]); @@ -287,7 +327,9 @@ DECLARE_COMMAND_PARSER(location) { } -DECLARE_COMMAND_PARSER(string) { +DECLARE_COMMAND_PARSER(string) { + debugC(7, kDebugParser, "COMMAND_PARSER(string) "); + createCommand(_lookup); _locParseCtxt.cmd->u._string = strdup(_tokens[1]); @@ -297,7 +339,9 @@ DECLARE_COMMAND_PARSER(string) { addCommand(); } -DECLARE_COMMAND_PARSER(math) { +DECLARE_COMMAND_PARSER(math) { + debugC(7, kDebugParser, "COMMAND_PARSER(math) "); + createCommand(_lookup); _locParseCtxt.cmd->u._lvalue = _countersNames->lookup(_tokens[1]); @@ -310,7 +354,9 @@ DECLARE_COMMAND_PARSER(math) { } -DECLARE_COMMAND_PARSER(test) { +DECLARE_COMMAND_PARSER(test) { + debugC(7, kDebugParser, "COMMAND_PARSER(test) "); + createCommand(_lookup); uint counter = _countersNames->lookup(_tokens[1]); @@ -341,7 +387,9 @@ DECLARE_COMMAND_PARSER(test) { } -DECLARE_COMMAND_PARSER(music) { +DECLARE_COMMAND_PARSER(music) { + debugC(7, kDebugParser, "COMMAND_PARSER(music) "); + createCommand(_lookup); _locParseCtxt.cmd->u._musicCommand = _audioCommandsNames->lookup(_tokens[1]); @@ -357,7 +405,9 @@ DECLARE_COMMAND_PARSER(music) { } -DECLARE_COMMAND_PARSER(zone) { +DECLARE_COMMAND_PARSER(zone) { + debugC(7, kDebugParser, "COMMAND_PARSER(zone) "); + createCommand(_lookup); _locParseCtxt.cmd->u._zone = findZone(_tokens[_locParseCtxt.nextToken]); @@ -374,7 +424,9 @@ DECLARE_COMMAND_PARSER(zone) { } -DECLARE_COMMAND_PARSER(zeta) { +DECLARE_COMMAND_PARSER(zeta) { + debugC(7, kDebugParser, "COMMAND_PARSER(zeta) "); + createCommand(_lookup); _locParseCtxt.cmd->u._zeta0 = atoi(_tokens[1]); @@ -394,7 +446,9 @@ DECLARE_COMMAND_PARSER(zeta) { } -DECLARE_COMMAND_PARSER(give) { +DECLARE_COMMAND_PARSER(give) { + debugC(7, kDebugParser, "COMMAND_PARSER(give) "); + createCommand(_lookup); _locParseCtxt.cmd->u._object = 4 + atoi(_tokens[1]); @@ -418,7 +472,9 @@ DECLARE_COMMAND_PARSER(give) { } -DECLARE_COMMAND_PARSER(text) { +DECLARE_COMMAND_PARSER(text) { + debugC(7, kDebugParser, "COMMAND_PARSER(text) "); + createCommand(_lookup); if (isdigit(_tokens[1][1])) { @@ -442,7 +498,9 @@ DECLARE_COMMAND_PARSER(text) { } -DECLARE_COMMAND_PARSER(unary) { +DECLARE_COMMAND_PARSER(unary) { + debugC(7, kDebugParser, "COMMAND_PARSER(unary) "); + createCommand(_lookup); _locParseCtxt.cmd->u._rvalue = atoi(_tokens[1]); @@ -453,7 +511,9 @@ DECLARE_COMMAND_PARSER(unary) { } -DECLARE_ZONE_PARSER(limits) { +DECLARE_ZONE_PARSER(limits) { + debugC(7, kDebugParser, "ZONE_PARSER(limits) "); + if (isalpha(_tokens[1][1])) { _locParseCtxt.z->_flags |= kFlagsAnimLinked; _locParseCtxt.z->_linkedAnim = findAnimation(_tokens[1]); @@ -467,14 +527,18 @@ DECLARE_ZONE_PARSER(limits) { } -DECLARE_ZONE_PARSER(moveto) { +DECLARE_ZONE_PARSER(moveto) { + debugC(7, kDebugParser, "ZONE_PARSER(moveto) "); + _locParseCtxt.z->_moveTo.x = atoi(_tokens[1]); _locParseCtxt.z->_moveTo.y = atoi(_tokens[2]); // _locParseCtxt.z->_moveTo.z = atoi(_tokens[3]); } -DECLARE_ZONE_PARSER(type) { +DECLARE_ZONE_PARSER(type) { + debugC(7, kDebugParser, "ZONE_PARSER(type) "); + if (_tokens[2][0] != '\0') { _locParseCtxt.z->_type = (4 + _objectsNames->lookup(_tokens[2])) << 16; } @@ -492,12 +556,16 @@ DECLARE_ZONE_PARSER(type) { } -DECLARE_ANIM_PARSER(file) { +DECLARE_ANIM_PARSER(file) { + debugC(7, kDebugParser, "ANIM_PARSER(file) "); + _locParseCtxt.a->_cnv = _disk->loadFrames(_tokens[1]); } -DECLARE_ANIM_PARSER(position) { +DECLARE_ANIM_PARSER(position) { + debugC(7, kDebugParser, "ANIM_PARSER(position) "); + _locParseCtxt.a->_left = atoi(_tokens[1]); _locParseCtxt.a->_top = atoi(_tokens[2]); _locParseCtxt.a->_z = atoi(_tokens[3]); @@ -505,14 +573,18 @@ DECLARE_ANIM_PARSER(position) { } -DECLARE_ANIM_PARSER(moveto) { +DECLARE_ANIM_PARSER(moveto) { + debugC(7, kDebugParser, "ANIM_PARSER(moveto) "); + _locParseCtxt.a->_moveTo.x = atoi(_tokens[1]); _locParseCtxt.a->_moveTo.y = atoi(_tokens[2]); // _locParseCtxt.a->_moveTo.z = atoi(_tokens[3]); } -DECLARE_ANIM_PARSER(endanimation) { +DECLARE_ANIM_PARSER(endanimation) { + debugC(7, kDebugParser, "ANIM_PARSER(endanimation) "); + if (_locParseCtxt.a->_cnv) { _locParseCtxt.a->_right = _locParseCtxt.a->width(); @@ -536,13 +608,17 @@ DECLARE_ANIM_PARSER(endanimation) { -DECLARE_INSTRUCTION_PARSER(zone) { +DECLARE_INSTRUCTION_PARSER(zone) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(zone) "); + _instParseCtxt.inst->_z = findZone(_tokens[1]); } -DECLARE_INSTRUCTION_PARSER(color) { +DECLARE_INSTRUCTION_PARSER(color) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(color) "); + parseRValue(_instParseCtxt.inst->_opB, _tokens[1]); @@ -553,7 +629,9 @@ DECLARE_INSTRUCTION_PARSER(color) { } -DECLARE_INSTRUCTION_PARSER(mask) { +DECLARE_INSTRUCTION_PARSER(mask) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(mask) "); + parseRValue(_instParseCtxt.inst->_opA, _tokens[1]); parseRValue(_instParseCtxt.inst->_opB, _tokens[2]); @@ -562,12 +640,16 @@ DECLARE_INSTRUCTION_PARSER(mask) { } -DECLARE_INSTRUCTION_PARSER(print) { +DECLARE_INSTRUCTION_PARSER(print) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(print) "); + parseRValue(_instParseCtxt.inst->_opB, _tokens[1]); } -DECLARE_INSTRUCTION_PARSER(text) { +DECLARE_INSTRUCTION_PARSER(text) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(text) "); + int _si = 1; @@ -588,7 +670,9 @@ DECLARE_INSTRUCTION_PARSER(text) { } -DECLARE_INSTRUCTION_PARSER(if_op) { +DECLARE_INSTRUCTION_PARSER(if_op) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(if_op) "); + if (_instParseCtxt.openIf) error("cannot nest 'if' blocks"); @@ -612,7 +696,9 @@ DECLARE_INSTRUCTION_PARSER(if_op) { } -DECLARE_INSTRUCTION_PARSER(endif) { +DECLARE_INSTRUCTION_PARSER(endif) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(endif) "); + if (_instParseCtxt.openIf == 0) error("unexpected 'endif'"); diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp index 8332f05dc7..78c0e00b3f 100644 --- a/engines/parallaction/parser_ns.cpp +++ b/engines/parallaction/parser_ns.cpp @@ -77,22 +77,30 @@ namespace Parallaction { -DECLARE_ANIM_PARSER(invalid) { +DECLARE_ANIM_PARSER(invalid) { + debugC(7, kDebugParser, "ANIM_PARSER(invalid) "); + error("unknown statement '%s' in animation %s", _tokens[0], _locParseCtxt.a->_label._text); } -DECLARE_ANIM_PARSER(script) { +DECLARE_ANIM_PARSER(script) { + debugC(7, kDebugParser, "ANIM_PARSER(script) "); + _locParseCtxt.a->_scriptName = strdup(_tokens[1]); } -DECLARE_ANIM_PARSER(commands) { +DECLARE_ANIM_PARSER(commands) { + debugC(7, kDebugParser, "ANIM_PARSER(commands) "); + parseCommands(*_locParseCtxt.script, _locParseCtxt.a->_commands); } -DECLARE_ANIM_PARSER(type) { +DECLARE_ANIM_PARSER(type) { + debugC(7, kDebugParser, "ANIM_PARSER(type) "); + if (_tokens[2][0] != '\0') { _locParseCtxt.a->_type = ((4 + _objectsNames->lookup(_tokens[2])) << 16) & 0xFFFF0000; } @@ -113,12 +121,16 @@ DECLARE_ANIM_PARSER(type) { } -DECLARE_ANIM_PARSER(label) { +DECLARE_ANIM_PARSER(label) { + debugC(7, kDebugParser, "ANIM_PARSER(label) "); + renderLabel(&_locParseCtxt.a->_label._cnv, _tokens[1]); } -DECLARE_ANIM_PARSER(flags) { +DECLARE_ANIM_PARSER(flags) { + debugC(7, kDebugParser, "ANIM_PARSER(flags) "); + uint16 _si = 1; do { @@ -129,7 +141,9 @@ DECLARE_ANIM_PARSER(flags) { } -DECLARE_ANIM_PARSER(file) { +DECLARE_ANIM_PARSER(file) { + debugC(7, kDebugParser, "ANIM_PARSER(file) "); + char vC8[200]; strcpy(vC8, _tokens[1]); if (_engineFlags & kEngineTransformedDonna) { @@ -141,20 +155,26 @@ DECLARE_ANIM_PARSER(file) { } -DECLARE_ANIM_PARSER(position) { +DECLARE_ANIM_PARSER(position) { + debugC(7, kDebugParser, "ANIM_PARSER(position) "); + _locParseCtxt.a->_left = atoi(_tokens[1]); _locParseCtxt.a->_top = atoi(_tokens[2]); _locParseCtxt.a->_z = atoi(_tokens[3]); } -DECLARE_ANIM_PARSER(moveto) { +DECLARE_ANIM_PARSER(moveto) { + debugC(7, kDebugParser, "ANIM_PARSER(moveto) "); + _locParseCtxt.a->_moveTo.x = atoi(_tokens[1]); _locParseCtxt.a->_moveTo.y = atoi(_tokens[2]); } -DECLARE_ANIM_PARSER(endanimation) { +DECLARE_ANIM_PARSER(endanimation) { + debugC(7, kDebugParser, "ANIM_PARSER(endanimation) "); + _locParseCtxt.a->_oldPos.x = -1000; _locParseCtxt.a->_oldPos.y = -1000; @@ -165,7 +185,7 @@ DECLARE_ANIM_PARSER(endanimation) { } Animation *Parallaction_ns::parseAnimation(Script& script, AnimationList &list, char *name) { -// printf("parseAnimation(%s)\n", name); + debugC(5, kDebugParser, "parseAnimation(name: %s)", name); Animation *a = new Animation; @@ -207,7 +227,7 @@ void Parallaction_ns::parseInstruction(Animation *a, LocalVariable *locals) { } void Parallaction_ns::loadProgram(Animation *a, const char *filename) { -// printf("loadProgram(%s)\n", filename); + debugC(1, kDebugParser, "loadProgram(Animation: %s, script: %s)", a->_label._text, filename); Script *script = _disk->loadScript(filename); @@ -226,10 +246,14 @@ void Parallaction_ns::loadProgram(Animation *a, const char *filename) { delete script; + debugC(1, kDebugParser, "loadProgram() done"); + return; } -DECLARE_INSTRUCTION_PARSER(animation) { +DECLARE_INSTRUCTION_PARSER(animation) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(animation) "); + if (!scumm_stricmp(_tokens[1], _instParseCtxt.a->_label._text)) { _instParseCtxt.inst->_a = _instParseCtxt.a; } else { @@ -238,36 +262,48 @@ DECLARE_INSTRUCTION_PARSER(animation) { } -DECLARE_INSTRUCTION_PARSER(loop) { +DECLARE_INSTRUCTION_PARSER(loop) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(loop) "); + parseRValue(_instParseCtxt.inst->_opB, _tokens[1]); } -DECLARE_INSTRUCTION_PARSER(x) { +DECLARE_INSTRUCTION_PARSER(x) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(x) "); + parseLValue(_instParseCtxt.inst->_opA, "X"); parseRValue(_instParseCtxt.inst->_opB, _tokens[1]); } -DECLARE_INSTRUCTION_PARSER(y) { +DECLARE_INSTRUCTION_PARSER(y) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(y) "); + parseLValue(_instParseCtxt.inst->_opA, "Y"); parseRValue(_instParseCtxt.inst->_opB, _tokens[1]); } -DECLARE_INSTRUCTION_PARSER(z) { +DECLARE_INSTRUCTION_PARSER(z) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(z) "); + parseLValue(_instParseCtxt.inst->_opA, "Z"); parseRValue(_instParseCtxt.inst->_opB, _tokens[1]); } -DECLARE_INSTRUCTION_PARSER(f) { +DECLARE_INSTRUCTION_PARSER(f) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(f) "); + parseLValue(_instParseCtxt.inst->_opA, "F"); parseRValue(_instParseCtxt.inst->_opB, _tokens[1]); } -DECLARE_INSTRUCTION_PARSER(inc) { +DECLARE_INSTRUCTION_PARSER(inc) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(inc) "); + parseLValue(_instParseCtxt.inst->_opA, _tokens[1]); parseRValue(_instParseCtxt.inst->_opB, _tokens[2]); @@ -277,7 +313,9 @@ DECLARE_INSTRUCTION_PARSER(inc) { } -DECLARE_INSTRUCTION_PARSER(set) { +DECLARE_INSTRUCTION_PARSER(set) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(set) "); + // WORKAROUND: At least one script (balzo.script) in Amiga versions didn't declare // local variables before using them, thus leading to crashes. The line launching the // script was commented out on Dos version. This workaround enables the engine @@ -292,13 +330,17 @@ DECLARE_INSTRUCTION_PARSER(set) { } -DECLARE_INSTRUCTION_PARSER(move) { +DECLARE_INSTRUCTION_PARSER(move) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(move) "); + parseRValue(_instParseCtxt.inst->_opA, _tokens[1]); parseRValue(_instParseCtxt.inst->_opB, _tokens[2]); } -DECLARE_INSTRUCTION_PARSER(put) { +DECLARE_INSTRUCTION_PARSER(put) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(put) "); + if (!scumm_stricmp(_tokens[1], _instParseCtxt.a->_label._text)) { _instParseCtxt.inst->_a = _instParseCtxt.a; } else { @@ -313,7 +355,9 @@ DECLARE_INSTRUCTION_PARSER(put) { } -DECLARE_INSTRUCTION_PARSER(call) { +DECLARE_INSTRUCTION_PARSER(call) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(call) "); + int index = _callableNames->lookup(_tokens[1]); if (index == Table::notFound) error("unknown callable '%s'", _tokens[1]); @@ -321,17 +365,23 @@ DECLARE_INSTRUCTION_PARSER(call) { } -DECLARE_INSTRUCTION_PARSER(sound) { +DECLARE_INSTRUCTION_PARSER(sound) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(sound) "); + _instParseCtxt.inst->_z = findZone(_tokens[1]); } -DECLARE_INSTRUCTION_PARSER(null) { +DECLARE_INSTRUCTION_PARSER(null) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(null) "); + } -DECLARE_INSTRUCTION_PARSER(defLocal) { +DECLARE_INSTRUCTION_PARSER(defLocal) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(defLocal) "); + int16 val = atoi(_tokens[2]); int16 index; @@ -347,7 +397,9 @@ DECLARE_INSTRUCTION_PARSER(defLocal) { _instParseCtxt.inst->_index = INST_SET; } -DECLARE_INSTRUCTION_PARSER(endscript) { +DECLARE_INSTRUCTION_PARSER(endscript) { + debugC(7, kDebugParser, "INSTRUCTION_PARSER(endscript) "); + _instParseCtxt.end = true; } @@ -419,7 +471,9 @@ void Parallaction_ns::parseLValue(ScriptVar &v, const char *str) { } -DECLARE_COMMAND_PARSER(flags) { +DECLARE_COMMAND_PARSER(flags) { + debugC(7, kDebugParser, "COMMAND_PARSER(flags) "); + createCommand(_lookup); if (_globalTable->lookup(_tokens[1]) == Table::notFound) { @@ -444,7 +498,9 @@ DECLARE_COMMAND_PARSER(flags) { } -DECLARE_COMMAND_PARSER(animation) { +DECLARE_COMMAND_PARSER(animation) { + debugC(7, kDebugParser, "COMMAND_PARSER(animation) "); + createCommand(_lookup); _locParseCtxt.cmd->u._animation = findAnimation(_tokens[_locParseCtxt.nextToken]); @@ -460,7 +516,9 @@ DECLARE_COMMAND_PARSER(animation) { } -DECLARE_COMMAND_PARSER(zone) { +DECLARE_COMMAND_PARSER(zone) { + debugC(7, kDebugParser, "COMMAND_PARSER(zone) "); + createCommand(_lookup); _locParseCtxt.cmd->u._zone = findZone(_tokens[_locParseCtxt.nextToken]); @@ -471,7 +529,9 @@ DECLARE_COMMAND_PARSER(zone) { } -DECLARE_COMMAND_PARSER(location) { +DECLARE_COMMAND_PARSER(location) { + debugC(7, kDebugParser, "COMMAND_PARSER(location) "); + createCommand(_lookup); _locParseCtxt.cmd->u._string = (char*)malloc(strlen(_tokens[_locParseCtxt.nextToken])+1); @@ -483,7 +543,9 @@ DECLARE_COMMAND_PARSER(location) { } -DECLARE_COMMAND_PARSER(drop) { +DECLARE_COMMAND_PARSER(drop) { + debugC(7, kDebugParser, "COMMAND_PARSER(drop) "); + createCommand(_lookup); _locParseCtxt.cmd->u._object = 4 + _objectsNames->lookup(_tokens[_locParseCtxt.nextToken]); @@ -494,7 +556,9 @@ DECLARE_COMMAND_PARSER(drop) { } -DECLARE_COMMAND_PARSER(call) { +DECLARE_COMMAND_PARSER(call) { + debugC(7, kDebugParser, "COMMAND_PARSER(call) "); + createCommand(_lookup); _locParseCtxt.cmd->u._callable = _callableNames->lookup(_tokens[_locParseCtxt.nextToken]) - 1; @@ -505,13 +569,17 @@ DECLARE_COMMAND_PARSER(call) { } -DECLARE_COMMAND_PARSER(simple) { +DECLARE_COMMAND_PARSER(simple) { + debugC(7, kDebugParser, "COMMAND_PARSER(simple) "); + createCommand(_lookup); addCommand(); } -DECLARE_COMMAND_PARSER(move) { +DECLARE_COMMAND_PARSER(move) { + debugC(7, kDebugParser, "COMMAND_PARSER(move) "); + createCommand(_lookup); _locParseCtxt.cmd->u._move.x = atoi(_tokens[_locParseCtxt.nextToken]); @@ -523,11 +591,15 @@ DECLARE_COMMAND_PARSER(move) { addCommand(); } -DECLARE_COMMAND_PARSER(invalid) { +DECLARE_COMMAND_PARSER(invalid) { + debugC(7, kDebugParser, "COMMAND_PARSER(invalid) "); + error("Can't parse unknown command '%s'", _tokens[0]); } -DECLARE_COMMAND_PARSER(endcommands) { +DECLARE_COMMAND_PARSER(endcommands) { + debugC(7, kDebugParser, "COMMAND_PARSER(endcommands) "); + popParserTables(); // temporary trick to handle dialogue commands @@ -605,16 +677,18 @@ void Parallaction_ns::createCommand(uint id) { } void Parallaction_ns::parseCommands(Script &script, CommandList& list) { + debugC(5, kDebugParser, "parseCommands()"); + _locParseCtxt.list = &list; _locParseCtxt.endcommands = false; _locParseCtxt.script = &script; pushParserTables(&_commandParsers, _commandsNames); - } Dialogue *Parallaction_ns::parseDialogue(Script &script) { -// printf("parseDialogue()\n"); + debugC(7, kDebugParser, "parseDialogue()"); + uint16 numQuestions = 0; Dialogue *dialogue = new Dialogue; @@ -724,6 +798,8 @@ Dialogue *Parallaction_ns::parseDialogue(Script &script) { } } + debugC(7, kDebugParser, "parseDialogue() done"); + return dialogue; } @@ -747,16 +823,22 @@ char *Parallaction_ns::parseDialogueString(Script &script) { } -DECLARE_LOCATION_PARSER(invalid) { +DECLARE_LOCATION_PARSER(invalid) { + debugC(7, kDebugParser, "LOCATION_PARSER(invalid) "); + error("unknown keyword '%s' in location '%s'", _tokens[0], _locParseCtxt.filename); } -DECLARE_LOCATION_PARSER(endlocation) { +DECLARE_LOCATION_PARSER(endlocation) { + debugC(7, kDebugParser, "LOCATION_PARSER(endlocation) "); + _locParseCtxt.end = true; } -DECLARE_LOCATION_PARSER(location) { +DECLARE_LOCATION_PARSER(location) { + debugC(7, kDebugParser, "LOCATION_PARSER(location) "); + // The parameter for location is 'location.mask'. // If mask is not present, then it is assumed // that path & mask are encoded in the background @@ -782,27 +864,37 @@ DECLARE_LOCATION_PARSER(location) { } -DECLARE_LOCATION_PARSER(disk) { +DECLARE_LOCATION_PARSER(disk) { + debugC(7, kDebugParser, "LOCATION_PARSER(disk) "); + _disk->selectArchive(_tokens[1]); } -DECLARE_LOCATION_PARSER(nodes) { +DECLARE_LOCATION_PARSER(nodes) { + debugC(7, kDebugParser, "LOCATION_PARSER(nodes) "); + parseWalkNodes(*_locParseCtxt.script, _location._walkNodes); } -DECLARE_LOCATION_PARSER(zone) { +DECLARE_LOCATION_PARSER(zone) { + debugC(7, kDebugParser, "LOCATION_PARSER(zone) "); + parseZone(*_locParseCtxt.script, _zones, _tokens[1]); } -DECLARE_LOCATION_PARSER(animation) { +DECLARE_LOCATION_PARSER(animation) { + debugC(7, kDebugParser, "LOCATION_PARSER(animation) "); + parseAnimation(*_locParseCtxt.script, _animations, _tokens[1]); } -DECLARE_LOCATION_PARSER(localflags) { +DECLARE_LOCATION_PARSER(localflags) { + debugC(7, kDebugParser, "LOCATION_PARSER(localflags) "); + int _si = 1; while (_tokens[_si][0] != '\0') { _localFlagNames->addData(_tokens[_si]); @@ -811,17 +903,23 @@ DECLARE_LOCATION_PARSER(localflags) { } -DECLARE_LOCATION_PARSER(commands) { +DECLARE_LOCATION_PARSER(commands) { + debugC(7, kDebugParser, "LOCATION_PARSER(commands) "); + parseCommands(*_locParseCtxt.script, _location._commands); } -DECLARE_LOCATION_PARSER(acommands) { +DECLARE_LOCATION_PARSER(acommands) { + debugC(7, kDebugParser, "LOCATION_PARSER(acommands) "); + parseCommands(*_locParseCtxt.script, _location._aCommands); } -DECLARE_LOCATION_PARSER(flags) { +DECLARE_LOCATION_PARSER(flags) { + debugC(7, kDebugParser, "LOCATION_PARSER(flags) "); + if ((_localFlags[_currentLocationIndex] & kFlagsVisited) == 0) { // only for 1st visit _localFlags[_currentLocationIndex] = 0; @@ -839,17 +937,23 @@ DECLARE_LOCATION_PARSER(flags) { } -DECLARE_LOCATION_PARSER(comment) { +DECLARE_LOCATION_PARSER(comment) { + debugC(7, kDebugParser, "LOCATION_PARSER(comment) "); + _location._comment = parseComment(*_locParseCtxt.script); } -DECLARE_LOCATION_PARSER(endcomment) { +DECLARE_LOCATION_PARSER(endcomment) { + debugC(7, kDebugParser, "LOCATION_PARSER(endcomment) "); + _location._endComment = parseComment(*_locParseCtxt.script); } -DECLARE_LOCATION_PARSER(sound) { +DECLARE_LOCATION_PARSER(sound) { + debugC(7, kDebugParser, "LOCATION_PARSER(sound) "); + if (getPlatform() == Common::kPlatformAmiga) { strcpy(_locationSound, _tokens[1]); _hasLocationSound = true; @@ -857,18 +961,22 @@ DECLARE_LOCATION_PARSER(sound) { } -DECLARE_LOCATION_PARSER(music) { +DECLARE_LOCATION_PARSER(music) { + debugC(7, kDebugParser, "LOCATION_PARSER(music) "); + if (getPlatform() == Common::kPlatformAmiga) _soundMan->setMusicFile(_tokens[1]); } -DECLARE_LOCATION_PARSER(redundant) { +DECLARE_LOCATION_PARSER(redundant) { + debugC(7, kDebugParser, "LOCATION_PARSER(redundant) "); + warning("redundant '%s' line found in script '%s'", _tokens[0], _locParseCtxt.filename); } void Parallaction_ns::parseLocation(const char *filename) { - debugC(5, kDebugLocation, "parseLocation('%s')", filename); + debugC(1, kDebugParser, "parseLocation('%s')", filename); allocateLocationSlot(filename); // printf("got location slot #%i for %s\n", _currentLocationIndex, filename); @@ -907,12 +1015,13 @@ void Parallaction_ns::parseLocation(const char *filename) { loadProgram(*it, (*it)->_scriptName); } - debugC(5, kDebugLocation, "parseLocation('%s') done", filename); + debugC(1, kDebugParser, "parseLocation('%s') done", filename); return; } void Parallaction_ns::parseWalkNodes(Script& script, WalkNodeList &list) { + debugC(5, kDebugParser, "parseWalkNodes()"); fillBuffers(script, true); while (scumm_stricmp(_tokens[0], "ENDNODES")) { @@ -930,8 +1039,9 @@ void Parallaction_ns::parseWalkNodes(Script& script, WalkNodeList &list) { fillBuffers(script, true); } - return; + debugC(5, kDebugParser, "parseWalkNodes() done"); + return; } typedef OpcodeImpl<Parallaction_ns> OpcodeV1; @@ -1082,15 +1192,21 @@ char *Parallaction_ns::parseComment(Script &script) { } -DECLARE_ZONE_PARSER(invalid) { +DECLARE_ZONE_PARSER(invalid) { + debugC(7, kDebugParser, "ZONE_PARSER(invalid) "); + error("unknown statement '%s' in zone %s", _tokens[0], _locParseCtxt.z->_label._text); } -DECLARE_ZONE_PARSER(endzone) { +DECLARE_ZONE_PARSER(endzone) { + debugC(7, kDebugParser, "ZONE_PARSER(endzone) "); + popParserTables(); } -DECLARE_ZONE_PARSER(limits) { +DECLARE_ZONE_PARSER(limits) { + debugC(7, kDebugParser, "ZONE_PARSER(limits) "); + _locParseCtxt.z->_left = atoi(_tokens[1]); _locParseCtxt.z->_top = atoi(_tokens[2]); _locParseCtxt.z->_right = atoi(_tokens[3]); @@ -1098,13 +1214,17 @@ DECLARE_ZONE_PARSER(limits) { } -DECLARE_ZONE_PARSER(moveto) { +DECLARE_ZONE_PARSER(moveto) { + debugC(7, kDebugParser, "ZONE_PARSER(moveto) "); + _locParseCtxt.z->_moveTo.x = atoi(_tokens[1]); _locParseCtxt.z->_moveTo.y = atoi(_tokens[2]); } -DECLARE_ZONE_PARSER(type) { +DECLARE_ZONE_PARSER(type) { + debugC(7, kDebugParser, "ZONE_PARSER(type) "); + if (_tokens[2][0] != '\0') { _locParseCtxt.z->_type = (4 + _objectsNames->lookup(_tokens[2])) << 16; } @@ -1118,18 +1238,24 @@ DECLARE_ZONE_PARSER(type) { } -DECLARE_ZONE_PARSER(commands) { +DECLARE_ZONE_PARSER(commands) { + debugC(7, kDebugParser, "ZONE_PARSER(commands) "); + parseCommands(*_locParseCtxt.script, _locParseCtxt.z->_commands); } -DECLARE_ZONE_PARSER(label) { +DECLARE_ZONE_PARSER(label) { + debugC(7, kDebugParser, "ZONE_PARSER(label) "); + // printf("label: %s", _tokens[1]); renderLabel(&_locParseCtxt.z->_label._cnv, _tokens[1]); } -DECLARE_ZONE_PARSER(flags) { +DECLARE_ZONE_PARSER(flags) { + debugC(7, kDebugParser, "ZONE_PARSER(flags) "); + uint16 _si = 1; do { @@ -1140,6 +1266,7 @@ DECLARE_ZONE_PARSER(flags) { } void Parallaction_ns::parseZone(Script &script, ZoneList &list, char *name) { + debugC(5, kDebugParser, "parseZone(name: %s)", name); if (findZone(name)) { while (scumm_stricmp(_tokens[0], "endzone")) { @@ -1164,7 +1291,7 @@ void Parallaction_ns::parseZone(Script &script, ZoneList &list, char *name) { void Parallaction_ns::parseZoneTypeBlock(Script &script, Zone *z) { -// printf("parseZoneTypeBlock()"); + debugC(7, kDebugParser, "parseZoneTypeBlock(name: %s, type: %x)", z->_label._text, z->_type); TypeData *u = &z->u; @@ -1200,6 +1327,7 @@ void Parallaction_ns::parseZoneTypeBlock(Script &script, Zone *z) { // printf("type = %x", z->_type); do { + debugC(8, kDebugParser, "parseZoneTypeBlock(%s)", _tokens[0]); switch (z->_type & 0xFFFF) { case kZoneExamine: // examine Zone init @@ -1299,9 +1427,10 @@ void Parallaction_ns::parseZoneTypeBlock(Script &script, Zone *z) { fillBuffers(script, true); } while (scumm_stricmp(_tokens[0], "endzone")); + debugC(7, kDebugParser, "parseZoneTypeBlock() done"); + return; } - } // namespace Parallaction diff --git a/engines/parallaction/sound.cpp b/engines/parallaction/sound.cpp index ecfde1d741..9b8e179ccb 100644 --- a/engines/parallaction/sound.cpp +++ b/engines/parallaction/sound.cpp @@ -281,14 +281,14 @@ void DosSoundMan::playLocationMusic(const char *location) { if (_musicData1 != 0) { playCharacterMusic(_vm->_characterName); _musicData1 = 0; - debugC(2, kDebugLocation, "changeLocation: started character specific music"); + debugC(2, kDebugExec, "changeLocation: started character specific music"); } if (!scumm_stricmp(location, "night") || !scumm_stricmp(location, "intsushi")) { setMusicFile("nuts"); playMusic(); - debugC(2, kDebugLocation, "changeLocation: started music 'soft'"); + debugC(2, kDebugExec, "changeLocation: started music 'soft'"); } if (!scumm_stricmp(location, "museo") || @@ -302,7 +302,7 @@ void DosSoundMan::playLocationMusic(const char *location) { stopMusic(); _musicData1 = 1; - debugC(2, kDebugLocation, "changeLocation: music stopped"); + debugC(2, kDebugExec, "changeLocation: music stopped"); } } |