2009-09-19 09:53:43 +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$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-10-06 00:44:08 +00:00
|
|
|
#include "asylum/resources/actionlist.h"
|
2010-11-03 04:27:41 +00:00
|
|
|
|
2010-10-06 00:44:08 +00:00
|
|
|
#include "asylum/system/config.h"
|
2009-09-19 09:53:43 +00:00
|
|
|
|
|
|
|
namespace Asylum {
|
|
|
|
|
2009-09-19 13:31:00 +00:00
|
|
|
ActionList::ActionList(Common::SeekableReadStream *stream, Scene *scene)
|
2009-09-21 19:11:49 +00:00
|
|
|
: _scene(scene) {
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
// Build list of opcodes
|
|
|
|
ADD_OPCODE(Return);
|
|
|
|
ADD_OPCODE(SetGameFlag);
|
|
|
|
ADD_OPCODE(ClearGameFlag);
|
|
|
|
ADD_OPCODE(ToggleGameFlag);
|
|
|
|
ADD_OPCODE(JumpIfGameFlag);
|
|
|
|
ADD_OPCODE(HideCursor);
|
|
|
|
ADD_OPCODE(ShowCursor);
|
|
|
|
ADD_OPCODE(PlayAnimation);
|
|
|
|
ADD_OPCODE(MoveScenePosition);
|
|
|
|
ADD_OPCODE(HideActor);
|
|
|
|
ADD_OPCODE(ShowActor);
|
|
|
|
ADD_OPCODE(SetActorPosition);
|
|
|
|
ADD_OPCODE(SetSceneMotionStatus);
|
|
|
|
ADD_OPCODE(DisableActor);
|
|
|
|
ADD_OPCODE(EnableActor);
|
|
|
|
ADD_OPCODE(EnableBarriers);
|
|
|
|
ADD_OPCODE(Return);
|
|
|
|
ADD_OPCODE(DestroyBarrier);
|
|
|
|
ADD_OPCODE(_unk12_JMP_WALK_ACTOR);
|
|
|
|
ADD_OPCODE(_unk13_JMP_WALK_ACTOR);
|
|
|
|
ADD_OPCODE(_unk14_JMP_WALK_ACTOR);
|
|
|
|
ADD_OPCODE(_unk15);
|
|
|
|
ADD_OPCODE(ResetAnimation);
|
|
|
|
ADD_OPCODE(ClearFlag1Bit0);
|
|
|
|
ADD_OPCODE(_unk18_PLAY_SND);
|
|
|
|
ADD_OPCODE(JumpIfFlag2Bit0);
|
|
|
|
ADD_OPCODE(SetFlag2Bit0);
|
|
|
|
ADD_OPCODE(ClearFlag2Bit0);
|
|
|
|
ADD_OPCODE(JumpIfFlag2Bit2);
|
|
|
|
ADD_OPCODE(SetFlag2Bit2);
|
|
|
|
ADD_OPCODE(ClearFlag2Bit2);
|
|
|
|
ADD_OPCODE(JumpIfFlag2Bit1);
|
|
|
|
ADD_OPCODE(SetFlag2Bit1);
|
|
|
|
ADD_OPCODE(ClearFlag2Bit1);
|
|
|
|
ADD_OPCODE(_unk22);
|
|
|
|
ADD_OPCODE(_unk23);
|
|
|
|
ADD_OPCODE(_unk24);
|
|
|
|
ADD_OPCODE(RunEncounter);
|
|
|
|
ADD_OPCODE(JumpIfFlag2Bit4);
|
|
|
|
ADD_OPCODE(SetFlag2Bit4);
|
|
|
|
ADD_OPCODE(ClearFlag2Bit4);
|
|
|
|
ADD_OPCODE(SetActorField638);
|
|
|
|
ADD_OPCODE(JumpIfActorField638);
|
|
|
|
ADD_OPCODE(ChangeScene);
|
|
|
|
ADD_OPCODE(_unk2C_ActorSub);
|
|
|
|
ADD_OPCODE(PlayMovie);
|
|
|
|
ADD_OPCODE(StopAllBarriersSounds);
|
|
|
|
ADD_OPCODE(StopProcessing);
|
|
|
|
ADD_OPCODE(ResumeProcessing);
|
|
|
|
ADD_OPCODE(ResetSceneRect);
|
|
|
|
ADD_OPCODE(ChangeMusicById);
|
|
|
|
ADD_OPCODE(StopMusic);
|
|
|
|
ADD_OPCODE(_unk34_Status);
|
|
|
|
ADD_OPCODE(_unk35);
|
|
|
|
ADD_OPCODE(_unk36);
|
|
|
|
ADD_OPCODE(RunBlowUpPuzzle);
|
|
|
|
ADD_OPCODE(JumpIfFlag2Bit3);
|
|
|
|
ADD_OPCODE(SetFlag2Bit3);
|
|
|
|
ADD_OPCODE(ClearFlag2Bit3);
|
|
|
|
ADD_OPCODE(_unk3B_PALETTE_MOD);
|
|
|
|
ADD_OPCODE(_unk3C_CMP_VAL);
|
|
|
|
ADD_OPCODE(WaitUntilFramePlayed);
|
|
|
|
ADD_OPCODE(UpdateWideScreen);
|
|
|
|
ADD_OPCODE(_unk3F);
|
|
|
|
ADD_OPCODE(_unk40_SOUND);
|
|
|
|
ADD_OPCODE(PlaySpeech);
|
|
|
|
ADD_OPCODE(_unk42);
|
|
|
|
ADD_OPCODE(_unk43);
|
|
|
|
ADD_OPCODE(PaletteFade);
|
|
|
|
ADD_OPCODE(StartPaletteFadeThread);
|
|
|
|
ADD_OPCODE(_unk46);
|
|
|
|
ADD_OPCODE(ActorFaceObject);
|
|
|
|
ADD_OPCODE(_unk48_MATTE_01);
|
|
|
|
ADD_OPCODE(_unk49_MATTE_90);
|
|
|
|
ADD_OPCODE(JumpIfSoundPlaying);
|
|
|
|
ADD_OPCODE(ChangePlayerCharacterIndex);
|
2010-11-03 04:27:55 +00:00
|
|
|
ADD_OPCODE(ChangeActorStatus);
|
2010-11-03 04:27:41 +00:00
|
|
|
ADD_OPCODE(StopSound);
|
|
|
|
ADD_OPCODE(_unk4E_RANDOM_COMMAND);
|
|
|
|
ADD_OPCODE(ClearScreen);
|
|
|
|
ADD_OPCODE(Quit);
|
|
|
|
ADD_OPCODE(JumpBarrierFrame);
|
|
|
|
ADD_OPCODE(_unk52);
|
|
|
|
ADD_OPCODE(_unk53);
|
|
|
|
ADD_OPCODE(_unk54_SET_ACTIONLIST_6EC);
|
|
|
|
ADD_OPCODE(_unk55);
|
|
|
|
ADD_OPCODE(_unk56);
|
|
|
|
ADD_OPCODE(SetResourcePalette);
|
|
|
|
ADD_OPCODE(SetBarrierFrameIdxFlaged);
|
|
|
|
ADD_OPCODE(_unk59);
|
|
|
|
ADD_OPCODE(_unk5A);
|
|
|
|
ADD_OPCODE(_unk5B);
|
|
|
|
ADD_OPCODE(_unk5C);
|
|
|
|
ADD_OPCODE(_unk5D);
|
|
|
|
ADD_OPCODE(ClearActorField970);
|
|
|
|
ADD_OPCODE(SetBarrierLastFrameIdx);
|
|
|
|
ADD_OPCODE(_unk60_SET_OR_CLR_ACTIONAREA_FLAG);
|
|
|
|
ADD_OPCODE(_unk61);
|
|
|
|
ADD_OPCODE(_unk62_SHOW_OPTIONS_SCREEN);
|
|
|
|
ADD_OPCODE(_unk63);
|
|
|
|
|
2009-09-19 12:24:53 +00:00
|
|
|
load(stream);
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-01-13 09:12:26 +00:00
|
|
|
_currentScript = 0;
|
2010-11-03 04:27:41 +00:00
|
|
|
_currentLine = 0;
|
|
|
|
_currentLoops = 0;
|
|
|
|
_delayedSceneIndex = -1;
|
|
|
|
_delayedVideoIndex = -1;
|
|
|
|
_allowInput = true;
|
|
|
|
_skipProcessing = false;
|
|
|
|
|
|
|
|
// Reset script queue
|
|
|
|
_scripts.clear();
|
2009-09-19 09:53:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ActionList::~ActionList() {
|
2010-11-03 04:27:41 +00:00
|
|
|
for (int i = 0; i < (int)_actions.size(); i++)
|
|
|
|
delete _actions[i];
|
2009-09-19 09:53:43 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
_entries.clear();
|
2009-11-28 12:21:08 +00:00
|
|
|
_scripts.clear();
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
// Zero-out passed pointers
|
|
|
|
_scene = NULL;
|
2009-11-27 12:22:37 +00:00
|
|
|
}
|
|
|
|
|
2009-11-27 14:36:27 +00:00
|
|
|
void ActionList::queueScript(int actionIndex, int actorIndex) {
|
2010-11-03 04:27:41 +00:00
|
|
|
// When the skipProcessing flag is set, do not queue any more scripts
|
|
|
|
if (_skipProcessing)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ScriptQueueEntry entry;
|
|
|
|
entry.actionListIndex = actionIndex;
|
|
|
|
entry.actorIndex = actorIndex;
|
|
|
|
|
|
|
|
// If there's currently no script for the processor to run,
|
|
|
|
// assign it directly and skip the stack push. If however the
|
|
|
|
// current script is assigned, push the script to the stack
|
|
|
|
if (_currentScript)
|
|
|
|
_scripts.push(entry);
|
|
|
|
else {
|
|
|
|
_currentQueueEntry = entry;
|
|
|
|
_currentScript = &_entries[entry.actionListIndex];
|
2009-11-27 12:22:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
bool ActionList::process() {
|
|
|
|
_done = false;
|
|
|
|
_waitCycle = false;
|
|
|
|
_lineIncrement = 1;
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:28:19 +00:00
|
|
|
_scene->vm()->setGameFlag(kGameFlagScriptProcessing);
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2009-11-28 12:21:08 +00:00
|
|
|
if (_currentScript)
|
2010-11-03 04:27:41 +00:00
|
|
|
while (!_done && !_waitCycle) {
|
|
|
|
_lineIncrement = 0; //Reset line increment value
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
ScriptEntry *currentCommand = &_currentScript->commands[_currentLine];
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2009-12-04 03:14:07 +00:00
|
|
|
int32 opcode = currentCommand->opcode;
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2009-11-28 12:21:08 +00:00
|
|
|
debugC(kDebugLevelScripts,
|
2010-03-15 10:40:11 +00:00
|
|
|
"[0x%02X] %s(%d, %d, %d, %d, %d, %d, %d, %d, %d)",
|
2010-11-03 04:27:41 +00:00
|
|
|
opcode,
|
|
|
|
_actions[opcode]->name,
|
2009-11-28 12:21:08 +00:00
|
|
|
currentCommand->param1,
|
|
|
|
currentCommand->param2,
|
|
|
|
currentCommand->param3,
|
|
|
|
currentCommand->param4,
|
|
|
|
currentCommand->param5,
|
|
|
|
currentCommand->param6,
|
|
|
|
currentCommand->param7,
|
|
|
|
currentCommand->param8,
|
|
|
|
currentCommand->param9);
|
2009-11-27 14:36:27 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
// Execute opcode
|
|
|
|
(*_actions[opcode]->func)(currentCommand);
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
if (!_lineIncrement)
|
|
|
|
_currentLine ++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_done) {
|
|
|
|
_currentLine = 0;
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2009-11-28 12:21:08 +00:00
|
|
|
if (!_scripts.empty()) {
|
|
|
|
_currentQueueEntry = _scripts.pop();
|
2010-11-03 04:27:41 +00:00
|
|
|
_currentScript = &_entries[_currentQueueEntry.actionListIndex];
|
2009-11-28 12:21:08 +00:00
|
|
|
} else {
|
|
|
|
_currentScript = 0;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:28:19 +00:00
|
|
|
_scene->vm()->clearGameFlag(kGameFlagScriptProcessing);
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
return false;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2009-09-19 12:24:53 +00:00
|
|
|
void ActionList::load(Common::SeekableReadStream *stream) {
|
2010-11-03 04:27:41 +00:00
|
|
|
stream->readSint32LE(); // size
|
|
|
|
int32 numEntries = stream->readSint32LE();
|
2009-09-19 12:24:53 +00:00
|
|
|
|
2009-12-04 03:14:07 +00:00
|
|
|
for (int32 a = 0; a < numEntries; a++) {
|
2009-11-27 14:36:27 +00:00
|
|
|
Script action;
|
|
|
|
memset(&action, 0, sizeof(Script));
|
2009-09-19 12:24:53 +00:00
|
|
|
|
2009-12-04 03:14:07 +00:00
|
|
|
for (int32 c = 0; c < MAX_ACTION_COMMANDS; c++) {
|
2009-11-27 14:36:27 +00:00
|
|
|
ScriptEntry command;
|
|
|
|
memset(&command, 0, sizeof(ScriptEntry));
|
2009-09-19 12:24:53 +00:00
|
|
|
|
2009-12-04 03:14:07 +00:00
|
|
|
command.numLines = stream->readSint32LE();
|
|
|
|
command.opcode = stream->readSint32LE();
|
2009-11-11 09:56:14 +00:00
|
|
|
command.param1 = stream->readSint32LE();
|
|
|
|
command.param2 = stream->readSint32LE();
|
|
|
|
command.param3 = stream->readSint32LE();
|
|
|
|
command.param4 = stream->readSint32LE();
|
|
|
|
command.param5 = stream->readSint32LE();
|
|
|
|
command.param6 = stream->readSint32LE();
|
|
|
|
command.param7 = stream->readSint32LE();
|
|
|
|
command.param8 = stream->readSint32LE();
|
|
|
|
command.param9 = stream->readSint32LE();
|
2009-09-19 12:24:53 +00:00
|
|
|
|
|
|
|
action.commands[c] = command;
|
|
|
|
}
|
|
|
|
|
2009-12-04 03:14:07 +00:00
|
|
|
action.field_1BAC = stream->readSint32LE();
|
|
|
|
action.field_1BB0 = stream->readSint32LE();
|
|
|
|
action.counter = stream->readSint32LE();
|
2009-09-19 12:24:53 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
_entries.push_back(action);
|
2009-09-19 12:24:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode Functions
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x00
|
|
|
|
IMPLEMENT_OPCODE(Return) {
|
|
|
|
_done = true;
|
|
|
|
_lineIncrement = 0;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x01
|
|
|
|
IMPLEMENT_OPCODE(SetGameFlag) {
|
2010-11-03 04:28:19 +00:00
|
|
|
GameFlag flagNum = (GameFlag)cmd->param1;
|
2009-09-19 13:31:00 +00:00
|
|
|
|
|
|
|
if (flagNum >= 0)
|
2010-11-03 04:27:41 +00:00
|
|
|
_scene->vm()->setGameFlag(flagNum);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x02
|
|
|
|
IMPLEMENT_OPCODE(ClearGameFlag) {
|
2010-11-03 04:28:19 +00:00
|
|
|
GameFlag flagNum = (GameFlag)cmd->param1;
|
2009-09-19 13:31:00 +00:00
|
|
|
|
|
|
|
if (flagNum >= 0)
|
2010-11-03 04:27:41 +00:00
|
|
|
_scene->vm()->clearGameFlag(flagNum);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x03
|
|
|
|
IMPLEMENT_OPCODE(ToggleGameFlag) {
|
2010-11-03 04:28:19 +00:00
|
|
|
GameFlag flagNum = (GameFlag)cmd->param1;
|
2009-09-19 13:31:00 +00:00
|
|
|
|
|
|
|
if (flagNum >= 0)
|
2010-11-03 04:27:41 +00:00
|
|
|
_scene->vm()->toggleGameFlag(flagNum);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x04
|
|
|
|
IMPLEMENT_OPCODE(JumpIfGameFlag) {
|
2010-11-03 04:28:19 +00:00
|
|
|
GameFlag flagNum = (GameFlag)cmd->param1;
|
2009-09-19 13:31:00 +00:00
|
|
|
|
|
|
|
if (flagNum) {
|
2010-11-03 04:27:41 +00:00
|
|
|
bool doJump = _scene->vm()->isGameFlagSet(flagNum);
|
2009-09-19 13:31:00 +00:00
|
|
|
if (cmd->param2)
|
2010-11-03 04:27:41 +00:00
|
|
|
doJump = _scene->vm()->isGameFlagNotSet(flagNum);
|
2009-09-19 13:31:00 +00:00
|
|
|
if (doJump)
|
2010-11-03 04:27:41 +00:00
|
|
|
_currentLine = cmd->param3;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x05
|
|
|
|
IMPLEMENT_OPCODE(HideCursor) {
|
|
|
|
_scene->getCursor()->hide();
|
|
|
|
_allowInput = false;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x06
|
|
|
|
IMPLEMENT_OPCODE(ShowCursor) {
|
|
|
|
_scene->getCursor()->show();
|
|
|
|
_allowInput = true;
|
2009-09-19 13:31:00 +00:00
|
|
|
|
|
|
|
// TODO clear_flag_01()
|
2010-11-03 04:27:41 +00:00
|
|
|
error("Incomplete opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x07
|
|
|
|
IMPLEMENT_OPCODE(PlayAnimation) {
|
2010-11-03 04:27:55 +00:00
|
|
|
Barrier *barrier = _scene->worldstats()->getBarrierById(cmd->param1);
|
2009-09-19 13:31:00 +00:00
|
|
|
|
|
|
|
if (cmd->param2 == 2) {
|
2010-11-03 04:27:55 +00:00
|
|
|
if (!barrier->checkFlags())
|
2009-09-19 13:31:00 +00:00
|
|
|
cmd->param2 = 1;
|
2010-11-03 04:27:55 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
_lineIncrement = 1;
|
2010-11-03 04:27:55 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update flags
|
|
|
|
if (cmd->param4) {
|
|
|
|
barrier->flags &= 0xFFFEF1C7;
|
|
|
|
barrier->flags |= 0x20;
|
|
|
|
} else if (cmd->param3) {
|
|
|
|
barrier->flags &= 0xFFFEF1C7;
|
|
|
|
barrier->flags |= 0x10000;
|
|
|
|
// FIXME: This should be the correct code but this causes a regression
|
|
|
|
// Investigate barrier drawing to see if there is some wrong code there
|
|
|
|
//} else if (barrier->flags & 0x10000) {
|
|
|
|
// barrier->flags |= 8;
|
|
|
|
// barrier->flags &= 0xFFFEFFFF;
|
|
|
|
//} else if (!(barrier->flags & 0x10E38)) {
|
|
|
|
// barrier->flags |= 8;
|
|
|
|
//}
|
2009-09-19 13:31:00 +00:00
|
|
|
} else {
|
2010-11-03 04:27:55 +00:00
|
|
|
barrier->flags &= 0x10000;
|
|
|
|
if (barrier->flags == 0) {
|
|
|
|
barrier->flags &= 0x10E38;
|
2009-09-21 19:11:49 +00:00
|
|
|
if (barrier->flags == 0) {
|
2009-09-19 13:31:00 +00:00
|
|
|
barrier->flags |= 8;
|
|
|
|
}
|
2010-11-03 04:27:55 +00:00
|
|
|
} else {
|
|
|
|
barrier->flags |= 8;
|
|
|
|
barrier->flags &= 0xFFFEFFFF;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:55 +00:00
|
|
|
}
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:55 +00:00
|
|
|
barrier->setNextFrame(barrier->flags);
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:55 +00:00
|
|
|
if (barrier->field_688 == 1) {
|
|
|
|
if (barrier->flags & 4) {
|
|
|
|
_scene->setGlobalX(barrier->x);
|
|
|
|
_scene->setGlobalY(barrier->y);
|
|
|
|
} else {
|
2009-09-19 13:31:00 +00:00
|
|
|
// TODO: get barrier position
|
2010-11-03 04:27:55 +00:00
|
|
|
error("Incomplete opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:55 +00:00
|
|
|
if (cmd->param2) {
|
|
|
|
cmd->param2 = 2;
|
|
|
|
_lineIncrement = 1;
|
|
|
|
}
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x08
|
|
|
|
IMPLEMENT_OPCODE(MoveScenePosition) {
|
|
|
|
WorldStats *ws = _scene->worldstats();
|
2009-09-19 13:31:00 +00:00
|
|
|
Common::Rect *sr = &ws->sceneRects[ws->sceneRectIdx];
|
|
|
|
|
|
|
|
if (cmd->param3 < 1) {
|
|
|
|
ws->xLeft = cmd->param1;
|
|
|
|
ws->yTop = cmd->param2;
|
|
|
|
ws->motionStatus = 3;
|
|
|
|
} else if (!cmd->param4) {
|
|
|
|
ws->motionStatus = 5;
|
|
|
|
ws->targetX = cmd->param1;
|
|
|
|
ws->targetY = cmd->param2;
|
|
|
|
ws->field_A0 = cmd->param3;
|
|
|
|
|
2009-11-27 14:57:14 +00:00
|
|
|
if (ws->targetX < sr->left)
|
2009-09-19 13:31:00 +00:00
|
|
|
ws->targetX = sr->left;
|
2009-11-27 14:57:14 +00:00
|
|
|
if (ws->targetY < sr->top)
|
2009-09-19 13:31:00 +00:00
|
|
|
ws->targetY = sr->top;
|
2009-11-27 14:57:14 +00:00
|
|
|
if (ws->targetX + 640 > sr->right)
|
2009-09-19 13:31:00 +00:00
|
|
|
ws->targetX = sr->right - 640;
|
2009-11-27 14:57:14 +00:00
|
|
|
if (ws->targetY + 480 > sr->bottom)
|
2009-09-19 13:31:00 +00:00
|
|
|
ws->targetY = sr->bottom - 480;
|
|
|
|
|
|
|
|
// TODO: reverse asm block
|
|
|
|
|
|
|
|
} else if (cmd->param5) {
|
|
|
|
if (ws->motionStatus == 2)
|
2010-11-03 04:27:41 +00:00
|
|
|
_lineIncrement = 1;
|
2009-09-19 13:31:00 +00:00
|
|
|
else
|
|
|
|
cmd->param5 = 0;
|
|
|
|
} else {
|
|
|
|
cmd->param5 = 1;
|
|
|
|
ws->motionStatus = 2;
|
|
|
|
ws->targetX = cmd->param1;
|
|
|
|
ws->targetY = cmd->param2;
|
|
|
|
ws->field_A0 = cmd->param3;
|
|
|
|
|
2009-11-27 14:57:14 +00:00
|
|
|
if (ws->targetX + 640 > (int)ws->width)
|
2009-09-19 13:31:00 +00:00
|
|
|
ws->targetX = ws->width - 640;
|
2009-11-27 14:57:14 +00:00
|
|
|
if (ws->targetX < sr->left)
|
2009-09-19 13:31:00 +00:00
|
|
|
ws->targetX = sr->left;
|
2009-11-27 14:57:14 +00:00
|
|
|
if (ws->targetY < sr->top)
|
2009-09-19 13:31:00 +00:00
|
|
|
ws->targetY = sr->top;
|
2009-11-27 14:57:14 +00:00
|
|
|
if (ws->targetX + 640 > sr->right)
|
2009-09-19 13:31:00 +00:00
|
|
|
ws->targetX = sr->right - 640;
|
2009-11-27 14:57:14 +00:00
|
|
|
if (ws->targetY + 480 > sr->bottom)
|
2009-09-19 13:31:00 +00:00
|
|
|
ws->targetY = sr->bottom - 480;
|
|
|
|
|
|
|
|
// TODO: reverse asm block
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
error("Incomplete opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x09
|
|
|
|
IMPLEMENT_OPCODE(HideActor) {
|
2010-11-03 04:27:55 +00:00
|
|
|
Actor *actor = (cmd->param1 == -1) ? _scene->getActor() : &_scene->worldstats()->actors[cmd->param1];
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2009-11-11 11:12:08 +00:00
|
|
|
actor->visible(false);
|
2010-11-03 04:27:55 +00:00
|
|
|
actor->updateDirection();
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x0A
|
|
|
|
IMPLEMENT_OPCODE(ShowActor) {
|
2010-11-03 04:27:55 +00:00
|
|
|
GET_ACTOR();
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2009-11-11 11:12:08 +00:00
|
|
|
actor->visible(true);
|
2010-11-03 04:27:55 +00:00
|
|
|
actor->updateDirection();
|
2010-11-03 04:27:41 +00:00
|
|
|
actor->tickValue1 = _scene->vm()->getTick();
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x0B
|
|
|
|
IMPLEMENT_OPCODE(SetActorPosition) {
|
2010-11-03 04:27:55 +00:00
|
|
|
Actor *actor = _scene->getActor(cmd->param1);
|
|
|
|
|
|
|
|
actor->setPosition(cmd->param2, cmd->param3, cmd->param4, cmd->param5);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x0C
|
|
|
|
IMPLEMENT_OPCODE(SetSceneMotionStatus) {
|
|
|
|
_scene->worldstats()->motionStatus = cmd->param1;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x0D
|
|
|
|
IMPLEMENT_OPCODE(DisableActor) {
|
2010-11-03 04:27:55 +00:00
|
|
|
GET_ACTOR();
|
|
|
|
|
|
|
|
actor->updateStatus(kActorStatusDisabled);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x0E
|
|
|
|
IMPLEMENT_OPCODE(EnableActor) {
|
2010-11-03 04:27:55 +00:00
|
|
|
GET_ACTOR();
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:55 +00:00
|
|
|
if (actor->status == kActorStatusDisabled)
|
|
|
|
actor->updateStatus(kActorStatusEnabled);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x0F
|
|
|
|
IMPLEMENT_OPCODE(EnableBarriers) {
|
|
|
|
int32 barIdx = _scene->worldstats()->getBarrierIndexById(cmd->param1);
|
|
|
|
Barrier *bar = &_scene->worldstats()->barriers[barIdx];
|
2009-12-04 03:14:07 +00:00
|
|
|
int32 sndIdx = cmd->param3;
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
if (!_currentScript->counter && _scene->getSceneIndex() != 13 && sndIdx != 0) {
|
2009-09-24 02:27:38 +00:00
|
|
|
// FIXME: I really don't understand what (sndIdx != 0) & 5 is supposed to be doing here,
|
|
|
|
// but this is effectively trying to do a boolean AND operation on a boolean variable
|
|
|
|
// which is odd, and wrong. Changing it to (sndIdx & 5), for now
|
2010-11-03 04:27:41 +00:00
|
|
|
//_scene->vm()->sound()->playSound(((sndIdx != 0) & 5) + 0x80120001,
|
|
|
|
_scene->vm()->sound()->playSound((sndIdx & 5) + 0x80120001, false, Config.sfxVolume, 0);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
if (_currentScript->counter >= (3 * cmd->param2 - 1)) {
|
|
|
|
_currentScript->counter = 0;
|
2010-01-13 11:25:39 +00:00
|
|
|
bar->field_67C = 0;
|
2010-11-03 04:27:41 +00:00
|
|
|
// TODO processActionListSub02(_currentScript, cmd, 2);
|
2009-09-19 13:31:00 +00:00
|
|
|
} else {
|
2010-01-13 11:25:39 +00:00
|
|
|
int v64; // XXX rename when processActionListSub02 is better implemented
|
2010-11-03 04:27:41 +00:00
|
|
|
_currentScript->counter += 1;
|
2009-09-19 13:31:00 +00:00
|
|
|
if (sndIdx) {
|
2009-09-21 19:11:49 +00:00
|
|
|
v64 = 1;
|
2010-11-03 04:27:41 +00:00
|
|
|
bar->field_67C = 3 - _currentScript->counter / cmd->param2;
|
2009-09-19 13:31:00 +00:00
|
|
|
} else {
|
2009-09-21 19:11:49 +00:00
|
|
|
v64 = 0;
|
2010-11-03 04:27:41 +00:00
|
|
|
bar->field_67C = _currentScript->counter / cmd->param2 + 1;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
// TODO processActionListSub02(_currentScript, cmd, v64);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
error("Incomplete opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x10 : Identical to opcode 0x00
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x11
|
|
|
|
IMPLEMENT_OPCODE(DestroyBarrier) {
|
|
|
|
Barrier *barrier = _scene->worldstats()->getBarrierById(cmd->param1);
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
if (!barrier)
|
|
|
|
error("ActionList::kDestroyBarrier: Requested invalid object ID:0x%02X in Scene %d Line %d.", cmd->param1, _scene->getSceneIndex(),_currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
barrier->flags &= 0xFFFFFFFE;
|
|
|
|
barrier->flags |= 0x20000;
|
|
|
|
_scene->vm()->screen()->deleteGraphicFromQueue(barrier->resId);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x12
|
|
|
|
IMPLEMENT_OPCODE(_unk12_JMP_WALK_ACTOR) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x13
|
|
|
|
IMPLEMENT_OPCODE(_unk13_JMP_WALK_ACTOR) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x14
|
|
|
|
IMPLEMENT_OPCODE(_unk14_JMP_WALK_ACTOR) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x15
|
|
|
|
IMPLEMENT_OPCODE(_unk15) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x16
|
|
|
|
IMPLEMENT_OPCODE(ResetAnimation) {
|
|
|
|
Barrier *barrier = _scene->worldstats()->getBarrierById(cmd->param1);
|
2009-09-19 13:31:00 +00:00
|
|
|
|
|
|
|
if ((barrier->flags & 0x10000) == 0)
|
|
|
|
barrier->frameIdx = 0;
|
|
|
|
else
|
|
|
|
barrier->frameIdx = barrier->frameCount - 1;
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x17
|
|
|
|
IMPLEMENT_OPCODE(ClearFlag1Bit0) {
|
|
|
|
Barrier *barrier = _scene->worldstats()->getBarrierById(cmd->param1);
|
2009-09-19 13:31:00 +00:00
|
|
|
|
|
|
|
barrier->flags &= 0xFFFFFFFE;
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x18
|
|
|
|
IMPLEMENT_OPCODE(_unk18_PLAY_SND) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x19
|
|
|
|
IMPLEMENT_OPCODE(JumpIfFlag2Bit0) {
|
2009-09-19 13:31:00 +00:00
|
|
|
int targetType = cmd->param2;
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
error("Incomplete opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
// TODO targetType == 7 is trying to access an out of bounds actor
|
|
|
|
// look at the disassembly again
|
|
|
|
|
|
|
|
if (targetType <= 0)
|
2010-11-03 04:27:41 +00:00
|
|
|
_done = (_scene->worldstats()->getBarrierById(cmd->param1)->flags2 & 1) == 0;
|
2009-09-19 13:31:00 +00:00
|
|
|
else
|
|
|
|
if (targetType == 1) // v4 == 1, so 1
|
2010-11-03 04:27:41 +00:00
|
|
|
_done = (_scene->worldstats()->getActionAreaById(cmd->param1)->actionType & 1) == 0;
|
2009-09-19 13:31:00 +00:00
|
|
|
else
|
2010-11-03 04:27:41 +00:00
|
|
|
_done = (_scene->worldstats()->actors[cmd->param1].flags2 & 1) == 0;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x1A
|
|
|
|
IMPLEMENT_OPCODE(SetFlag2Bit0) {
|
2009-09-19 13:31:00 +00:00
|
|
|
int targetType = cmd->param2;
|
|
|
|
|
|
|
|
if (targetType == 2)
|
2010-11-03 04:27:41 +00:00
|
|
|
_scene->worldstats()->actors[cmd->param1].flags2 |= 1;
|
2009-09-19 13:31:00 +00:00
|
|
|
else
|
|
|
|
if (targetType == 1)
|
2010-11-03 04:27:41 +00:00
|
|
|
_scene->worldstats()->getActionAreaById(cmd->param1)->actionType |= 1;
|
2009-09-19 13:31:00 +00:00
|
|
|
else
|
2010-11-03 04:27:41 +00:00
|
|
|
_scene->worldstats()->getBarrierById(cmd->param1)->flags2 |= 1;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x1B
|
|
|
|
IMPLEMENT_OPCODE(ClearFlag2Bit0) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x1C
|
|
|
|
IMPLEMENT_OPCODE(JumpIfFlag2Bit2) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x1D
|
|
|
|
IMPLEMENT_OPCODE(SetFlag2Bit2) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x1E
|
|
|
|
IMPLEMENT_OPCODE(ClearFlag2Bit2) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x1F
|
|
|
|
IMPLEMENT_OPCODE(JumpIfFlag2Bit1) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x20
|
|
|
|
IMPLEMENT_OPCODE(SetFlag2Bit1) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x21
|
|
|
|
IMPLEMENT_OPCODE(ClearFlag2Bit1) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x22
|
|
|
|
IMPLEMENT_OPCODE(_unk22) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x23
|
|
|
|
IMPLEMENT_OPCODE(_unk23) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x24
|
|
|
|
IMPLEMENT_OPCODE(_unk24) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x25
|
|
|
|
IMPLEMENT_OPCODE(RunEncounter) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x26
|
|
|
|
IMPLEMENT_OPCODE(JumpIfFlag2Bit4) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x27
|
|
|
|
IMPLEMENT_OPCODE(SetFlag2Bit4) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x28
|
|
|
|
IMPLEMENT_OPCODE(ClearFlag2Bit4) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x29
|
|
|
|
IMPLEMENT_OPCODE(SetActorField638) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x2A
|
|
|
|
IMPLEMENT_OPCODE(JumpIfActorField638) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x2B
|
|
|
|
IMPLEMENT_OPCODE(ChangeScene) {
|
|
|
|
_delayedSceneIndex = cmd->param1 + 4;
|
2009-09-19 13:31:00 +00:00
|
|
|
debug(kDebugLevelScripts,
|
2009-09-21 19:11:49 +00:00
|
|
|
"Queueing Scene Change to scene %d...",
|
2010-11-03 04:27:41 +00:00
|
|
|
_delayedSceneIndex);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x2C
|
|
|
|
IMPLEMENT_OPCODE(_unk2C_ActorSub) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x2D
|
|
|
|
IMPLEMENT_OPCODE(PlayMovie) {
|
2009-09-19 13:31:00 +00:00
|
|
|
// TODO: add missing code here
|
2010-11-03 04:27:41 +00:00
|
|
|
_delayedVideoIndex = cmd->param1;
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
error("Incomplete opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x2E
|
|
|
|
IMPLEMENT_OPCODE(StopAllBarriersSounds) {
|
2009-09-19 13:31:00 +00:00
|
|
|
// TODO: do this for all barriers that have sfx playing
|
2010-11-03 04:27:41 +00:00
|
|
|
_scene->vm()->sound()->stopAllSounds();
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
error("Incomplete opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x2F
|
|
|
|
IMPLEMENT_OPCODE(StopProcessing) {
|
|
|
|
_skipProcessing = true;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x30
|
|
|
|
IMPLEMENT_OPCODE(ResumeProcessing) {
|
|
|
|
_skipProcessing = false;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x31
|
|
|
|
IMPLEMENT_OPCODE(ResetSceneRect) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x32
|
|
|
|
IMPLEMENT_OPCODE(ChangeMusicById) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
|
|
|
}
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x33
|
|
|
|
IMPLEMENT_OPCODE(StopMusic) {
|
|
|
|
_scene->vm()->sound()->stopMusic();
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x34
|
|
|
|
IMPLEMENT_OPCODE(_unk34_Status) {
|
2009-09-19 13:31:00 +00:00
|
|
|
if (cmd->param1 >= 2) {
|
|
|
|
cmd->param1 = 0;
|
|
|
|
} else {
|
|
|
|
cmd->param1++;
|
2010-11-03 04:27:41 +00:00
|
|
|
_lineIncrement = 1;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x35
|
|
|
|
IMPLEMENT_OPCODE(_unk35) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x36
|
|
|
|
IMPLEMENT_OPCODE(_unk36) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x37
|
|
|
|
IMPLEMENT_OPCODE(RunBlowUpPuzzle) {
|
2009-09-19 13:31:00 +00:00
|
|
|
// FIXME: improve this to call other blowUpPuzzles than VCR
|
|
|
|
//int puzzleIdx = cmd->param1;
|
2010-01-13 09:12:26 +00:00
|
|
|
warning("kRunBlowUpPuzzle not implemented");
|
2010-11-03 04:27:41 +00:00
|
|
|
//_scene->setBlowUpPuzzle(new BlowUpPuzzleVCR(scn));
|
|
|
|
//_scene->getBlowUpPuzzle()->openBlowUp();
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
error("Incomplete opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x38
|
|
|
|
IMPLEMENT_OPCODE(JumpIfFlag2Bit3) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x39
|
|
|
|
IMPLEMENT_OPCODE(SetFlag2Bit3) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x3A
|
|
|
|
IMPLEMENT_OPCODE(ClearFlag2Bit3) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x3B
|
|
|
|
IMPLEMENT_OPCODE(_unk3B_PALETTE_MOD) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x3C
|
|
|
|
IMPLEMENT_OPCODE(_unk3C_CMP_VAL) {
|
2009-09-19 13:31:00 +00:00
|
|
|
if (cmd->param1) {
|
|
|
|
if (cmd->param2 >= cmd->param1) {
|
|
|
|
cmd->param2 = 0;
|
|
|
|
} else {
|
|
|
|
cmd->param2++;
|
2010-11-03 04:27:41 +00:00
|
|
|
_lineIncrement = 1;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x3D
|
|
|
|
IMPLEMENT_OPCODE(WaitUntilFramePlayed) {
|
|
|
|
Barrier *barrier = _scene->worldstats()->getBarrierById(cmd->param1);
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
if (!barrier)
|
|
|
|
error("ActionList::WaitUntilFramePlayed: Requested invalid object ID:0x%02X in Scene %d Line %d.", cmd->param1, _scene->getSceneIndex(),_currentLine);
|
2009-09-21 19:11:49 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
uint32 frameNum = cmd->param2;
|
|
|
|
if (cmd->param2 == -1)
|
|
|
|
frameNum = barrier->frameCount - 1;
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
if (barrier->frameIdx != frameNum) {
|
|
|
|
_lineIncrement = 1;
|
|
|
|
_waitCycle = true;
|
|
|
|
}
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x3E
|
|
|
|
IMPLEMENT_OPCODE(UpdateWideScreen) {
|
2009-09-19 13:31:00 +00:00
|
|
|
int barSize = cmd->param1;
|
|
|
|
|
|
|
|
if (barSize >= 22) {
|
|
|
|
cmd->param1 = 0;
|
|
|
|
} else {
|
2010-11-03 04:27:41 +00:00
|
|
|
_scene->vm()->screen()->drawWideScreen(4 * barSize);
|
2009-09-19 13:31:00 +00:00
|
|
|
cmd->param1++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x3F
|
|
|
|
IMPLEMENT_OPCODE(_unk3F) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x40
|
|
|
|
IMPLEMENT_OPCODE(_unk40_SOUND) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x41
|
|
|
|
IMPLEMENT_OPCODE(PlaySpeech) {
|
2010-11-03 04:28:02 +00:00
|
|
|
if (cmd->param1 < 0)
|
|
|
|
return;
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:28:02 +00:00
|
|
|
if (cmd->param4 != 2) {
|
|
|
|
cmd->param5 = _scene->speech()->play(cmd->param1);
|
|
|
|
|
|
|
|
if (cmd->param2) {
|
2010-11-03 04:28:19 +00:00
|
|
|
_scene->vm()->setGameFlag(kGameFlagScriptProcessing);
|
2010-11-03 04:28:02 +00:00
|
|
|
cmd->param4 = 2;
|
|
|
|
if (cmd->param6) {
|
|
|
|
_scene->vm()->setFlag(kFlagType1);
|
|
|
|
_scene->vm()->setFlag(kFlagType2);
|
|
|
|
}
|
|
|
|
_lineIncrement = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cmd->param3 && !cmd->param6)
|
2010-11-03 04:28:19 +00:00
|
|
|
_scene->vm()->setGameFlag(kGameFlag219);
|
2010-11-03 04:28:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_scene->vm()->sound()->isPlaying(cmd->param5)) {
|
|
|
|
_lineIncrement = 1;
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:28:19 +00:00
|
|
|
_scene->vm()->clearGameFlag(kGameFlagScriptProcessing);
|
2010-11-03 04:28:02 +00:00
|
|
|
cmd->param4 = 0;
|
|
|
|
|
|
|
|
if (cmd->param3) {
|
|
|
|
if (cmd->param6) {
|
|
|
|
_scene->vm()->clearFlag(kFlagType1);
|
|
|
|
_scene->vm()->clearFlag(kFlagType2);
|
|
|
|
} else {
|
2010-11-03 04:28:19 +00:00
|
|
|
_scene->vm()->clearGameFlag(kGameFlag219);
|
2010-11-03 04:28:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!cmd->param6) {
|
|
|
|
cmd->param6 = 1;
|
|
|
|
} else {
|
|
|
|
_scene->vm()->clearFlag(kFlagType1);
|
|
|
|
_scene->vm()->clearFlag(kFlagType2);
|
|
|
|
}
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x42
|
|
|
|
IMPLEMENT_OPCODE(_unk42) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x43
|
|
|
|
IMPLEMENT_OPCODE(_unk43) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x44
|
|
|
|
IMPLEMENT_OPCODE(PaletteFade) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x45
|
|
|
|
IMPLEMENT_OPCODE(StartPaletteFadeThread) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x46
|
|
|
|
IMPLEMENT_OPCODE(_unk46) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x47
|
|
|
|
IMPLEMENT_OPCODE(ActorFaceObject) {
|
2009-09-19 13:31:00 +00:00
|
|
|
// XXX
|
|
|
|
// Dropping param1, since it's the character index
|
|
|
|
// Investigate further if/when we have a scene with
|
|
|
|
// multiple characters in the actor[] array
|
2010-11-03 04:27:41 +00:00
|
|
|
_scene->getActor()->faceTarget(cmd->param2, cmd->param3);
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
error("Incomplete opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x48
|
|
|
|
IMPLEMENT_OPCODE(_unk48_MATTE_01) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x49
|
|
|
|
IMPLEMENT_OPCODE(_unk49_MATTE_90) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x4A
|
|
|
|
IMPLEMENT_OPCODE(JumpIfSoundPlaying) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x4B
|
|
|
|
IMPLEMENT_OPCODE(ChangePlayerCharacterIndex) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x4C
|
2010-11-03 04:27:55 +00:00
|
|
|
IMPLEMENT_OPCODE(ChangeActorStatus) {
|
|
|
|
ActorIndex actorIdx = cmd->param1;
|
|
|
|
|
|
|
|
if (cmd->param2) {
|
|
|
|
if (_scene->worldstats()->actors[actorIdx].status < kActorStatus11)
|
|
|
|
_scene->worldstats()->actors[actorIdx].status = kActorStatus14;
|
2009-09-19 13:31:00 +00:00
|
|
|
} else {
|
2010-11-03 04:27:55 +00:00
|
|
|
_scene->worldstats()->actors[actorIdx].status = kActorStatusEnabled;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x4D
|
|
|
|
IMPLEMENT_OPCODE(StopSound) {
|
2010-11-03 04:27:55 +00:00
|
|
|
if (_scene->vm()->sound()->isPlaying(cmd->param1))
|
|
|
|
_scene->vm()->sound()->stopSound(cmd->param1);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x4E
|
|
|
|
IMPLEMENT_OPCODE(_unk4E_RANDOM_COMMAND) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x4F
|
|
|
|
IMPLEMENT_OPCODE(ClearScreen) {
|
2009-09-19 13:31:00 +00:00
|
|
|
if (cmd->param1)
|
2010-11-03 04:27:41 +00:00
|
|
|
_scene->vm()->screen()->clearScreen();
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x50
|
|
|
|
IMPLEMENT_OPCODE(Quit) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x51
|
|
|
|
IMPLEMENT_OPCODE(JumpBarrierFrame) {
|
|
|
|
Barrier *barrier = _scene->worldstats()->getBarrierById(cmd->param1);
|
2009-11-11 11:12:08 +00:00
|
|
|
int idx = (int)barrier->frameIdx;
|
2009-09-19 13:31:00 +00:00
|
|
|
|
|
|
|
if (cmd->param2 == -1)
|
|
|
|
cmd->param2 = barrier->frameCount - 1;
|
|
|
|
|
2009-11-11 11:12:08 +00:00
|
|
|
if (cmd->param3 && cmd->param2 == idx) {
|
2009-09-19 13:31:00 +00:00
|
|
|
//break;
|
2009-11-11 11:12:08 +00:00
|
|
|
} else if (cmd->param4 && cmd->param2 < idx) {
|
2009-09-19 13:31:00 +00:00
|
|
|
//break;
|
2009-11-11 11:12:08 +00:00
|
|
|
} else if (cmd->param5 && cmd->param2 > idx) {
|
2009-09-19 13:31:00 +00:00
|
|
|
//break;
|
2009-11-11 11:12:08 +00:00
|
|
|
} else if (cmd->param6 && cmd->param2 <= idx) {
|
2009-09-19 13:31:00 +00:00
|
|
|
//break;
|
2009-11-11 11:12:08 +00:00
|
|
|
} else if (cmd->param7 && cmd->param2 >= idx) {
|
2009-09-19 13:31:00 +00:00
|
|
|
//break;
|
2009-11-11 11:12:08 +00:00
|
|
|
} else if (cmd->param8 && cmd->param2 != idx) {
|
2009-09-19 13:31:00 +00:00
|
|
|
//break;
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
ScriptEntry *nextCmd = &_currentScript->commands[cmd->param9];
|
2009-09-19 13:31:00 +00:00
|
|
|
|
|
|
|
// 0x10 == kReturn
|
|
|
|
if (nextCmd->opcode != 0x10 && nextCmd->opcode)
|
2010-11-03 04:27:41 +00:00
|
|
|
_done = true;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x52
|
|
|
|
IMPLEMENT_OPCODE(_unk52) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x53
|
|
|
|
IMPLEMENT_OPCODE(_unk53) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x54
|
|
|
|
IMPLEMENT_OPCODE(_unk54_SET_ACTIONLIST_6EC) {
|
2009-09-19 13:31:00 +00:00
|
|
|
if (cmd->param2)
|
2010-11-03 04:27:47 +00:00
|
|
|
_currentScript->field_1BB0 = _scene->vm()->getRandom(cmd->param1);
|
2009-09-19 13:31:00 +00:00
|
|
|
else
|
2010-11-03 04:27:41 +00:00
|
|
|
_currentScript->field_1BB0 = cmd->param1;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x55
|
|
|
|
IMPLEMENT_OPCODE(_unk55) {
|
2009-09-19 13:31:00 +00:00
|
|
|
// TODO
|
|
|
|
/*
|
|
|
|
if (!cmd->param2) {
|
2010-11-03 04:27:41 +00:00
|
|
|
if (cmd->param3 && _currentScript->field_1BB0 < cmd->param1)
|
2009-09-19 13:31:00 +00:00
|
|
|
//break;
|
2010-11-03 04:27:41 +00:00
|
|
|
else if (cmd->param4 && _currentScript->field_1BB0 > cmd->param1)
|
2009-09-19 13:31:00 +00:00
|
|
|
//break;
|
2010-11-03 04:27:41 +00:00
|
|
|
else if (cmd->param5 && _currentScript->field_1BB0 <= cmd->param1)
|
2009-09-19 13:31:00 +00:00
|
|
|
//break;
|
2010-11-03 04:27:41 +00:00
|
|
|
else if (cmd->param6 && _currentScript->field_1BB0 >= cmd->param1)
|
2009-09-19 13:31:00 +00:00
|
|
|
//break;
|
2010-11-03 04:27:41 +00:00
|
|
|
else if (cmd->param7 && _currentScript->field_1BB0 != cmd->param1)
|
2009-09-19 13:31:00 +00:00
|
|
|
//break;
|
2010-11-03 04:27:41 +00:00
|
|
|
} else if(_currentScript->field_1BB0 == cmd->param1) {
|
2009-09-19 13:31:00 +00:00
|
|
|
//break;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
ScriptEntry *nextCmd = &_currentScript->commands[cmd->param8];
|
2009-09-19 13:31:00 +00:00
|
|
|
|
|
|
|
if (nextCmd->opcode != 0x10 && nextCmd->opcode)
|
2010-11-03 04:27:41 +00:00
|
|
|
_done = true;
|
2009-09-19 13:31:00 +00:00
|
|
|
else
|
2010-11-03 04:27:41 +00:00
|
|
|
_lineIncrement = cmd->param8;
|
2009-09-19 13:31:00 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
error("Incomplete opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x56
|
|
|
|
IMPLEMENT_OPCODE(_unk56) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x57
|
|
|
|
IMPLEMENT_OPCODE(SetResourcePalette) {
|
2009-09-19 13:31:00 +00:00
|
|
|
if (cmd->param1 > 0)
|
2010-11-03 04:27:41 +00:00
|
|
|
_scene->vm()->screen()->setPalette(_scene->getResourcePack(), _scene->worldstats()->grResId[cmd->param1]);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x58
|
|
|
|
IMPLEMENT_OPCODE(SetBarrierFrameIdxFlaged) {
|
|
|
|
Barrier *barrier = _scene->worldstats()->getBarrierById(cmd->param1);
|
2009-09-19 13:31:00 +00:00
|
|
|
|
|
|
|
if (cmd->param3)
|
|
|
|
barrier->flags = 1 | barrier->flags;
|
|
|
|
else
|
|
|
|
barrier->flags = barrier->flags & 0xFFFFFFFE;
|
|
|
|
|
|
|
|
barrier->frameIdx = cmd->param2;
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x59
|
|
|
|
IMPLEMENT_OPCODE(_unk59) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x5A
|
|
|
|
IMPLEMENT_OPCODE(_unk5A) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x5B
|
|
|
|
IMPLEMENT_OPCODE(_unk5B) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x5C
|
|
|
|
IMPLEMENT_OPCODE(_unk5C) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x5D
|
|
|
|
IMPLEMENT_OPCODE(_unk5D) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-01-13 09:50:31 +00:00
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x5E
|
|
|
|
IMPLEMENT_OPCODE(ClearActorField970) {
|
|
|
|
Actor *act = _scene->getActor(cmd->param1);
|
2010-01-13 09:50:31 +00:00
|
|
|
act->field_970 = 0;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x5F
|
|
|
|
IMPLEMENT_OPCODE(SetBarrierLastFrameIdx) {
|
|
|
|
Barrier *barrier = _scene->worldstats()->getBarrierById(cmd->param1);
|
2009-09-19 13:31:00 +00:00
|
|
|
|
|
|
|
if (barrier->frameIdx == barrier->frameCount - 1) {
|
2010-11-03 04:27:41 +00:00
|
|
|
_lineIncrement = 0;
|
2009-09-19 13:31:00 +00:00
|
|
|
barrier->flags &= 0xFFFEF1C7;
|
|
|
|
} else {
|
2010-11-03 04:27:41 +00:00
|
|
|
_lineIncrement = 1;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x60
|
|
|
|
IMPLEMENT_OPCODE(_unk60_SET_OR_CLR_ACTIONAREA_FLAG) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x61
|
|
|
|
IMPLEMENT_OPCODE(_unk61) {
|
2009-09-19 13:31:00 +00:00
|
|
|
if (cmd->param2) {
|
2010-11-03 04:27:41 +00:00
|
|
|
if (_scene->worldstats()->field_E860C == -1) {
|
|
|
|
_lineIncrement = 0;
|
2009-09-19 13:31:00 +00:00
|
|
|
cmd->param2 = 0;
|
|
|
|
} else {
|
2010-11-03 04:27:41 +00:00
|
|
|
_lineIncrement = 1;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// TODO: do something for scene number 9
|
|
|
|
cmd->param2 = 1;
|
2010-11-03 04:27:41 +00:00
|
|
|
_lineIncrement = 1;
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
error("Incomplete opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x62
|
|
|
|
IMPLEMENT_OPCODE(_unk62_SHOW_OPTIONS_SCREEN) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
2010-11-03 04:27:41 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Opcode 0x63
|
|
|
|
IMPLEMENT_OPCODE(_unk63) {
|
|
|
|
error("Unhandled opcode %s (0x%02X) in Scene %d Line %d", _actions[cmd->opcode]->name, cmd->opcode, _scene->getSceneIndex(), _currentLine);
|
2009-09-19 13:31:00 +00:00
|
|
|
}
|
|
|
|
|
2009-09-19 09:53:43 +00:00
|
|
|
} // end of namespace Asylum
|