2006-02-22 22:40:53 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2006 The ScummVM project
|
|
|
|
*
|
|
|
|
* cinE Engine is (C) 2004-2005 by CinE Team
|
|
|
|
*
|
|
|
|
* 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$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-03-29 15:59:37 +00:00
|
|
|
#include "common/stdafx.h"
|
|
|
|
#include "common/endian.h"
|
|
|
|
|
2006-02-22 22:40:53 +00:00
|
|
|
#include "cine/cine.h"
|
2006-02-25 01:18:01 +00:00
|
|
|
#include "cine/bg_list.h"
|
|
|
|
#include "cine/object.h"
|
2006-02-25 01:01:27 +00:00
|
|
|
#include "cine/sfx_player.h"
|
|
|
|
#include "cine/sound_driver.h"
|
2006-02-25 01:18:01 +00:00
|
|
|
#include "cine/various.h"
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 00:26:14 +00:00
|
|
|
namespace Cine {
|
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
prcLinkedListStruct *_currentScriptElement;
|
2006-04-08 06:47:58 +00:00
|
|
|
byte *_currentScriptPtr;
|
2006-04-08 13:20:40 +00:00
|
|
|
uint16 _currentScriptParams;
|
2006-04-08 06:47:58 +00:00
|
|
|
uint16 _currentPosition;
|
2006-04-08 13:20:40 +00:00
|
|
|
uint16 _currentLine;
|
|
|
|
uint16 _closeScript;
|
|
|
|
|
|
|
|
typedef void (*OpcodeProc) ();
|
|
|
|
const OpcodeProc *_opcodeTable;
|
|
|
|
int _numOpcodes;
|
|
|
|
|
|
|
|
void setupOpcodes() {
|
|
|
|
static const OpcodeProc opcodeTableFW[] = {
|
|
|
|
/* 00 */
|
|
|
|
o1_modifyObjectParam,
|
|
|
|
o1_getObjectParam,
|
|
|
|
o1_addObjectParam,
|
|
|
|
o1_subObjectParam,
|
|
|
|
/* 04 */
|
|
|
|
o1_add2ObjectParam,
|
|
|
|
o1_sub2ObjectParam,
|
|
|
|
o1_compareObjectParam,
|
|
|
|
o1_setupObject,
|
|
|
|
/* 08 */
|
|
|
|
o1_checkCollision,
|
|
|
|
o1_loadVar,
|
|
|
|
o1_addVar,
|
|
|
|
o1_subVar,
|
|
|
|
/* 0C */
|
|
|
|
o1_mulVar,
|
|
|
|
o1_divVar,
|
|
|
|
o1_compareVar,
|
|
|
|
o1_modifyObjectParam2,
|
|
|
|
/* 10 */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
o1_loadMask0,
|
|
|
|
/* 14 */
|
|
|
|
o1_unloadMask0,
|
|
|
|
o1_addToBgList,
|
|
|
|
o1_loadMask1,
|
|
|
|
o1_unloadMask1,
|
|
|
|
/* 18 */
|
|
|
|
o1_loadMask4,
|
|
|
|
o1_unloadMask4,
|
|
|
|
o1_addSpriteFilledToBgList,
|
|
|
|
o1_op1B,
|
|
|
|
/* 1C */
|
|
|
|
NULL,
|
|
|
|
o1_label,
|
|
|
|
o1_goto,
|
|
|
|
o1_gotoIfSup,
|
|
|
|
/* 20 */
|
|
|
|
o1_gotoIfSupEqu,
|
|
|
|
o1_gotoIfInf,
|
|
|
|
o1_gotoIfInfEqu,
|
|
|
|
o1_gotoIfEqu,
|
|
|
|
/* 24 */
|
|
|
|
o1_gotoIfDiff,
|
|
|
|
o1_removeLabel,
|
|
|
|
o1_loop,
|
|
|
|
NULL,
|
|
|
|
/* 28 */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
/* 2C */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
/* 30 */
|
|
|
|
NULL,
|
|
|
|
o1_startGlobalScript,
|
|
|
|
o1_endGlobalScript,
|
|
|
|
NULL,
|
|
|
|
/* 34 */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
/* 38 */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
o1_loadAnim,
|
|
|
|
/* 3C */
|
|
|
|
o1_loadBg,
|
|
|
|
o1_loadCt,
|
|
|
|
NULL,
|
|
|
|
o1_loadPart,
|
|
|
|
/* 40 */
|
|
|
|
o1_closePart,
|
|
|
|
o1_loadNewPrcName,
|
|
|
|
o1_requestCheckPendingDataLoad,
|
|
|
|
NULL,
|
|
|
|
/* 44 */
|
|
|
|
NULL,
|
|
|
|
o1_blitAndFade,
|
|
|
|
o1_fadeToBlack,
|
|
|
|
o1_transformPaletteRange,
|
|
|
|
/* 48 */
|
|
|
|
NULL,
|
|
|
|
o1_setDefaultMenuColor2,
|
|
|
|
o1_palRotate,
|
|
|
|
NULL,
|
|
|
|
/* 4C */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
o1_break,
|
|
|
|
/* 50 */
|
|
|
|
o1_endScript,
|
|
|
|
o1_message,
|
|
|
|
o1_loadGlobalVar,
|
|
|
|
o1_compareGlobalVar,
|
|
|
|
/* 54 */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
/* 58 */
|
|
|
|
NULL,
|
|
|
|
o1_declareFunctionName,
|
|
|
|
o1_freePartRange,
|
|
|
|
o1_unloadAllMasks,
|
|
|
|
// 5C */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
/* 60 */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
o1_op63,
|
|
|
|
/* 64 */
|
|
|
|
o1_op64,
|
|
|
|
o1_initializeZoneData,
|
|
|
|
o1_setZoneDataEntry,
|
|
|
|
o1_getZoneDataEntry,
|
|
|
|
/* 68 */
|
|
|
|
o1_setDefaultMenuColor,
|
|
|
|
o1_allowPlayerInput,
|
|
|
|
o1_disallowPlayerInput,
|
|
|
|
o1_changeDataDisk,
|
|
|
|
/* 6C */
|
|
|
|
NULL,
|
|
|
|
o1_loadMusic,
|
|
|
|
o1_playMusic,
|
|
|
|
o1_fadeOutMusic,
|
|
|
|
/* 70 */
|
|
|
|
o1_stopSample,
|
|
|
|
o1_op71,
|
|
|
|
o1_op72,
|
|
|
|
o1_op73,
|
|
|
|
/* 74 */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
o1_playSample,
|
|
|
|
/* 78 */
|
|
|
|
o1_playSample,
|
|
|
|
o1_allowSystemMenu,
|
|
|
|
o1_loadMask5,
|
|
|
|
o1_unloadMask5
|
|
|
|
};
|
|
|
|
|
|
|
|
// TODO: We need to verify the Operation Stealth opcodes.
|
|
|
|
|
|
|
|
static const OpcodeProc opcodeTableOS[] = {
|
|
|
|
/* 00 */
|
|
|
|
o1_modifyObjectParam,
|
|
|
|
o1_getObjectParam,
|
|
|
|
o1_addObjectParam,
|
|
|
|
o1_subObjectParam,
|
|
|
|
/* 04 */
|
|
|
|
o1_add2ObjectParam,
|
|
|
|
o1_sub2ObjectParam,
|
|
|
|
o1_compareObjectParam,
|
|
|
|
o1_setupObject,
|
|
|
|
/* 08 */
|
|
|
|
o1_checkCollision,
|
|
|
|
o1_loadVar,
|
|
|
|
o1_addVar,
|
|
|
|
o1_subVar,
|
|
|
|
/* 0C */
|
|
|
|
o1_mulVar,
|
|
|
|
o1_divVar,
|
|
|
|
o1_compareVar,
|
|
|
|
o1_modifyObjectParam2,
|
|
|
|
/* 10 */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
o1_loadMask0,
|
|
|
|
/* 14 */
|
|
|
|
o1_unloadMask0,
|
|
|
|
o1_addToBgList,
|
|
|
|
o1_loadMask1,
|
|
|
|
o1_unloadMask1,
|
|
|
|
/* 18 */
|
|
|
|
o1_loadMask4,
|
|
|
|
o1_unloadMask4,
|
|
|
|
o1_addSpriteFilledToBgList,
|
|
|
|
o1_op1B,
|
|
|
|
/* 1C */
|
|
|
|
NULL,
|
|
|
|
o1_label,
|
|
|
|
o1_goto,
|
|
|
|
o1_gotoIfSup,
|
|
|
|
/* 20 */
|
|
|
|
o1_gotoIfSupEqu,
|
|
|
|
o1_gotoIfInf,
|
|
|
|
o1_gotoIfInfEqu,
|
|
|
|
o1_gotoIfEqu,
|
|
|
|
/* 24 */
|
|
|
|
o1_gotoIfDiff,
|
|
|
|
o1_removeLabel,
|
|
|
|
o1_loop,
|
|
|
|
NULL,
|
|
|
|
/* 28 */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
/* 2C */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
/* 30 */
|
|
|
|
NULL,
|
|
|
|
o1_startGlobalScript,
|
|
|
|
o1_endGlobalScript,
|
|
|
|
NULL,
|
|
|
|
/* 34 */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
/* 38 */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
o1_loadAnim,
|
|
|
|
/* 3C */
|
|
|
|
o1_loadBg,
|
|
|
|
o1_loadCt,
|
|
|
|
NULL,
|
|
|
|
o2_loadPart,
|
|
|
|
/* 40 */
|
|
|
|
NULL,
|
|
|
|
o1_loadNewPrcName,
|
|
|
|
o1_requestCheckPendingDataLoad,
|
|
|
|
NULL,
|
|
|
|
/* 44 */
|
|
|
|
NULL,
|
|
|
|
o1_blitAndFade,
|
|
|
|
o1_fadeToBlack,
|
|
|
|
o1_transformPaletteRange,
|
|
|
|
/* 48 */
|
|
|
|
NULL,
|
|
|
|
o1_setDefaultMenuColor2,
|
|
|
|
o1_palRotate,
|
|
|
|
NULL,
|
|
|
|
/* 4C */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
o1_break,
|
|
|
|
/* 50 */
|
|
|
|
o1_endScript,
|
|
|
|
o1_message,
|
|
|
|
o1_loadGlobalVar,
|
|
|
|
o1_compareGlobalVar,
|
|
|
|
/* 54 */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
/* 58 */
|
|
|
|
NULL,
|
|
|
|
o1_declareFunctionName,
|
|
|
|
o1_freePartRange,
|
|
|
|
o1_unloadAllMasks,
|
|
|
|
// 5C */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
/* 60 */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
o1_op63,
|
|
|
|
/* 64 */
|
|
|
|
o1_op64,
|
|
|
|
o1_initializeZoneData,
|
|
|
|
o1_setZoneDataEntry,
|
|
|
|
o1_getZoneDataEntry,
|
|
|
|
/* 68 */
|
|
|
|
o1_setDefaultMenuColor,
|
|
|
|
o1_allowPlayerInput,
|
|
|
|
o1_disallowPlayerInput,
|
|
|
|
o1_changeDataDisk,
|
|
|
|
/* 6C */
|
|
|
|
NULL,
|
|
|
|
o1_loadMusic,
|
|
|
|
o1_playMusic,
|
|
|
|
o1_fadeOutMusic,
|
|
|
|
/* 70 */
|
|
|
|
o1_stopSample,
|
|
|
|
o1_op71,
|
|
|
|
o1_op72,
|
2006-04-08 19:26:15 +00:00
|
|
|
o1_op72,
|
2006-04-08 13:20:40 +00:00
|
|
|
/* 74 */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
o1_playSample,
|
|
|
|
/* 78 */
|
2006-04-08 19:26:15 +00:00
|
|
|
o2_op78,
|
2006-04-08 13:20:40 +00:00
|
|
|
o1_allowSystemMenu,
|
|
|
|
o1_loadMask5,
|
|
|
|
o1_unloadMask5,
|
|
|
|
/* 7C */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
o2_addSeqListElement,
|
|
|
|
/* 80 */
|
|
|
|
o2_removeSeq,
|
|
|
|
o2_op81,
|
|
|
|
o2_op82,
|
|
|
|
o2_isSeqRunning,
|
|
|
|
/* 84 */
|
|
|
|
o2_gotoIfSupNearest,
|
|
|
|
o2_gotoIfSupEquNearest,
|
|
|
|
o2_gotoIfInfNearest,
|
|
|
|
o2_gotoIfInfEquNearest,
|
|
|
|
/* 88 */
|
|
|
|
o2_gotoIfEquNearest,
|
|
|
|
o2_gotoIfDiffNearest,
|
|
|
|
NULL,
|
|
|
|
o2_startObjectScript,
|
|
|
|
/* 8C */
|
|
|
|
o2_stopObjectScript,
|
|
|
|
o2_op8D,
|
|
|
|
o2_addBackground,
|
|
|
|
o2_removeBackground,
|
|
|
|
/* 90 */
|
|
|
|
o2_loadAbs,
|
|
|
|
o2_loadBg,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
/* 94 */
|
|
|
|
NULL,
|
2006-04-08 19:26:15 +00:00
|
|
|
o1_changeDataDisk,
|
2006-04-08 13:20:40 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
/* 98 */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
o2_wasZoneChecked,
|
|
|
|
o2_op9B,
|
|
|
|
/* 9C */
|
|
|
|
o2_op9C,
|
|
|
|
o2_useBgScroll,
|
|
|
|
o2_setAdditionalBgVScroll,
|
|
|
|
o2_op9F,
|
|
|
|
/* A0 */
|
|
|
|
o2_addGfxElementA0,
|
|
|
|
o2_opA1,
|
|
|
|
o2_opA2,
|
|
|
|
o2_opA3,
|
|
|
|
/* A4 */
|
2006-04-08 19:26:15 +00:00
|
|
|
o2_loadMask22,
|
|
|
|
o2_unloadMask22,
|
2006-04-08 13:20:40 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
/* A8 */
|
|
|
|
NULL,
|
2006-04-08 19:26:15 +00:00
|
|
|
o1_changeDataDisk
|
2006-04-08 13:20:40 +00:00
|
|
|
};
|
|
|
|
|
2006-10-15 01:06:44 +00:00
|
|
|
if (g_cine->getGameType() == Cine::GType_FW) {
|
2006-04-08 13:20:40 +00:00
|
|
|
_opcodeTable = opcodeTableFW;
|
|
|
|
_numOpcodes = ARRAYSIZE(opcodeTableFW);
|
|
|
|
} else {
|
|
|
|
_opcodeTable = opcodeTableOS;
|
|
|
|
_numOpcodes = ARRAYSIZE(opcodeTableOS);
|
|
|
|
}
|
|
|
|
}
|
2006-04-08 06:47:58 +00:00
|
|
|
|
|
|
|
byte getNextByte() {
|
|
|
|
byte val = *(_currentScriptPtr + _currentPosition);
|
|
|
|
_currentPosition++;
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint16 getNextWord() {
|
|
|
|
uint16 val = READ_BE_UINT16(_currentScriptPtr + _currentPosition);
|
|
|
|
_currentPosition += 2;
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *getNextString() {
|
|
|
|
const char *val = (const char *)(_currentScriptPtr + _currentPosition);
|
|
|
|
_currentPosition += strlen(val);
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
void addGfxElementA0(int16 param1, int16 param2) {
|
2006-02-22 22:40:53 +00:00
|
|
|
overlayHeadElement *currentHead = &overlayHead;
|
|
|
|
overlayHeadElement *tempHead = currentHead;
|
|
|
|
overlayHeadElement *newElement;
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
while (currentHead) {
|
2006-02-23 19:28:36 +00:00
|
|
|
if (objectTable[currentHead->objIdx].mask == objectTable[param1].mask) {
|
2006-02-22 22:40:53 +00:00
|
|
|
if (currentHead->type == 2 || currentHead->objIdx == 3) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tempHead = currentHead;
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
}
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
if (currentHead && currentHead->objIdx == param1 && currentHead->type == 20 && currentHead->x == param2)
|
2006-02-22 22:40:53 +00:00
|
|
|
return;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
newElement = (overlayHeadElement *)malloc(sizeof(overlayHeadElement));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
newElement->next = tempHead->next;
|
|
|
|
tempHead->next = newElement;
|
|
|
|
|
|
|
|
newElement->objIdx = param1;
|
|
|
|
newElement->type = 20;
|
|
|
|
|
|
|
|
newElement->x = param2;
|
|
|
|
newElement->y = 0;
|
2006-03-09 23:02:29 +00:00
|
|
|
newElement->width = 0;
|
|
|
|
newElement->color = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
if (!currentHead)
|
|
|
|
currentHead = &overlayHead;
|
|
|
|
|
|
|
|
newElement->previous = currentHead->previous;
|
|
|
|
|
|
|
|
currentHead->previous = newElement;
|
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
void removeSeq(uint16 param1, uint16 param2, uint16 param3) {
|
2006-02-27 21:25:59 +00:00
|
|
|
SeqListElement *currentHead = &seqList;
|
|
|
|
SeqListElement *tempHead = currentHead;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
while (currentHead && (currentHead->var6 != param1 || currentHead->var4 != param2 || currentHead->varE != param3)) {
|
2006-02-22 22:40:53 +00:00
|
|
|
tempHead = currentHead;
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
}
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
if (currentHead && currentHead->var6 == param1 && currentHead->var4 == param2 && currentHead->varE == param3) {
|
2006-02-22 22:40:53 +00:00
|
|
|
currentHead->var4 = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 isSeqRunning(uint16 param1, uint16 param2, uint16 param3) {
|
2006-02-27 21:25:59 +00:00
|
|
|
SeqListElement *currentHead = &seqList;
|
|
|
|
SeqListElement *tempHead = currentHead;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
while (currentHead && (currentHead->var6 != param1 || currentHead->var4 != param2 || currentHead->varE != param3)) {
|
2006-02-22 22:40:53 +00:00
|
|
|
tempHead = currentHead;
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
}
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
if (currentHead && currentHead->var6 == param1 && currentHead->var4 == param2 && currentHead->varE == param3) {
|
2006-04-08 08:04:23 +00:00
|
|
|
return 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
return 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
scriptStruct scriptTable[NUM_MAX_SCRIPT];
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
void stopGlobalScript(uint16 scriptIdx) {
|
2006-02-22 22:40:53 +00:00
|
|
|
prcLinkedListStruct *currentHead = &globalScriptsHead;
|
|
|
|
prcLinkedListStruct *tempHead = currentHead;
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
while (currentHead && (currentHead->scriptIdx != scriptIdx)) {
|
|
|
|
tempHead = currentHead;
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!currentHead) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (currentHead->scriptIdx != scriptIdx) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
currentHead->scriptIdx = -1;
|
|
|
|
}
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
uint16 computeScriptStackSub(byte mode, byte *scriptPtr, int16 *stackPtr, uint16 scriptSize, byte param1, uint16 startOffset) {
|
2006-02-22 22:40:53 +00:00
|
|
|
byte *localScriptPtr = scriptPtr;
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 exitScript;
|
|
|
|
uint16 i;
|
|
|
|
uint16 position;
|
|
|
|
uint16 di;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
assert(scriptPtr);
|
|
|
|
assert(stackPtr);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
if (mode == 1) {
|
|
|
|
for (i = 0; i < SCRIPT_STACK_SIZE; i++) {
|
|
|
|
stackPtr[i] = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
position = 0;
|
|
|
|
} else {
|
|
|
|
position = startOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
exitScript = 0;
|
|
|
|
|
|
|
|
do {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 opcode = *(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position++;
|
|
|
|
|
|
|
|
//printf("Opcode: %X\n",opcode-1);
|
|
|
|
|
|
|
|
switch (opcode - 1) {
|
|
|
|
case -1:
|
|
|
|
case 0x1B:
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x89:
|
|
|
|
case 0x32:
|
|
|
|
case 0x7A:
|
|
|
|
case 0x91:
|
|
|
|
case 0x9D:
|
|
|
|
case 0x8F:
|
|
|
|
case 0x7B:
|
|
|
|
case 0x8C:
|
|
|
|
case 0x8B:
|
|
|
|
case 0x85:
|
|
|
|
case 0x86:
|
|
|
|
case 0x84:
|
|
|
|
case 0x88:
|
|
|
|
{
|
|
|
|
position++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x80:
|
|
|
|
case 0x83:
|
|
|
|
case 0x26:
|
|
|
|
{
|
|
|
|
position += 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xF:
|
|
|
|
case 0x1:
|
|
|
|
case 0x66:
|
|
|
|
case 0x4A:
|
|
|
|
{
|
|
|
|
position += 3;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x0:
|
|
|
|
case 0x2:
|
|
|
|
case 0x3:
|
|
|
|
case 0x4:
|
|
|
|
case 0x5:
|
|
|
|
case 0x6:
|
|
|
|
case 0xA0:
|
|
|
|
case 0xA1:
|
|
|
|
case 0xA2:
|
|
|
|
case 0xA3:
|
|
|
|
{
|
|
|
|
position += 4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x9:
|
|
|
|
case 0xA:
|
|
|
|
case 0xB:
|
|
|
|
case 0xC:
|
|
|
|
case 0xD:
|
|
|
|
case 0xE:
|
|
|
|
case 0x52:
|
|
|
|
case 0x53:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
position++;
|
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param) {
|
|
|
|
position++;
|
|
|
|
} else {
|
|
|
|
position += 2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x9E:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param) {
|
|
|
|
position++;
|
|
|
|
} else {
|
|
|
|
position += 2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x82:
|
|
|
|
{
|
|
|
|
position += 7;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x47:
|
|
|
|
{
|
|
|
|
position += 8;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x51:
|
|
|
|
case 0x7:
|
|
|
|
case 0x77:
|
|
|
|
case 0x78:
|
|
|
|
case 0x8:
|
|
|
|
{
|
|
|
|
position += 9;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x7F:
|
|
|
|
{
|
|
|
|
position += 10;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1D:
|
|
|
|
{
|
|
|
|
di = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (mode == 1) {
|
|
|
|
stackPtr[di] = position;
|
|
|
|
} else {
|
|
|
|
if (param1 == di) {
|
2006-04-08 08:04:23 +00:00
|
|
|
return position;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x59:
|
|
|
|
case 0x3B:
|
|
|
|
case 0x3C:
|
|
|
|
case 0x3D:
|
|
|
|
case OP_loadPart: // skipString
|
|
|
|
case 0x6D:
|
|
|
|
case 0x8E:
|
|
|
|
{
|
|
|
|
do {
|
|
|
|
position++;
|
|
|
|
} while (*(localScriptPtr + position));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x90:
|
|
|
|
case OP_loadNewPrcName: //skipVarAndString
|
|
|
|
{
|
|
|
|
di = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
do {
|
|
|
|
position++;
|
|
|
|
} while (*(localScriptPtr + position));
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x46:
|
|
|
|
case 0x65:
|
|
|
|
case 0x4F:
|
|
|
|
case 0x40:
|
|
|
|
case 0x6A:
|
|
|
|
case 0x69:
|
|
|
|
case 0x45:
|
|
|
|
case 0x6E:
|
|
|
|
case 0x6F:
|
|
|
|
case 0x70:
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1E:
|
|
|
|
case 0x1F:
|
|
|
|
case 0x20:
|
|
|
|
case 0x21:
|
|
|
|
case 0x22:
|
|
|
|
case 0x23:
|
|
|
|
case 0x24:
|
|
|
|
case 0x25:
|
|
|
|
case 0x68:
|
|
|
|
case 0x49:
|
|
|
|
case 0x31:
|
|
|
|
case 0x13:
|
|
|
|
case 0x14:
|
|
|
|
case 0x15:
|
|
|
|
case 0x16:
|
|
|
|
case 0x17:
|
|
|
|
case 0x18:
|
|
|
|
case 0x19:
|
|
|
|
case 0x1A:
|
|
|
|
{
|
|
|
|
position++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x5A:
|
|
|
|
{
|
|
|
|
position += 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x5B:
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case OP_changeDataDisk: // skipVar
|
|
|
|
case OP_79:
|
|
|
|
{
|
|
|
|
di = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case OP_endScript: // end
|
|
|
|
{
|
|
|
|
exitScript = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case OP_requestCheckPendingDataLoad: // nop
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
2006-04-12 01:48:15 +00:00
|
|
|
error("Unsupported opcode %X in computeScriptStack", opcode - 1);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (position > scriptSize) {
|
|
|
|
exitScript = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
} while (!exitScript);
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
return position;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
void computeScriptStack(byte *scriptPtr, int16 *stackPtr, uint16 scriptSize) {
|
2006-02-22 22:40:53 +00:00
|
|
|
computeScriptStackSub(1, scriptPtr, stackPtr, scriptSize, 0, 0);
|
|
|
|
}
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
uint16 computeScriptStackFromScript(byte *scriptPtr, uint16 currentPosition, uint16 labelIdx, uint16 scriptSize) {
|
|
|
|
return computeScriptStackSub(0, scriptPtr, (int16 *)&dummyU16, (uint16)scriptSize, labelIdx, currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
void palRotate(byte a, byte b, byte c) {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 i;
|
|
|
|
uint16 currentColor;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 11:05:58 +00:00
|
|
|
if (c == 1) {
|
|
|
|
currentColor = c_palette[b];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 11:05:58 +00:00
|
|
|
for (i = b; i > a; i--) {
|
2006-02-22 22:40:53 +00:00
|
|
|
c_palette[i] = c_palette[i - 1];
|
|
|
|
}
|
|
|
|
|
2006-02-23 11:05:58 +00:00
|
|
|
c_palette[a] = currentColor;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
void addScriptToList0(uint16 idx) {
|
|
|
|
uint16 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
prcLinkedListStruct *pNewElement;
|
|
|
|
prcLinkedListStruct *currentHead = &globalScriptsHead;
|
|
|
|
prcLinkedListStruct *tempHead = currentHead;
|
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
assert(idx <= NUM_MAX_SCRIPT);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
tempHead = currentHead;
|
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
assert(tempHead);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
}
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
pNewElement =(prcLinkedListStruct *)malloc(sizeof(prcLinkedListStruct));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
assert(pNewElement);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
pNewElement->next = tempHead->next;
|
|
|
|
tempHead->next = pNewElement;
|
|
|
|
|
|
|
|
// copy the stack into the script instance
|
|
|
|
for (i = 0; i < SCRIPT_STACK_SIZE; i++) {
|
|
|
|
pNewElement->stack[i] = scriptTable[idx].stack[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 50; i++) {
|
|
|
|
pNewElement->localVars[i] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
pNewElement->compareResult = 0;
|
|
|
|
pNewElement->scriptPosition = 0;
|
|
|
|
|
|
|
|
pNewElement->scriptPtr = scriptTable[idx].ptr;
|
|
|
|
pNewElement->scriptIdx = idx;
|
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 endScript0(uint16 scriptIdx) {
|
2006-02-22 22:40:53 +00:00
|
|
|
prcLinkedListStruct *currentHead = &globalScriptsHead;
|
|
|
|
prcLinkedListStruct *tempHead = currentHead;
|
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
//assert(scriptIdx <= NUM_MAX_SCRIPT);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
while (currentHead && currentHead->scriptIdx != scriptIdx) {
|
|
|
|
tempHead = currentHead;
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!currentHead) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (currentHead->scriptIdx != scriptIdx) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
currentHead->scriptIdx = -1;
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
return 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 endScript1(uint16 scriptIdx) {
|
2006-02-22 22:40:53 +00:00
|
|
|
prcLinkedListStruct *currentHead = &objScriptList;
|
|
|
|
prcLinkedListStruct *tempHead = currentHead;
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
while (currentHead && currentHead->scriptIdx != scriptIdx) {
|
|
|
|
tempHead = currentHead;
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!currentHead) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (currentHead->scriptIdx != scriptIdx) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
currentHead->scriptIdx = -1;
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
return 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
int16 getZoneFromPosition(byte *page, int16 x, int16 y, int16 width) {
|
|
|
|
byte *ptr = page + (y * width) + x / 2;
|
|
|
|
byte zoneVar;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
if (!(x % 2)) {
|
|
|
|
zoneVar = (*(ptr) >> 4) & 0xF;
|
|
|
|
} else {
|
|
|
|
zoneVar = (*(ptr)) & 0xF;
|
|
|
|
}
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
return zoneVar;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
int16 getZoneFromPositionRaw(byte *page, int16 x, int16 y, int16 width) {
|
|
|
|
byte *ptr = page + (y * width) + x;
|
|
|
|
byte zoneVar;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
zoneVar = (*(ptr)) & 0xF;
|
|
|
|
|
2006-04-08 08:04:23 +00:00
|
|
|
return zoneVar;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 checkCollision(int16 objIdx, int16 x, int16 y, int16 numZones, int16 zoneIdx) {
|
|
|
|
int16 i;
|
|
|
|
int16 lx;
|
|
|
|
int16 ly;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
lx = objectTable[objIdx].x + x;
|
|
|
|
ly = objectTable[objIdx].y + y;
|
|
|
|
|
|
|
|
for (i = 0; i < numZones; i++) {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 idx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:12:56 +00:00
|
|
|
idx = getZoneFromPositionRaw(page3Raw, lx + i, ly, 320);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
assert(idx >= 0 && idx <= NUM_MAX_ZONE);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
if (zoneData[idx] == zoneIdx) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-02-23 11:05:58 +00:00
|
|
|
uint16 compareVars(int16 a, int16 b) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 flag = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 11:05:58 +00:00
|
|
|
if (a == b) {
|
2006-04-08 17:19:07 +00:00
|
|
|
flag |= kCmpEQ;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2006-02-23 11:05:58 +00:00
|
|
|
if (a > b) {
|
2006-04-08 17:19:07 +00:00
|
|
|
flag |= kCmpGT;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2006-02-23 11:05:58 +00:00
|
|
|
if (a < b) {
|
2006-04-08 17:19:07 +00:00
|
|
|
flag |= kCmpLT;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return flag;
|
|
|
|
}
|
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// FUTURE WARS opcodes
|
|
|
|
// ------------------------------------------------------------------------
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_modifyObjectParam() {
|
|
|
|
byte objIdx = getNextByte();
|
|
|
|
byte paramIdx = getNextByte();
|
|
|
|
int16 newValue = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: modifyObjectParam(objIdx:%d,paramIdx:%d,newValue:%d)", _currentLine, objIdx, paramIdx, newValue);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
modifyObjectParam(objIdx, paramIdx, newValue);
|
|
|
|
}
|
2006-04-08 06:47:58 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_getObjectParam() {
|
|
|
|
byte objIdx = getNextByte();
|
|
|
|
byte paramIdx = getNextByte();
|
|
|
|
byte newValue = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: getObjectParam(objIdx:%d,paramIdx:%d,var:%d)", _currentLine, objIdx, paramIdx, newValue);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->localVars[newValue] = getObjectParam(objIdx, paramIdx);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_addObjectParam() {
|
|
|
|
byte objIdx = getNextByte();
|
|
|
|
byte paramIdx = getNextByte();
|
|
|
|
int16 newValue = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addObjectParam(objIdx:%d,paramIdx:%d,newValue:%d)", _currentLine, objIdx, paramIdx, newValue);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
addObjectParam(objIdx, paramIdx, newValue);
|
|
|
|
}
|
2006-04-06 22:33:23 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_subObjectParam() {
|
|
|
|
byte objIdx = getNextByte();
|
|
|
|
byte paramIdx = getNextByte();
|
|
|
|
int16 newValue = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: subObjectParam(objIdx:%d,paramIdx:%d,newValue:%d)", _currentLine, objIdx, paramIdx, newValue);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
subObjectParam(objIdx, paramIdx, newValue);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_add2ObjectParam() {
|
|
|
|
warning("STUB: o1_add2ObjectParam()");
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_sub2ObjectParam() {
|
|
|
|
warning("STUB: o1_sub2ObjectParam()");
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_compareObjectParam() {
|
|
|
|
byte objIdx = getNextByte();
|
|
|
|
byte param1 = getNextByte();
|
|
|
|
int16 param2 = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: compareObjectParam(objIdx:%d,type:%d,value:%d)", _currentLine, objIdx, param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->compareResult = compareObjectParam(objIdx, param1, param2);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_setupObject() {
|
|
|
|
byte objIdx = getNextByte();
|
|
|
|
int16 param1 = getNextWord();
|
|
|
|
int16 param2 = getNextWord();
|
|
|
|
int16 param3 = getNextWord();
|
|
|
|
int16 param4 = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: setupObject(objIdx:%d,%d,%d,%d,%d)", _currentLine, objIdx, param1, param2, param3, param4);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
setupObject(objIdx, param1, param2, param3, param4);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_checkCollision() {
|
|
|
|
byte objIdx = getNextByte();
|
|
|
|
int16 param1 = getNextWord();
|
|
|
|
int16 param2 = getNextWord();
|
|
|
|
int16 param3 = getNextWord();
|
|
|
|
int16 param4 = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: checkCollision(objIdx:%d,%d,%d,%d,%d)", _currentLine, objIdx, param1, param2, param3, param4);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->compareResult = checkCollision(objIdx, param1, param2, param3, param4);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_loadVar() {
|
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte varType = getNextByte();
|
|
|
|
|
|
|
|
if (varType) {
|
|
|
|
byte dataIdx = getNextByte();
|
|
|
|
int16 var;
|
|
|
|
|
|
|
|
switch (varType) {
|
|
|
|
case 1:
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] = var[%d]", _currentLine, varIdx, dataIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->localVars[varIdx] = _currentScriptElement->localVars[dataIdx];
|
|
|
|
break;
|
|
|
|
case 2:
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] = globalVars[%d]", _currentLine, varIdx, dataIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->localVars[varIdx] = globalVars[dataIdx];
|
|
|
|
break;
|
|
|
|
case 3:
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] = mouseX", _currentLine, varIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
getMouseData(mouseUpdateStatus, &dummyU16, (uint16 *)&var, (uint16 *)&dummyU16);
|
|
|
|
_currentScriptElement->localVars[varIdx] = var;
|
|
|
|
break;
|
|
|
|
case 4:
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] = mouseY", _currentLine, varIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
getMouseData(mouseUpdateStatus, &dummyU16, (uint16 *)&dummyU16, (uint16 *)&var);
|
|
|
|
_currentScriptElement->localVars[varIdx] = var;
|
|
|
|
break;
|
|
|
|
case 5:
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] = rand mod %d", _currentLine, varIdx, dataIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->localVars[varIdx] = rand() % dataIdx;
|
|
|
|
break;
|
|
|
|
case 8:
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] = file[%d].packedSize", _currentLine, varIdx, dataIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->localVars[varIdx] = partBuffer[dataIdx].packedSize;
|
|
|
|
break;
|
|
|
|
case 9:
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] = file[%d].unpackedSize", _currentLine, varIdx, dataIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->localVars[varIdx] = partBuffer[dataIdx].unpackedSize;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("executeScript: o1_loadVar: Unknown variable type %d", varType);
|
|
|
|
}
|
|
|
|
} else {
|
2006-04-08 14:03:14 +00:00
|
|
|
int16 value = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] = %d", _currentLine, varIdx, value);
|
2006-04-08 14:03:14 +00:00
|
|
|
_currentScriptElement->localVars[varIdx] = value;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_addVar() {
|
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte varType = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType) {
|
|
|
|
byte dataIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] += var[%d]", _currentLine, varIdx, dataIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->localVars[varIdx] += _currentScriptElement->localVars[dataIdx];
|
|
|
|
} else {
|
2006-04-08 14:03:14 +00:00
|
|
|
int16 value = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] += %d", _currentLine, varIdx, value);
|
2006-04-08 14:03:14 +00:00
|
|
|
_currentScriptElement->localVars[varIdx] += value;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_subVar() {
|
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte varType = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType) {
|
|
|
|
byte dataIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] -= var[%d]", _currentLine, varIdx, dataIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->localVars[varIdx] -= _currentScriptElement->localVars[dataIdx];
|
|
|
|
} else {
|
2006-04-08 14:03:14 +00:00
|
|
|
int16 value = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] -= %d", _currentLine, varIdx, value);
|
2006-04-08 14:03:14 +00:00
|
|
|
_currentScriptElement->localVars[varIdx] -= value;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_mulVar() {
|
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte varType = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType) {
|
|
|
|
byte dataIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] *= var[%d]", _currentLine, varIdx, dataIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->localVars[varIdx] *= _currentScriptElement->localVars[dataIdx];
|
|
|
|
} else {
|
2006-04-08 14:03:14 +00:00
|
|
|
int16 value = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] *= %d", _currentLine, varIdx, value);
|
2006-04-08 14:03:14 +00:00
|
|
|
_currentScriptElement->localVars[varIdx] *= value;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_divVar() {
|
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte varType = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType) {
|
|
|
|
byte dataIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] /= var[%d]", _currentLine, varIdx, dataIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->localVars[varIdx] /= _currentScriptElement->localVars[dataIdx];
|
|
|
|
} else {
|
2006-04-08 14:03:14 +00:00
|
|
|
int16 value = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] /= %d", _currentLine, varIdx, value);
|
2006-04-08 14:03:14 +00:00
|
|
|
_currentScriptElement->localVars[varIdx] /= value;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_compareVar() {
|
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte varType = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType) {
|
|
|
|
byte dataIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
// printf("Val: %d\n", dataIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType == 1) {
|
|
|
|
assert(varIdx < 50);
|
|
|
|
assert(dataIdx < 50);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: compare var[%d] and var[%d]", _currentLine, varIdx, dataIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->compareResult = compareVars(_currentScriptElement->localVars[varIdx], _currentScriptElement->localVars[dataIdx]);
|
|
|
|
} else if (varType == 2) {
|
|
|
|
assert(varIdx < 50);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: compare var[%d] and globalVar[%d]", _currentLine, varIdx, dataIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->compareResult = compareVars(_currentScriptElement->localVars[varIdx], globalVars[dataIdx]);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
int16 value = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: compare var[%d] and %d", _currentLine, varIdx, value);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->compareResult = compareVars(_currentScriptElement->localVars[varIdx], value);
|
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_modifyObjectParam2() {
|
|
|
|
byte objIdx = getNextByte();
|
|
|
|
byte paramIdx = getNextByte();
|
|
|
|
byte newValue = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: modifyObjectParam2(objIdx:%d,paramIdx:%d,var[%d])", _currentLine, objIdx, paramIdx, newValue);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
modifyObjectParam(objIdx, paramIdx, _currentScriptElement->localVars[newValue]);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_loadMask0() {
|
|
|
|
// OP_loadV7Element
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addSpriteOverlay(%d)", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
loadOverlayElement(param, 0);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_unloadMask0() {
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: removeSpriteOverlay(%d)", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
freeOverlay(param, 0);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_addToBgList() {
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addToBGList(%d)", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
addToBGList(param);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_loadMask1() {
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addOverlay1(%d)", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
loadOverlayElement(param, 1);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_unloadMask1() {
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: removeOverlay1(%d)", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
freeOverlay(param, 1);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_loadMask4() {
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addOverlayType4(%d)", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
loadOverlayElement(param, 4);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_unloadMask4() {
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: removeSpriteOverlay4(%d)", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
freeOverlay(param, 4);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_addSpriteFilledToBgList() {
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: op1A(%d) -> TODO !", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
addSpriteFilledToBGList(param);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_op1B() {
|
2006-11-08 21:46:57 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: freeBgIncrustList", _currentLine);
|
|
|
|
freeBgIncrustList();
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_label() {
|
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: label(%d)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->stack[labelIdx] = _currentPosition;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_goto() {
|
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(_currentScriptElement->stack[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: goto label(%d)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentPosition = _currentScriptElement->stack[labelIdx];
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_gotoIfSup() {
|
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 17:19:07 +00:00
|
|
|
if (_currentScriptElement->compareResult == kCmpGT) {
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(_currentScriptElement->stack[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(>) goto %d (true)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentPosition = _currentScriptElement->stack[labelIdx];
|
|
|
|
} else {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(>) goto %d (false)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_gotoIfSupEqu() {
|
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 17:19:07 +00:00
|
|
|
if (_currentScriptElement->compareResult & (kCmpGT | kCmpEQ)) {
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(_currentScriptElement->stack[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(>=) goto %d (true)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentPosition = _currentScriptElement->stack[labelIdx];
|
|
|
|
} else {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(>=) goto %d (false)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_gotoIfInf() {
|
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 17:19:07 +00:00
|
|
|
if (_currentScriptElement->compareResult == kCmpLT) {
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(_currentScriptElement->stack[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(<) goto %d (true)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentPosition = _currentScriptElement->stack[labelIdx];
|
|
|
|
} else {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(<) goto %d (false)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_gotoIfInfEqu() {
|
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 17:19:07 +00:00
|
|
|
if (_currentScriptElement->compareResult & (kCmpLT | kCmpEQ)) {
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(_currentScriptElement->stack[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(<=) goto %d (true)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentPosition = _currentScriptElement->stack[labelIdx];
|
|
|
|
} else {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(<=) goto %d (false)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_gotoIfEqu() {
|
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 17:19:07 +00:00
|
|
|
if (_currentScriptElement->compareResult == kCmpEQ) {
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(_currentScriptElement->stack[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(==) goto %d (true)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentPosition = _currentScriptElement->stack[labelIdx];
|
|
|
|
} else {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(==) goto %d (false)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_gotoIfDiff() {
|
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 17:19:07 +00:00
|
|
|
if (_currentScriptElement->compareResult != kCmpEQ) {
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(_currentScriptElement->stack[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(!=) goto %d (true)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentPosition = _currentScriptElement->stack[labelIdx];
|
|
|
|
} else {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(!=) goto %d (false)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_removeLabel() {
|
2006-04-08 17:51:20 +00:00
|
|
|
// TODO: verify this
|
|
|
|
byte labelIdx = getNextByte();
|
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: removeLabel(%d)", _currentLine, labelIdx);
|
2006-04-08 17:51:20 +00:00
|
|
|
_currentScriptElement->stack[labelIdx] = -1;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_loop() {
|
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->localVars[varIdx]--;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (_currentScriptElement->localVars[varIdx] >= 0) {
|
|
|
|
assert(_currentScriptElement->stack[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loop(var[%d]) goto %d (continue)", _currentLine, varIdx, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentPosition = _currentScriptElement->stack[labelIdx];
|
|
|
|
} else {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loop(var[%d]) goto %d (stop)", _currentLine, varIdx, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_startGlobalScript() {
|
|
|
|
// OP_startScript
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(param < NUM_MAX_SCRIPT);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: startScript(%d)", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
addScriptToList0(param);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_endGlobalScript() {
|
|
|
|
byte scriptIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: stopGlobalScript(%d)", _currentLine, scriptIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
stopGlobalScript(scriptIdx);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_loadAnim() {
|
|
|
|
// OP_loadResource
|
|
|
|
const char *param = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadResource(\"%s\")", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
loadResource(param);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_loadBg() {
|
|
|
|
const char *param = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadBg(\"%s\")", _currentLine, param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
loadBg(param);
|
2006-11-08 21:46:57 +00:00
|
|
|
freeBgIncrustList();
|
2006-04-08 13:20:40 +00:00
|
|
|
bgVar0 = 0;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_loadCt() {
|
|
|
|
const char *param = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadCt(\"%s\")", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
loadCt(param);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_loadPart() {
|
|
|
|
const char *param = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadPart(\"%s\")", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
loadPart(param);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_closePart() {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: closePart", _currentLine);
|
2006-04-08 13:20:40 +00:00
|
|
|
closePart();
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_loadNewPrcName() {
|
|
|
|
// OP_loadData
|
|
|
|
byte param1 = getNextByte();
|
|
|
|
const char *param2 = getNextString();
|
|
|
|
|
|
|
|
assert(param1 <= 3);
|
|
|
|
|
|
|
|
switch (param1) {
|
|
|
|
case 0:
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadPrc(\"%s\")", _currentLine, param2);
|
2006-04-08 13:20:40 +00:00
|
|
|
strcpy(newPrcName, param2);
|
|
|
|
break;
|
|
|
|
case 1:
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadRel(\"%s\")", _currentLine, param2);
|
2006-04-08 13:20:40 +00:00
|
|
|
strcpy(newRelName, param2);
|
|
|
|
break;
|
|
|
|
case 2:
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadObject(\"%s\")", _currentLine, param2);
|
2006-04-08 13:20:40 +00:00
|
|
|
strcpy(newObjectName, param2);
|
|
|
|
break;
|
|
|
|
case 3:
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadMsg(\"%s\")", _currentLine, param2);
|
2006-04-08 13:20:40 +00:00
|
|
|
strcpy(newMsgName, param2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_requestCheckPendingDataLoad() {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: request data load", _currentLine);
|
2006-04-08 13:20:40 +00:00
|
|
|
checkForPendingDataLoadSwitch = 1;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_blitAndFade() {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: request fadein", _currentLine);
|
2006-04-08 13:20:40 +00:00
|
|
|
// TODO: use real code
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
memcpy(c_palette, tempPalette, sizeof(uint16) * 16);
|
|
|
|
drawOverlays();
|
|
|
|
flip();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
fadeRequired = 1;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_fadeToBlack() {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: request fadeout", _currentLine);
|
2006-04-08 13:20:40 +00:00
|
|
|
//fadeToBlack();
|
|
|
|
warning("STUB: o1_fadeToBlack()");
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_transformPaletteRange() {
|
|
|
|
byte startColor = getNextByte();
|
|
|
|
byte numColor = getNextByte();
|
|
|
|
uint16 r = getNextWord();
|
|
|
|
uint16 g = getNextWord();
|
|
|
|
uint16 b = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: transformPaletteRange(from:%d,numIdx:%d,r:%d,g:%d,b:%d) -> unimplemented", _currentLine, startColor, numColor, r, g, b);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
transformPaletteRange(startColor, numColor, r, g, b);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_setDefaultMenuColor2() {
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: setDefaultMenuColor2(%d)", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
defaultMenuBoxColor2 = param;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_palRotate() {
|
|
|
|
byte a = getNextByte();
|
|
|
|
byte b = getNextByte();
|
|
|
|
byte c = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: palRotate(%d,%d,%d)", _currentLine, a, b, c);
|
2006-04-08 13:20:40 +00:00
|
|
|
palRotate(a, b, c);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_break() {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: break", _currentLine);
|
2006-04-08 06:47:58 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->scriptPosition = _currentPosition;
|
|
|
|
_closeScript = 1;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_endScript() {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: endScript", _currentLine);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (_currentScriptParams == 0) {
|
|
|
|
endScript0(_currentScriptElement->scriptIdx);
|
|
|
|
} else {
|
|
|
|
endScript1(_currentScriptElement->scriptIdx);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
_closeScript = 1;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_message() {
|
|
|
|
byte param1 = getNextByte();
|
|
|
|
uint16 param2 = getNextWord();
|
|
|
|
uint16 param3 = getNextWord();
|
|
|
|
uint16 param4 = getNextWord();
|
|
|
|
uint16 param5 = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: message(%d,%d,%d,%d,%d)", _currentLine, param1, param2, param3, param4, param5);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
addMessage(param1, param2, param3, param4, param5);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_loadGlobalVar() {
|
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte varType = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType) {
|
|
|
|
byte dataIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType == 1) {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: globalVars[%d] = var[%d]", _currentLine, varIdx, dataIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
globalVars[varIdx] = _currentScriptElement->localVars[dataIdx];
|
|
|
|
} else {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: globalVars[%d] = globalVars[%d]", _currentLine, varIdx, dataIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
globalVars[varIdx] = globalVars[dataIdx];
|
|
|
|
}
|
|
|
|
} else {
|
2006-04-08 14:03:14 +00:00
|
|
|
uint16 value = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: globalVars[%d] = %d", _currentLine, varIdx, value);
|
2006-04-08 14:03:14 +00:00
|
|
|
globalVars[varIdx] = value;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_compareGlobalVar() {
|
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte varType = getNextByte();
|
2006-04-06 22:33:23 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType) {
|
|
|
|
byte value = getNextByte();
|
2006-04-06 22:33:23 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: compare globalVars[%d] and var[%d]", _currentLine, varIdx, value);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->compareResult = compareVars(globalVars[varIdx], _currentScriptElement->localVars[value]);
|
|
|
|
} else {
|
2006-04-08 14:03:14 +00:00
|
|
|
uint16 value = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: compare globalVars[%d] and %d", _currentLine, varIdx, value);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-10-15 01:06:44 +00:00
|
|
|
if (varIdx == 255 && (g_cine->getGameType() == Cine::GType_FW)) { // TODO: fix
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentScriptElement->compareResult = 1;
|
|
|
|
} else {
|
2006-04-08 14:03:14 +00:00
|
|
|
_currentScriptElement->compareResult = compareVars(globalVars[varIdx], value);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_declareFunctionName() {
|
|
|
|
const char *param = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: comment(%s)", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_freePartRange() {
|
|
|
|
byte startIdx = getNextByte();
|
|
|
|
byte numIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(startIdx + numIdx <= NUM_MAX_ANIMDATA);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: freePartRange(%d,%d)", _currentLine, startIdx, numIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
freePartRange(startIdx, numIdx);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_unloadAllMasks() {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: unloadAllMasks()", _currentLine);
|
2006-04-08 13:20:40 +00:00
|
|
|
unloadAllMasks();
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_op63() {
|
|
|
|
warning("STUB: o1_op63()");
|
2006-04-08 19:26:15 +00:00
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
// setupScreenParam
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_op64() {
|
|
|
|
warning("STUB: o1_op64()");
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_initializeZoneData() {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: initializeZoneData()", _currentLine);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
for (int i = 0; i < NUM_MAX_ZONE; i++) {
|
|
|
|
zoneData[i] = i;
|
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_setZoneDataEntry() {
|
|
|
|
byte zoneIdx = getNextByte();
|
|
|
|
uint16 var = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: setZone[%d] = %d", _currentLine, zoneIdx, var);
|
2006-04-08 13:20:40 +00:00
|
|
|
zoneData[zoneIdx] = var;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_getZoneDataEntry() {
|
|
|
|
warning("STUB: o1_getZoneDataEntry()");
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_setDefaultMenuColor() {
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: setDefaultMenuColor(%d)", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
defaultMenuBoxColor = param;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_allowPlayerInput() {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: allowPlayerInput()", _currentLine);
|
2006-04-08 13:20:40 +00:00
|
|
|
allowPlayerInput = 1;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_disallowPlayerInput() {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: dissallowPlayerInput()", _currentLine);
|
2006-04-08 13:20:40 +00:00
|
|
|
allowPlayerInput = 0;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_changeDataDisk() {
|
|
|
|
byte newDisk = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: changeDataDisk(%d)", _currentLine, newDisk);
|
2006-04-08 13:20:40 +00:00
|
|
|
checkDataDisk(newDisk);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_loadMusic() {
|
|
|
|
const char *param = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadMusic(%s)", _currentLine, param);
|
2006-10-15 01:06:44 +00:00
|
|
|
|
|
|
|
if (g_cine->getPlatform() == Common::kPlatformAmiga) {
|
|
|
|
warning("STUB: o1_loadMusic");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
g_sfxPlayer->load(param);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_playMusic() {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: playMusic()", _currentLine);
|
2006-04-08 13:20:40 +00:00
|
|
|
g_sfxPlayer->play();
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_fadeOutMusic() {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: fadeOutMusic()", _currentLine);
|
2006-04-08 13:20:40 +00:00
|
|
|
g_sfxPlayer->fadeOut();
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_stopSample() {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: stopSample()", _currentLine);
|
2006-04-08 13:20:40 +00:00
|
|
|
g_sfxPlayer->stop();
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_op71() {
|
|
|
|
warning("STUB: o1_op71()");
|
2006-04-08 19:26:15 +00:00
|
|
|
getNextByte();
|
|
|
|
getNextWord();
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_op72() {
|
|
|
|
warning("STUB: o1_op72()");
|
2006-04-08 19:26:15 +00:00
|
|
|
getNextWord();
|
|
|
|
getNextByte();
|
|
|
|
getNextWord();
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_op73() {
|
2006-04-08 19:26:15 +00:00
|
|
|
// I believe this opcode is identical to o1_op72(). In fact, Operation
|
|
|
|
// Stealth doesn't even have it. It uses o1_op72() instead.
|
2006-04-08 13:20:40 +00:00
|
|
|
warning("STUB: o1_op73()");
|
2006-04-08 19:26:15 +00:00
|
|
|
getNextWord();
|
|
|
|
getNextByte();
|
|
|
|
getNextWord();
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_playSample() {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: playSample()", _currentLine);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
byte anim = getNextByte();
|
|
|
|
byte channel = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
getNextWord();
|
|
|
|
getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
int16 volume = getNextWord();
|
|
|
|
uint16 flag = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (volume > 63)
|
|
|
|
volume = 63;
|
|
|
|
if (volume < 0)
|
|
|
|
volume = 63;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (animDataTable[anim].ptr1) {
|
|
|
|
if (channel >= 10) {
|
|
|
|
channel -= 10;
|
|
|
|
}
|
|
|
|
if (volume < 50) {
|
|
|
|
volume = 50;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
g_sfxPlayer->stop();
|
|
|
|
|
|
|
|
if (flag == 0xFFFF) {
|
|
|
|
g_soundDriver->playSound(animDataTable[anim].ptr1, channel, volume);
|
|
|
|
} else {
|
|
|
|
g_soundDriver->resetChannel(channel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_allowSystemMenu() {
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: OP79 load var22 to %d -> TODO", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
var22 = param;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_loadMask5() {
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addOverlay5(%d)", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
loadOverlayElement(param, 5);
|
|
|
|
}
|
2006-04-08 06:47:58 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o1_unloadMask5() {
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: freeOverlay5(%d)", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
freeOverlay(param, 5);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// OPERATION STEALTH opcodes
|
|
|
|
// ------------------------------------------------------------------------
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_loadPart() {
|
|
|
|
const char *param = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadPart(\"%s\")", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 19:26:15 +00:00
|
|
|
void o2_op78() {
|
|
|
|
warning("STUB: o2_op78()");
|
|
|
|
// This is probably wrong, but preserve the old behaviour for now.
|
|
|
|
o1_playSample();
|
|
|
|
}
|
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_addSeqListElement() {
|
|
|
|
byte param1 = getNextByte();
|
|
|
|
byte param2 = getNextByte();
|
|
|
|
byte param3 = getNextByte();
|
|
|
|
byte param4 = getNextByte();
|
|
|
|
uint16 param5 = getNextWord();
|
|
|
|
uint16 param6 = getNextWord();
|
|
|
|
uint16 param7 = getNextWord();
|
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addSeqListElement(%d,%d,%d,%d,%d,%d,%d)", _currentLine, param1, param2, param3, param4, param5, param6, param7);
|
2006-04-08 13:20:40 +00:00
|
|
|
addSeqListElement(param1, 0, param2, param3, param4, param5, param6, 0, param7);
|
|
|
|
}
|
2006-04-08 06:47:58 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_removeSeq() {
|
|
|
|
byte a = getNextByte();
|
|
|
|
byte b = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: removeSeq(%d,%d) -> TODO", _currentLine, a, b);
|
2006-04-08 13:20:40 +00:00
|
|
|
removeSeq(a, 0, b);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_op81() {
|
|
|
|
warning("STUB: o2_op81()");
|
2006-04-08 19:26:15 +00:00
|
|
|
// freeUnkList();
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_op82() {
|
|
|
|
warning("STUB: o2_op82()");
|
2006-04-08 19:26:15 +00:00
|
|
|
getNextByte();
|
|
|
|
getNextByte();
|
|
|
|
getNextWord();
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_isSeqRunning() {
|
|
|
|
byte a = getNextByte();
|
|
|
|
byte b = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: OP83(%d,%d) -> TODO", _currentLine, a, b);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (isSeqRunning(a, 0, b)) {
|
|
|
|
_currentScriptElement->compareResult = 1;
|
|
|
|
} else {
|
|
|
|
_currentScriptElement->compareResult = 0;
|
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_gotoIfSupNearest() {
|
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 17:19:07 +00:00
|
|
|
if (_currentScriptElement->compareResult == kCmpGT) {
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(_currentScriptElement->stack[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(>) goto nearest %d (true)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentPosition = computeScriptStackFromScript(_currentScriptElement->scriptPtr, _currentPosition, labelIdx, scriptTable[_currentScriptElement->scriptIdx].size);
|
|
|
|
} else {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(>) goto nearest %d (false)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_gotoIfSupEquNearest() {
|
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 17:19:07 +00:00
|
|
|
if (_currentScriptElement->compareResult & (kCmpGT | kCmpEQ)) {
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(_currentScriptElement->stack[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(>=) goto nearest %d (true)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentPosition = computeScriptStackFromScript(_currentScriptElement->scriptPtr, _currentPosition, labelIdx, scriptTable[_currentScriptElement->scriptIdx].size);
|
|
|
|
} else {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(>=) goto nearest %d (false)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_gotoIfInfNearest() {
|
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 17:19:07 +00:00
|
|
|
if (_currentScriptElement->compareResult == kCmpLT) {
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(_currentScriptElement->stack[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(<) goto nearest %d (true)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentPosition = computeScriptStackFromScript(_currentScriptElement->scriptPtr, _currentPosition, labelIdx, scriptTable[_currentScriptElement->scriptIdx].size);
|
|
|
|
} else {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(<) goto nearest %d (false)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_gotoIfInfEquNearest() {
|
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 17:19:07 +00:00
|
|
|
if (_currentScriptElement->compareResult & (kCmpLT | kCmpEQ)) {
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(_currentScriptElement->stack[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(<=) goto nearest %d (true)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentPosition = computeScriptStackFromScript(_currentScriptElement->scriptPtr, _currentPosition, labelIdx, scriptTable[_currentScriptElement->scriptIdx].size);
|
|
|
|
} else {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(<=) goto nearest %d (false)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_gotoIfEquNearest() {
|
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 17:19:07 +00:00
|
|
|
if (_currentScriptElement->compareResult == kCmpEQ) {
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(_currentScriptElement->stack[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(==) goto nearest %d (true)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentPosition = computeScriptStackFromScript(_currentScriptElement->scriptPtr, _currentPosition, labelIdx, scriptTable[_currentScriptElement->scriptIdx].size);
|
|
|
|
} else {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(==) goto nearest %d (false)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_gotoIfDiffNearest() {
|
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 17:19:07 +00:00
|
|
|
if (_currentScriptElement->compareResult != kCmpEQ) {
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(_currentScriptElement->stack[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(!=) goto nearest %d (true)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
_currentPosition = computeScriptStackFromScript(_currentScriptElement->scriptPtr, _currentPosition, labelIdx, scriptTable[_currentScriptElement->scriptIdx].size);
|
|
|
|
} else {
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(!=) goto nearest %d (false)", _currentLine, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_startObjectScript() {
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: startObjectScript(%d)", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
runObjectScript(param);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_stopObjectScript() {
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: stopObjectScript(%d)", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
stopObjectScript(param);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_op8D() {
|
|
|
|
warning("STUB: o2_op8D()");
|
2006-04-08 19:26:15 +00:00
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
// _currentScriptElement->compareResult = ...
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_addBackground() {
|
2006-04-08 14:23:33 +00:00
|
|
|
byte param1 = getNextByte();
|
2006-04-08 13:20:40 +00:00
|
|
|
const char *param2 = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addBackground(%s,%d)", _currentLine, param2, param1);
|
2006-04-08 13:20:40 +00:00
|
|
|
addBackground(param2, param1);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_removeBackground() {
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: removeBackground(%d)", _currentLine, param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (additionalBgTable[param]) {
|
|
|
|
free(additionalBgTable[param]);
|
|
|
|
additionalBgTable[param] = NULL;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (currentAdditionalBgIdx == param) {
|
|
|
|
currentAdditionalBgIdx = 0;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (currentAdditionalBgIdx2 == param) {
|
|
|
|
currentAdditionalBgIdx2 = 0;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
strcpy(currentBgName[param], "");
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_loadAbs() {
|
|
|
|
byte param1 = getNextByte();
|
|
|
|
const char *param2 = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadABS(%d,%s)", _currentLine, param1, param2);
|
2006-04-08 13:20:40 +00:00
|
|
|
loadAbs(param2, param1);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_loadBg() {
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(param <= 8);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: useBg(%d)", _currentLine, param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (additionalBgTable[param]) {
|
|
|
|
currentAdditionalBgIdx = param;
|
|
|
|
//if (adBgVar0 == 0) {
|
|
|
|
// adBgVar1 = 1;
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_wasZoneChecked() {
|
|
|
|
warning("STUB: o2_wasZoneChecked()");
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_op9B() {
|
2006-04-08 19:26:15 +00:00
|
|
|
warning("STUB: o2_op9B()");
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_op9C() {
|
2006-04-08 19:26:15 +00:00
|
|
|
warning("STUB: o2_op9C()");
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
void o2_useBgScroll() {
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(param <= 8);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: useBgScroll(%d)", _currentLine, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
|
|
|
|
if (additionalBgTable[param]) {
|
|
|
|
currentAdditionalBgIdx2 = param;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void o2_setAdditionalBgVScroll() {
|
|
|
|
byte param1 = getNextByte();
|
|
|
|
|
|
|
|
if (param1) {
|
|
|
|
byte param2 = getNextByte();
|
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: additionalBgVScroll = var[%d]", _currentLine, param2);
|
2006-04-08 13:20:40 +00:00
|
|
|
additionalBgVScroll = _currentScriptElement->localVars[param2];
|
|
|
|
} else {
|
|
|
|
uint16 param2 = getNextWord();
|
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: additionalBgVScroll = %d", _currentLine, param2);
|
2006-04-08 13:20:40 +00:00
|
|
|
additionalBgVScroll = param2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void o2_op9F() {
|
|
|
|
warning("o2_op9F()");
|
2006-04-08 19:26:15 +00:00
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void o2_addGfxElementA0() {
|
|
|
|
uint16 param1 = getNextWord();
|
|
|
|
uint16 param2 = getNextWord();
|
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addGfxElementA0(%d,%d)", _currentLine, param1, param2);
|
2006-04-08 13:20:40 +00:00
|
|
|
addGfxElementA0(param1, param2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void o2_opA1() {
|
|
|
|
warning("STUB: o2_opA1()");
|
2006-04-08 19:26:15 +00:00
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
// removeGfxElementA0( ... );
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void o2_opA2() {
|
|
|
|
warning("STUB: o2_opA2()");
|
2006-04-08 19:26:15 +00:00
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
// addGfxElementA2();
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void o2_opA3() {
|
|
|
|
warning("STUB: o2_opA3()");
|
2006-04-08 19:26:15 +00:00
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
|
|
|
// removeGfxElementA2();
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
|
2006-04-08 19:26:15 +00:00
|
|
|
void o2_loadMask22() {
|
|
|
|
byte param = getNextByte();
|
2006-04-08 13:20:40 +00:00
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addOverlay22(%d)", _currentLine, param);
|
2006-04-08 19:26:15 +00:00
|
|
|
loadOverlayElement(param, 22);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
|
2006-04-08 19:26:15 +00:00
|
|
|
void o2_unloadMask22() {
|
|
|
|
byte param = getNextByte();
|
|
|
|
|
2006-04-12 01:48:15 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: removeOverlay22(%d)", _currentLine, param);
|
2006-04-08 19:26:15 +00:00
|
|
|
freeOverlay(param, 22);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void executeScript(prcLinkedListStruct *scriptElement, uint16 params) {
|
|
|
|
assert(scriptElement);
|
|
|
|
|
|
|
|
if (scriptElement->scriptIdx == -1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(scriptElement->scriptPtr);
|
|
|
|
|
|
|
|
_currentScriptElement = scriptElement;
|
|
|
|
_currentScriptParams = params;
|
|
|
|
_currentScriptPtr = scriptElement->scriptPtr;
|
|
|
|
_currentPosition = scriptElement->scriptPosition;
|
|
|
|
|
|
|
|
_closeScript = 0;
|
|
|
|
|
|
|
|
while (!_closeScript) {
|
|
|
|
_currentLine = _currentPosition;
|
|
|
|
|
|
|
|
byte opcode = getNextByte();
|
|
|
|
|
2006-04-08 14:23:33 +00:00
|
|
|
if (opcode && opcode < _numOpcodes) {
|
|
|
|
if (_opcodeTable[opcode - 1])
|
2006-04-08 13:20:40 +00:00
|
|
|
(_opcodeTable[opcode - 1]) ();
|
|
|
|
else
|
2006-04-08 14:26:36 +00:00
|
|
|
warning("Undefined opcode 0x%02X", opcode - 1);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void executeList1(void) {
|
|
|
|
prcLinkedListStruct *currentHead = objScriptList.next;
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
prcLinkedListStruct *tempHead;
|
|
|
|
|
|
|
|
tempHead = currentHead->next;
|
|
|
|
|
|
|
|
executeScript(currentHead, 1);
|
|
|
|
|
|
|
|
currentHead = tempHead;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void executeList0(void) {
|
|
|
|
prcLinkedListStruct *currentHead = globalScriptsHead.next;
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
prcLinkedListStruct *tempHead;
|
|
|
|
|
|
|
|
executeScript(currentHead, 0);
|
|
|
|
|
|
|
|
tempHead = currentHead->next;
|
|
|
|
currentHead = tempHead;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void purgeList1(void) {
|
|
|
|
}
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
void purgeList0(void) {
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////
|
|
|
|
// SCRIPT DECOMPILER
|
|
|
|
|
|
|
|
#ifdef DUMP_SCRIPTS
|
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
char decompileBuffer[10000][1000];
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 decompileBufferPosition = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
char bufferDec[256];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
char compareString1[256];
|
|
|
|
char compareString2[256];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
const char *getObjPramName(byte paramIdx) {
|
2006-02-22 22:40:53 +00:00
|
|
|
switch (paramIdx) {
|
|
|
|
case 1:
|
2006-04-08 08:04:23 +00:00
|
|
|
return ".X";
|
2006-02-22 22:40:53 +00:00
|
|
|
case 2:
|
2006-04-08 08:04:23 +00:00
|
|
|
return ".Y";
|
2006-02-22 22:40:53 +00:00
|
|
|
case 3:
|
2006-04-08 08:04:23 +00:00
|
|
|
return ".mask";
|
2006-02-22 22:40:53 +00:00
|
|
|
case 4:
|
2006-04-08 08:04:23 +00:00
|
|
|
return ".frame";
|
2006-02-22 22:40:53 +00:00
|
|
|
case 5:
|
2006-04-08 08:04:23 +00:00
|
|
|
return ".status";
|
2006-02-22 22:40:53 +00:00
|
|
|
case 6:
|
2006-04-08 08:04:23 +00:00
|
|
|
return ".costume";
|
2006-02-22 22:40:53 +00:00
|
|
|
default:
|
2006-04-08 08:04:23 +00:00
|
|
|
sprintf(bufferDec, ".param%d", paramIdx);
|
|
|
|
return bufferDec;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
void decompileScript(byte *scriptPtr, int16 *stackPtr, uint16 scriptSize, uint16 scriptIdx) {
|
2006-04-12 03:45:54 +00:00
|
|
|
char lineBuffer[256];
|
2006-03-23 03:45:52 +00:00
|
|
|
byte *localScriptPtr = scriptPtr;
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 exitScript;
|
|
|
|
uint32 position = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
assert(scriptPtr);
|
|
|
|
// assert(stackPtr);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
exitScript = 0;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(decompileBuffer[decompileBufferPosition++], "--------- SCRIPT %d ---------\n", scriptIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
do {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 opcode = *(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position++;
|
|
|
|
|
|
|
|
if (position == scriptSize) {
|
|
|
|
opcode = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
strcpy(lineBuffer, "");
|
|
|
|
|
|
|
|
switch (opcode - 1) {
|
|
|
|
case -1:
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x0:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "obj[%d]%s = %d\n", param1, getObjPramName(param2), param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
|
|
|
byte param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]=obj[%d]%s\n", param3, param1, getObjPramName(param2));
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x2:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "obj[%d]%s+=%d\n", param1, getObjPramName(param2), param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x3:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "obj[%d]%s-=%d\n", param1, getObjPramName(param2), param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x4:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "obj[%d]%s+=obj[%d]%s\n", param1, getObjPramName(param2), param3, getObjPramName(param2));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x5:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "obj[%d]%s-=obj[%d]%s\n", param1, getObjPramName(param2), param3, getObjPramName(param2));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x6:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(compareString1, "obj[%d]%s", param1, getObjPramName(param2));
|
2006-02-22 22:40:53 +00:00
|
|
|
sprintf(compareString2, "%d", param3);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x7:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param2;
|
|
|
|
int16 param3;
|
|
|
|
int16 param4;
|
|
|
|
int16 param5;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param2 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param4 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param5 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "setupObject(Idx:%d,X:%d,Y:%d,mask:%d,frame:%d)\n", param1, param2, param3, param4, param5);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param2;
|
|
|
|
int16 param3;
|
|
|
|
int16 param4;
|
|
|
|
int16 param5;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param2 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param4 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param5 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "checkCollision(%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x9:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2 == 1) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]=var[%d]\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else if (param2 == 2) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]=globalVar[%d]\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else if (param2 == 3) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]=mouse.X\n", param1);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else if (param2 == 4) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]=mouse.Y\n", param1);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else if (param2 == 5) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]=rand() mod %d\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-04-05 13:06:03 +00:00
|
|
|
error("decompileScript: 0x09: param2 = %d", param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]=%d\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xA:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]+=var[%d]\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]+=%d\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xB:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]-=var[%d]\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]-=%d\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xC:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]*=var[%d]\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]*=%d\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xD:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]/=var[%d]\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]/=%d\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xE:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2 == 1) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(compareString1, "var[%d]", param1);
|
|
|
|
sprintf(compareString2, "var[%d]", param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
} else if (param2 == 2) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(compareString1, "var[%d]", param1);
|
|
|
|
sprintf(compareString2, "globalVar[%d]", param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-04-05 13:06:03 +00:00
|
|
|
error("decompileScript: 0x0E: param2 = %d", param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(compareString1, "var[%d]", param1);
|
2006-02-22 22:40:53 +00:00
|
|
|
sprintf(compareString2, "%d", param3);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xF:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
|
|
|
byte param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "obj[%d]%s=var[%d]\n", param1, getObjPramName(param2), param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x13:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "loadMask0(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x14:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "unloadMask0(%d)\n", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x15:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "OP_15(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x16:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "loadMask1(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x17:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "unloadMask0(%d)\n", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x18:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "loadMask4(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x19:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "unloadMask4(%d)\n", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1A:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "OP_1A(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1B:
|
|
|
|
{
|
2006-11-08 21:46:57 +00:00
|
|
|
sprintf(lineBuffer, "freeBgIncrustList()\n");
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1D:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "label(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1E:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "goto(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1F:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "if(%s>%s) goto(%d)\n", compareString1, compareString2, param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x20:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "if(%s>=%s) goto(%d)\n", compareString1, compareString2, param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x21:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "if(%s<%s) goto(%d)\n", compareString1, compareString2, param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x22:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "if(%s<=%s) goto(%d)\n", compareString1, compareString2, param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x23:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "if(%s==%s) goto(%d)\n", compareString1, compareString2, param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x24:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "if(%s!=%s) goto(%d)\n", compareString1, compareString2, param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x25:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "removeLabel(%d)\n", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x26:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "loop(--var[%d]) -> label(%d)\n", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x31:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "startGlobalScript(%d)\n", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x32:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "endGlobalScript(%d)\n", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x3B:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "loadResource(%s)\n", localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
position += strlen((char *)localScriptPtr + position) + 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x3C:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "loadBg(%s)\n", localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
position += strlen((char *)localScriptPtr + position) + 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x3D:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "loadCt(%s)\n", localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
position += strlen((char *)localScriptPtr + position) + 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case OP_loadPart:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "loadPart(%s)\n", localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
position += strlen((char *)localScriptPtr + position) + 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x40:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "closePart()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case OP_loadNewPrcName:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "loadPrc(%d,%s)\n", param, localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
position += strlen((char *)localScriptPtr + position) + 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case OP_requestCheckPendingDataLoad: // nop
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "requestCheckPendingDataLoad()\n");
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x45:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "blitAndFade()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x46:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "fadeToBlack()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x47:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
|
|
|
int16 param4;
|
|
|
|
int16 param5;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
param4 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param5 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "transformPaletteRange(%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x49:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "setDefaultMenuColor2(%d)\n", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x4F:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "break()\n");
|
|
|
|
exitScript = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x50:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "endScript()\n\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x51:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param2;
|
|
|
|
int16 param3;
|
|
|
|
int16 param4;
|
|
|
|
int16 param5;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param2 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param4 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param5 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "message(%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x52:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2 == 1) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "globalVar[%d] = var[%d]\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else if (param2 == 2) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "globalVar[%d] = globalVar[%d]\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-04-05 13:06:03 +00:00
|
|
|
error("decompileScript: 0x52: param2 = %d", param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "globalVar[%d] = %d\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x53:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2 == 1) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(compareString1, "globalVar[%d]", param1);
|
|
|
|
sprintf(compareString2, "var[%d]", param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else if (param2 == 2) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(compareString1, "globalVar[%d]", param1);
|
|
|
|
sprintf(compareString2, "globalVar[%d]", param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-04-05 13:06:03 +00:00
|
|
|
error("decompileScript: 0x53: param2 = %d", param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(compareString1, "globalVar[%d]", param1);
|
2006-02-22 22:40:53 +00:00
|
|
|
sprintf(compareString2, "%d", param3);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x59:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "comment: %s\n", localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
position += strlen((char *)localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x5A:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "freePartRang(%d,%d)\n", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x5B:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "unloadAllMasks()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x65:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "setupTableUnk1()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x66:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param2 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "tableUnk1[%d] = %d\n", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x68:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "setDefaultMenuBoxColor(%d)\n", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x69:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "allowPlayerInput()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x6A:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "disallowPlayerInput()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case OP_changeDataDisk:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte newDisk;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
newDisk = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "changeDataDisk(%d)\n", newDisk);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x6D:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "loadDat(%s)\n", localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
position += strlen((char *)localScriptPtr + position) + 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x6E: // nop
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "updateDat()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x6F:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_6F() -> dat related\n");
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x70:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "stopSample()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case OP_79:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "allowSystemMenu(%d)\n", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x77:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param4;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param5;
|
|
|
|
int16 param6;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
|
|
|
param4 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param5 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param6 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "playSample(%d,%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5, param6);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x78:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param4;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param5;
|
|
|
|
int16 param6;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
|
|
|
param4 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param5 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param6 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_78(%d,%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5, param6);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x7A:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "OP_7A(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x7B: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "OP_7B(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x7F: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
|
|
|
byte param3;
|
|
|
|
byte param4;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param5;
|
|
|
|
int16 param6;
|
|
|
|
int16 param7;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param4 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param5 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param6 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param7 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
sprintf(lineBuffer, "OP_7F(%d,%d,%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5, param6, param7);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x80: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_80(%d,%d)\n", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x82: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 param3;
|
|
|
|
uint16 param4;
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param5;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param4 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
|
|
|
param5 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_82(%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x83: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_83(%d,%d)\n", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x89: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "if(%s!=%s) goto next label(%d)\n", compareString1, compareString2, param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8B: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "OP_8B(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8C: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "OP_8C(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8D: // OS only
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param1;
|
|
|
|
int16 param2;
|
|
|
|
int16 param3;
|
|
|
|
int16 param4;
|
|
|
|
int16 param5;
|
|
|
|
int16 param6;
|
|
|
|
int16 param7;
|
|
|
|
int16 param8;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param1 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param2 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param4 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param5 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param6 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param7 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param8 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
|
|
|
sprintf(compareString1, "obj[%d]", param1);
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(compareString2, "{%d,%d,%d,%d,%d,%d,%d}", param2, param3, param4, param5, param6, param7, param8);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8E: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "ADDBG(%d,%s)\n", param1, localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
position += strlen((char *)localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8F: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "OP_8F(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x90: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "loadABS(%d,%s)\n", param1, localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
position += strlen((char *)localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x91: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "OP_91(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x9D: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_9D(%d) -> flip img idx\n", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x9E: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param) {
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_9E(%d,%d)\n", param, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param2 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_9E(%d,%d)\n", param, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xA0: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_A0(%d,%d)\n", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xA1: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_A1(%d,%d)\n", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "Unsupported opcode %X in decompileScript\n\n", opcode - 1);
|
2006-02-22 22:40:53 +00:00
|
|
|
position = scriptSize;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// printf(lineBuffer);
|
|
|
|
strcpy(decompileBuffer[decompileBufferPosition++], lineBuffer);
|
|
|
|
|
|
|
|
exitScript = 0;
|
|
|
|
if (position >= scriptSize) {
|
|
|
|
exitScript = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
} while (!exitScript);
|
|
|
|
}
|
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
void dumpScript(char *dumpName) {
|
|
|
|
Common::File fHandle;
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
fHandle.open(dumpName, Common::File::kFileWriteMode);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
for (i = 0; i < decompileBufferPosition; i++) {
|
2006-04-12 03:45:54 +00:00
|
|
|
fHandle.writeString(Common::String(decompileBuffer[i]));
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
fHandle.close();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
decompileBufferPosition = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2006-02-25 00:26:14 +00:00
|
|
|
|
|
|
|
} // End of namespace Cine
|