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$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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-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-02-22 22:40:53 +00:00
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
scriptStruct scriptTable[NUM_MAX_SCRIPT];
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
void createVar9Element(int16 objIdx, int16 param) {
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
void addToBGList(int16 objIdx) {
|
|
|
|
int16 x;
|
|
|
|
int16 y;
|
|
|
|
int16 width;
|
|
|
|
int16 height;
|
|
|
|
int16 part;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
x = objectTable[objIdx].x;
|
|
|
|
y = objectTable[objIdx].y;
|
|
|
|
|
|
|
|
width = animDataTable[objectTable[objIdx].frame].var1;
|
2006-02-24 22:34:22 +00:00
|
|
|
height = animDataTable[objectTable[objIdx].frame].height;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
part = objectTable[objIdx].part;
|
|
|
|
|
|
|
|
if (gameType == Cine::GID_OS) {
|
2006-02-23 19:28:36 +00:00
|
|
|
drawSpriteRaw2(animDataTable[objectTable[objIdx].frame].ptr1, objectTable[objIdx].part, width, height, page2Raw, x, y);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 19:28:36 +00:00
|
|
|
drawSpriteRaw(animDataTable[objectTable[objIdx].frame].ptr1, animDataTable[objectTable[objIdx].frame].ptr2, width, height, page2Raw, x, y);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
createVar9Element(objIdx, 0);
|
|
|
|
}
|
|
|
|
|
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-02-23 19:28:36 +00:00
|
|
|
uint16 computeScriptStackSub(uint8 mode, byte *scriptPtr, int16 *stackPtr, uint16 scriptSize, uint8 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
|
|
|
|
|
|
|
ASSERT_PTR(scriptPtr);
|
|
|
|
ASSERT_PTR(stackPtr);
|
|
|
|
|
|
|
|
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-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
position++;
|
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param) {
|
|
|
|
position++;
|
|
|
|
} else {
|
|
|
|
position += 2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x9E:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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) {
|
|
|
|
return (position);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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-02-23 07:45:51 +00:00
|
|
|
error
|
|
|
|
("Unsupported opcode %X in computeScriptStack",
|
2006-02-22 22:40:53 +00:00
|
|
|
opcode - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (position > scriptSize) {
|
|
|
|
exitScript = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
} while (!exitScript);
|
|
|
|
|
|
|
|
return (position);
|
|
|
|
}
|
|
|
|
|
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-02-23 11:05:58 +00:00
|
|
|
void palRotate(uint8 a, uint8 b, uint8 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;
|
|
|
|
|
|
|
|
ASSERT(idx <= NUM_MAX_SCRIPT);
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
tempHead = currentHead;
|
|
|
|
|
|
|
|
ASSERT_PTR(tempHead);
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
}
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
pNewElement =(prcLinkedListStruct *)malloc(sizeof(prcLinkedListStruct));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
ASSERT_PTR(pNewElement);
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
#define DEBUG_SCRIPT debugScript
|
2006-02-23 07:59:25 +00:00
|
|
|
void debugScript(int currentLine, const char *string, ...) {
|
2006-02-22 22:40:53 +00:00
|
|
|
va_list va;
|
|
|
|
|
|
|
|
va_start(va, string);
|
|
|
|
vprintf(string, va);
|
|
|
|
va_end(va);
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define DEBUG_SCRIPT debugScriptInline
|
2006-02-23 07:59:25 +00:00
|
|
|
void debugScriptInline(int currentLine, const char *string, ...) {
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
//ASSERT(scriptIdx <= NUM_MAX_SCRIPT);
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 getZoneFromPosition(uint8 *page, int16 x, int16 y, int16 width) {
|
|
|
|
uint8 *ptr = page + (y * width) + x / 2;
|
|
|
|
uint8 zoneVar;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
if (!(x % 2)) {
|
|
|
|
zoneVar = (*(ptr) >> 4) & 0xF;
|
|
|
|
} else {
|
|
|
|
zoneVar = (*(ptr)) & 0xF;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (zoneVar);
|
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 getZoneFromPositionRaw(uint8 *page, int16 x, int16 y, int16 width) {
|
|
|
|
uint8 *ptr = page + (y * width) + x;
|
|
|
|
uint8 zoneVar;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
zoneVar = (*(ptr)) & 0xF;
|
|
|
|
|
|
|
|
return (zoneVar);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
// if(gameType == GAME_OS)
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
idx = getZoneFromPositionRaw(page3Raw, lx + i, ly, 320);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
/* else
|
|
|
|
* {
|
2006-02-23 19:28:36 +00:00
|
|
|
* idx = getZoneFromPosition(page3, lx + i, ly, 160);
|
2006-02-22 22:40:53 +00:00
|
|
|
* } */
|
|
|
|
|
|
|
|
ASSERT(idx >= 0 && idx <= NUM_MAX_ZONE);
|
|
|
|
|
|
|
|
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-02-22 22:40:53 +00:00
|
|
|
flag |= 1;
|
|
|
|
}
|
|
|
|
|
2006-02-23 11:05:58 +00:00
|
|
|
if (a > b) {
|
2006-02-22 22:40:53 +00:00
|
|
|
flag |= 2;
|
|
|
|
}
|
|
|
|
|
2006-02-23 11:05:58 +00:00
|
|
|
if (a < b) {
|
2006-02-22 22:40:53 +00:00
|
|
|
flag |= 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
return flag;
|
|
|
|
}
|
|
|
|
|
2006-02-23 11:29:37 +00:00
|
|
|
void executeScript(prcLinkedListStruct *scriptElement, uint16 params) {
|
2006-02-22 22:40:53 +00:00
|
|
|
byte *currentScriptPtr;
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 closeScript;
|
|
|
|
uint16 currentPosition;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
ASSERT_PTR(scriptElement);
|
|
|
|
|
|
|
|
if (scriptElement->scriptIdx == -1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
currentScriptPtr = scriptElement->scriptPtr;
|
|
|
|
|
|
|
|
ASSERT_PTR(currentScriptPtr);
|
|
|
|
|
|
|
|
currentPosition = scriptElement->scriptPosition;
|
|
|
|
closeScript = 0;
|
|
|
|
|
|
|
|
while (!closeScript) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 currentLine;
|
|
|
|
uint16 opcode;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
currentLine = currentPosition;
|
|
|
|
|
|
|
|
opcode = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
//printf("Op: %X\n", opcode - 1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
switch (opcode - 1) {
|
|
|
|
case -1:
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x0: //OP_modifyObjectParam
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 objIdx;
|
|
|
|
uint8 paramIdx;
|
|
|
|
int16 newValue;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
objIdx = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
paramIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
newValue = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "modifyObjectParam(objIdx:%d,paramIdx:%d,newValue:%d)", objIdx, paramIdx, newValue);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
modifyObjectParam(objIdx, paramIdx, newValue);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1: //OP_getObjectParam
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 objIdx;
|
|
|
|
uint8 paramIdx;
|
|
|
|
uint8 newValue;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
objIdx = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
paramIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
newValue = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "getObjectParam(objIdx:%d,paramIdx:%d,var:%d)", objIdx, paramIdx, newValue);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->localVars[newValue] = getObjectParam(objIdx, paramIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x2:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 objIdx;
|
|
|
|
uint8 paramIdx;
|
|
|
|
int16 newValue;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
objIdx = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
paramIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
newValue = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "addObjectParam(objIdx:%d,paramIdx:%d,newValue:%d)", objIdx, paramIdx, newValue);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
addObjectParam(objIdx, paramIdx, newValue);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x3:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 objIdx;
|
|
|
|
uint8 paramIdx;
|
|
|
|
int16 newValue;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
objIdx = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
paramIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
newValue = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "subObjectParam(objIdx:%d,paramIdx:%d,newValue:%d)", objIdx, paramIdx, newValue);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
subObjectParam(objIdx, paramIdx, newValue);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x6:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 objIdx;
|
|
|
|
uint8 param1;
|
|
|
|
int16 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
objIdx = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
param1 = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param2 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "compareObjectParam(objIdx:%d,type:%d,value:%d)", objIdx, param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->compareResult = compareObjectParam(objIdx, param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x7:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 objIdx;
|
|
|
|
int16 param1;
|
|
|
|
int16 param2;
|
|
|
|
int16 param3;
|
|
|
|
int16 param4;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
objIdx = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param1 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param2 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param4 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "setupObject(objIdx:%d,%d,%d,%d,%d)", objIdx, param1, param2, param3, param4);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
setupObject(objIdx, param1, param2, param3, param4);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 objIdx;
|
|
|
|
int16 param1;
|
|
|
|
int16 param2;
|
|
|
|
int16 param3;
|
|
|
|
int16 param4;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
objIdx = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param1 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param2 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param4 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "checkCollision(objIdx:%d,%d,%d,%d,%d)", objIdx, param1, param2, param3, param4);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->compareResult = checkCollision(objIdx, param1, param2, param3, param4);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x9: // OP_loadVar
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 varIdx;
|
|
|
|
uint8 varType;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
varIdx = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
varType = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
if (varType) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 dataIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
dataIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
switch (varType) {
|
|
|
|
case 1:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "var[%d] = var[%d]", varIdx, dataIdx);
|
|
|
|
scriptElement->localVars[varIdx] = scriptElement->localVars[dataIdx];
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "var[%d] = globalVars[%d]", varIdx, dataIdx);
|
|
|
|
scriptElement->localVars[varIdx] = globalVars[dataIdx];
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 3:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 var;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "var[%d] = mouseX", varIdx, dataIdx);
|
|
|
|
getMouseData(mouseUpdateStatus, &dummyU16, (uint16 *)&var, (uint16 *)&dummyU16);
|
|
|
|
scriptElement->localVars[varIdx] = var;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 4:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 var;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "var[%d] = mouseY", varIdx, dataIdx);
|
|
|
|
getMouseData(mouseUpdateStatus, &dummyU16, (uint16 *)&dummyU16, (uint16 *)&var);
|
|
|
|
scriptElement->localVars[varIdx] = var;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 5:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "var[%d] = rand mod %d", varIdx, dataIdx);
|
|
|
|
scriptElement->localVars[varIdx] = rand() % dataIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 8:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "var[%d] = file[%d].packedSize", varIdx, dataIdx);
|
2006-02-25 18:16:40 +00:00
|
|
|
scriptElement->localVars[varIdx] = partBuffer[dataIdx].packedSize;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 9:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "var[%d] = file[%d].unpackedSize", varIdx, dataIdx);
|
2006-02-25 18:16:40 +00:00
|
|
|
scriptElement->localVars[varIdx] = partBuffer[dataIdx].unpackedSize;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
ASSERT(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 newData;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
newData = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "var[%d] = %d", varIdx, newData);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->localVars[varIdx] = newData;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xA: // OP_addVar
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 type;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
type = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
if (type) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
param2 = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "var[%d] += var[%d]", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->localVars[param1] += scriptElement->localVars[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(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "var[%d] += %d", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->localVars[param1] += param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xB: // OP_subVar
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 type;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
type = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
if (type) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
param2 = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "var[%d] -= var[%d]", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->localVars[param1] = scriptElement->localVars[param1] - scriptElement->localVars[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(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "var[%d] -= %d", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->localVars[param1] = scriptElement->localVars[param1] - param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xC: // OP_mulVar
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 type;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
type = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
if (type) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
param2 = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "var[%d] *= var[%d]", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->localVars[param1] = scriptElement->localVars[param1] * scriptElement->localVars[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(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "var[%d] *= %d", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->localVars[param1] = scriptElement->localVars[param1] * param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xD: // OP_modVar
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 type;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
type = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
if (type) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
param2 = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "var[%d] /= var[%d]", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->localVars[param1] = scriptElement->localVars[param1] / scriptElement->localVars[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(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "var[%d] /= %d", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->localVars[param1] = scriptElement->localVars[param1] / param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xE: // OP_ compareVar
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 varIdx;
|
|
|
|
uint8 varType;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
varIdx = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
varType = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
if (varType) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 value;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
value = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
// printf("Val: %d\n", value);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
if (varType == 1) {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "compare var[%d] and var[%d]", varIdx, value);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
ASSERT(varIdx < 50);
|
|
|
|
ASSERT(value < 50);
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->compareResult = compareVars(scriptElement->localVars[varIdx], scriptElement->localVars[value]);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else if (varType == 2) {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "compare var[%d] and globalVar[%d]", varIdx, value);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
ASSERT(varIdx < 50);
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->compareResult = compareVars(scriptElement->localVars[varIdx], globalVars[value]);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 value;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
value = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "compare var[%d] and %d", varIdx, value);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->compareResult = compareVars(scriptElement->localVars[varIdx], value);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xF: //OP_modifyObjectParam2
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 objIdx;
|
|
|
|
uint8 paramIdx;
|
|
|
|
uint8 newValue;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
objIdx = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
paramIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
newValue = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "modifyObjectParam2(objIdx:%d,paramIdx:%d,var[%d])", objIdx, paramIdx, newValue);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
modifyObjectParam(objIdx, paramIdx, scriptElement->localVars[newValue]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x13: // OP_loadV7Element
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "addSpriteOverlay(%d)", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
loadOverlayElement(param, 0);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x14:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "removeSpriteOverlay(%d)", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
freeOverlay(param, 0);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x15:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "addToBGList(%d)", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
addToBGList(param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x16:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "addOverlay1(%d)", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
loadOverlayElement(param, 1);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x17:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "removeOverlay1(%d)", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
freeOverlay(param, 1);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x18:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "addOverlayType4(%d)", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
loadOverlayElement(param, 4);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x19:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "removeSpriteOverlay4(%d)", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
freeOverlay(param, 4);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1A:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "op1A(%d) -> TODO !", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
addSpriteFilledToBGList(param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1B:
|
|
|
|
{
|
|
|
|
DEBUG_SCRIPT(currentLine, "closeEngine7");
|
|
|
|
closeEngine7();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1D: // OP_label
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 labelIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
labelIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "label(%d)", labelIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->stack[labelIdx] = currentPosition;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1E: // OP_goto
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 labelIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
labelIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "goto label(%d)", labelIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
ASSERT(scriptElement->stack[labelIdx] != -1);
|
|
|
|
currentPosition = scriptElement->stack[labelIdx];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1F: // OP_gotoIfSup
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 labelIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
labelIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
if ((scriptElement->compareResult & 2) && !(scriptElement->compareResult & 1)) {
|
|
|
|
DEBUG_SCRIPT(currentLine, "if(>) goto %d (true)", labelIdx);
|
|
|
|
ASSERT(scriptElement->stack[labelIdx] != -1);
|
|
|
|
currentPosition = scriptElement->stack[labelIdx];
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "if(>) goto %d (false)", labelIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x20: // OP_gotoIfSupEqu
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 labelIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
labelIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
if (scriptElement->compareResult & 2 || scriptElement->compareResult & 1) {
|
|
|
|
DEBUG_SCRIPT(currentLine, "if(>=) goto %d (true)", labelIdx);
|
|
|
|
ASSERT(scriptElement->stack[labelIdx] != -1);
|
|
|
|
currentPosition = scriptElement->stack[labelIdx];
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "if(>=) goto %d (false)",
|
2006-02-22 22:40:53 +00:00
|
|
|
labelIdx);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x21: // OP_gotoIfInf
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 labelIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
labelIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
if ((scriptElement->compareResult & 4) && !(scriptElement->compareResult & 1)) {
|
|
|
|
DEBUG_SCRIPT(currentLine, "if(<) goto %d (true)", labelIdx);
|
|
|
|
ASSERT(scriptElement->stack[labelIdx] != -1);
|
|
|
|
currentPosition = scriptElement->stack[labelIdx];
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "if(<) goto %d (false)", labelIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x22: // OP_gotoIfInfEqu
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 labelIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
labelIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
if ((scriptElement->compareResult & 4) || (scriptElement->compareResult & 1)) {
|
|
|
|
DEBUG_SCRIPT(currentLine, "if(<=) goto %d (true)", labelIdx);
|
|
|
|
ASSERT(scriptElement->stack[labelIdx] != -1);
|
|
|
|
currentPosition = scriptElement->stack[labelIdx];
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "if(<=) goto %d (false)", labelIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x23: // OP_gotoIfEqu
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 labelIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
labelIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
if (scriptElement->compareResult & 1) {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "if(==) goto %d (true)", labelIdx);
|
|
|
|
ASSERT(scriptElement->stack[labelIdx] != -1);
|
|
|
|
currentPosition = scriptElement->stack[labelIdx];
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "if(==) goto %d (false)", labelIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x24: // OP_gotoIfDiff
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 labelIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
labelIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
if (!(scriptElement->compareResult & 1)) {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "if(!=) goto %d (true)", labelIdx);
|
|
|
|
ASSERT(scriptElement->stack[labelIdx] != -1);
|
|
|
|
currentPosition = scriptElement->stack[labelIdx];
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "if(!=) goto %d (false)", labelIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x26: // loop
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 varIdx;
|
|
|
|
uint8 labelIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
varIdx = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
labelIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
scriptElement->localVars[varIdx]--;
|
|
|
|
|
|
|
|
if (scriptElement->localVars[varIdx] >= 0) {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "loop(var[%]) goto %d (continue)", varIdx, labelIdx);
|
|
|
|
ASSERT(scriptElement->stack[labelIdx] != -1);
|
|
|
|
currentPosition = scriptElement->stack[labelIdx];
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "loop(var[%]) goto %d (stop)", varIdx, labelIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x31: // OP_startScript
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 11:29:37 +00:00
|
|
|
ASSERT(param < NUM_MAX_SCRIPT);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "startScript(%d)", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
addScriptToList0(param);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x32:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 scriptIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "stopGlobalScript(%d)", scriptIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
stopGlobalScript(scriptIdx);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x3B: // OP_loadResource
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "loadResource(\"%s\")", currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-16 20:29:07 +00:00
|
|
|
loadResource((const char *)(currentScriptPtr + currentPosition));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-16 20:29:07 +00:00
|
|
|
currentPosition += strlen((const char *)(currentScriptPtr + currentPosition));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x3C: // OP_loadBg
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "loadBg(\"%s\")", currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-16 20:29:07 +00:00
|
|
|
loadBg((const char *)(currentScriptPtr + currentPosition));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-16 20:29:07 +00:00
|
|
|
currentPosition += strlen((const char *)(currentScriptPtr + currentPosition));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
closeEngine7();
|
|
|
|
|
|
|
|
bgVar0 = 0;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x3D: // OP_loadCt
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "loadCt(\"%s\")", currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-16 20:29:07 +00:00
|
|
|
loadCt((const char *)(currentScriptPtr + currentPosition));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-16 20:29:07 +00:00
|
|
|
currentPosition += strlen((const char *)(currentScriptPtr + currentPosition));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x3F: // OP_loadPart
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "loadPart(\"%s\")", currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
if (gameType == Cine::GID_FW)
|
2006-03-16 20:29:07 +00:00
|
|
|
loadPart((const char *)(currentScriptPtr + currentPosition));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-16 20:29:07 +00:00
|
|
|
currentPosition += strlen((const char *)(currentScriptPtr + currentPosition));
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x40:
|
|
|
|
{
|
|
|
|
DEBUG_SCRIPT(currentLine, "closePart");
|
|
|
|
|
|
|
|
closePart();
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x41: // OP_loadData
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 11:29:37 +00:00
|
|
|
ASSERT(param <= 3);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
switch (param) {
|
|
|
|
case 0:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "loadPrc(\"%s\")", currentScriptPtr + currentPosition);
|
2006-03-16 20:29:07 +00:00
|
|
|
strcpy(newPrcName, (const char *)(currentScriptPtr + currentPosition));
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "loadRel(\"%s\")", currentScriptPtr + currentPosition);
|
2006-03-16 20:29:07 +00:00
|
|
|
strcpy(newRelName, (const char *)(currentScriptPtr + currentPosition));
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "loadObject(\"%s\")", currentScriptPtr + currentPosition);
|
2006-03-16 20:29:07 +00:00
|
|
|
strcpy(newObjectName, (const char *)(currentScriptPtr + currentPosition));
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 3:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "loadMsg(\"%s\")", currentScriptPtr + currentPosition);
|
2006-03-16 20:29:07 +00:00
|
|
|
strcpy(newMsgName, (const char *)(currentScriptPtr + currentPosition));
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-16 20:29:07 +00:00
|
|
|
currentPosition += strlen((const char *)(currentScriptPtr + currentPosition)) + 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x42:
|
|
|
|
{
|
|
|
|
DEBUG_SCRIPT(currentLine, "request data load");
|
|
|
|
checkForPendingDataLoadSwitch = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x45:
|
|
|
|
{
|
|
|
|
DEBUG_SCRIPT(currentLine, "request fadein");
|
|
|
|
// TODO: use real code
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
memcpy(c_palette, tempPalette, sizeof(uint16) * 16);
|
2006-02-22 22:40:53 +00:00
|
|
|
drawOverlays();
|
|
|
|
flip();
|
|
|
|
|
|
|
|
fadeRequired = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x46:
|
|
|
|
{
|
|
|
|
DEBUG_SCRIPT(currentLine, "request fadeout");
|
|
|
|
//fadeToBlack();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x47:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 startColor;
|
|
|
|
uint8 numColor;
|
|
|
|
uint16 r;
|
|
|
|
uint16 g;
|
|
|
|
uint16 b;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
startColor = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
numColor = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
r = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
g = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
b = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "transformPaletteRange(from:%d,numIdx:%d,r:%d,g:%d,b:%d) -> unimplemented", startColor, numColor, r, g, b);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
transformPaletteRange(startColor, numColor, r, g, b);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x4A:
|
|
|
|
{
|
2006-02-23 11:29:37 +00:00
|
|
|
uint8 a;
|
|
|
|
uint8 b;
|
|
|
|
uint8 c;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 11:29:37 +00:00
|
|
|
a = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 11:29:37 +00:00
|
|
|
b = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 11:29:37 +00:00
|
|
|
c = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "palRotate(%d,%d,%d)", a, b, c);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 11:29:37 +00:00
|
|
|
palRotate(a, b, c);
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x4F: // break;
|
|
|
|
{
|
|
|
|
DEBUG_SCRIPT(currentLine, "break");
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->scriptPosition = currentPosition;
|
2006-02-22 22:40:53 +00:00
|
|
|
closeScript = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x49:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
defaultMenuBoxColor2 = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "setDefaultMenuColor2(%d)", defaultMenuBoxColor2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x50: // OP_endScript
|
|
|
|
{
|
|
|
|
DEBUG_SCRIPT(currentLine, "endScript");
|
|
|
|
|
2006-02-23 11:29:37 +00:00
|
|
|
if (params == 0) {
|
2006-02-22 22:40:53 +00:00
|
|
|
endScript0(scriptElement->scriptIdx);
|
|
|
|
} else {
|
|
|
|
endScript1(scriptElement->scriptIdx);
|
|
|
|
}
|
|
|
|
|
|
|
|
closeScript = 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x51:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint16 param2;
|
|
|
|
uint16 param3;
|
|
|
|
uint16 param4;
|
|
|
|
uint16 param5;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param2 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param4 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param5 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "message(%d,%d,%d,%d,%d)", param1, param2, param3, param4, param5);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
addMessage(param1, param2, param3, param4, param5);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x52: // OP_loadGlobalVar
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 idx;
|
|
|
|
uint8 type;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
idx = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
type = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
if (type) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 idx2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
idx2 = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
if (type == 1) {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "globalVars[%d] = var[%d]", idx, idx2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
globalVars[idx] = scriptElement->localVars[idx2];
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "globalVars[%d] = globalVars[%d]", idx, idx2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
globalVars[idx] = globalVars[idx2];
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 newData;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
newData = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "globalVars[%d] = %d", idx, newData);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
globalVars[idx] = newData;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x53: // OP_compareGlobalVar
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 idx;
|
|
|
|
uint8 type;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
idx = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
type = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
if (type) {
|
2006-02-23 11:29:37 +00:00
|
|
|
uint8 b;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
b = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "compare globalVars[%d] and var[%d]", idx, b);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->compareResult = compareVars(globalVars[idx], scriptElement->localVars[b]);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 newData;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
newData = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
|
|
|
DEBUG_SCRIPT(currentLine,
|
|
|
|
"compare globalVars[%d] and %d",
|
|
|
|
idx, newData);
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
if (idx == 255 && (gameType == Cine::GID_FW)) { // TODO: fix
|
|
|
|
scriptElement->compareResult = 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 19:28:36 +00:00
|
|
|
scriptElement->compareResult = compareVars(globalVars[idx], newData);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x59:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "comment(%s)", currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-16 20:29:07 +00:00
|
|
|
currentPosition += strlen((const char *)(currentScriptPtr + currentPosition));
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x5A:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 startIdx;
|
|
|
|
uint8 numIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
startIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
numIdx = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-03-16 20:29:07 +00:00
|
|
|
ASSERT(startIdx + numIdx <= NUM_MAX_ANIMDATA);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "freePartRange(%d,%d)", startIdx, numIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
freePartRange(startIdx, numIdx);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x5B:
|
|
|
|
{
|
|
|
|
DEBUG_SCRIPT(currentLine, "unloadAllMasks()");
|
|
|
|
|
|
|
|
unloadAllMasks();
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x65:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "initializeZoneData()");
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
for (i = 0; i < NUM_MAX_ZONE; i++) {
|
|
|
|
zoneData[i] = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x66:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 zoneIdx;
|
|
|
|
uint16 var;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
zoneIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
var = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "setZone[%d] = %d", zoneIdx, var);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
zoneData[zoneIdx] = var;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x68:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
defaultMenuBoxColor = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "setDefaultMenuColor(%d)", defaultMenuBoxColor2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x69: // OP_allowPlayerInput
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "allowPlayerInput()");
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
allowPlayerInput = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x6A: // OP_dissallowPlayerInput
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "dissallowPlayerInput()");
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
allowPlayerInput = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x6B: // OP_changeDataDisk
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 newDisk;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
newDisk = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "changeDataDisk(%d)", newDisk);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
checkDataDisk(newDisk);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x6D:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "loadMusic(%s)", currentScriptPtr + currentPosition);
|
2006-03-09 22:37:19 +00:00
|
|
|
g_sfxPlayer->load((const char *)(currentScriptPtr + currentPosition));
|
|
|
|
currentPosition += strlen((const char *)(currentScriptPtr + currentPosition)) + 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x6E:
|
|
|
|
{
|
|
|
|
DEBUG_SCRIPT(currentLine, "playMusic()");
|
2006-03-09 22:37:19 +00:00
|
|
|
g_sfxPlayer->play();
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x6F:
|
|
|
|
{
|
|
|
|
DEBUG_SCRIPT(currentLine, "fadeOutMusic()");
|
2006-03-09 22:37:19 +00:00
|
|
|
g_sfxPlayer->fadeOut();
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x70:
|
|
|
|
{
|
|
|
|
DEBUG_SCRIPT(currentLine, "stopSample()");
|
2006-03-09 22:37:19 +00:00
|
|
|
g_sfxPlayer->stop();
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x77:
|
|
|
|
case 0x78:
|
|
|
|
{
|
|
|
|
DEBUG_SCRIPT(currentLine, "playSample()");
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 anim, channel;
|
|
|
|
int16 volume;
|
|
|
|
uint16 flag;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
anim = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
channel = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
/* unused */
|
|
|
|
currentPosition += 2;
|
|
|
|
|
|
|
|
/* unused */
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
volume = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
flag = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
|
|
|
if (volume > 63)
|
|
|
|
volume = 63;
|
|
|
|
if (volume < 0)
|
|
|
|
volume = 63;
|
|
|
|
|
|
|
|
if (animDataTable[anim].ptr1) {
|
2006-03-09 22:37:19 +00:00
|
|
|
if (channel >= 10) {
|
2006-02-22 22:40:53 +00:00
|
|
|
channel -= 10;
|
2006-03-09 22:37:19 +00:00
|
|
|
}
|
|
|
|
if (volume < 50) {
|
2006-02-22 22:40:53 +00:00
|
|
|
volume = 50;
|
2006-03-09 22:37:19 +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
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x79:
|
|
|
|
{
|
|
|
|
var22 = *(currentScriptPtr + currentPosition);
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "OP79 load var22 to %d -> TODO", var22);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
currentPosition++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x7A:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "addOverlay5(%d)", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
loadOverlayElement(param, 5);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x7B:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "freeOverlay5(%d)", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
freeOverlay(param, 5);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x7F:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
|
|
|
uint8 param3;
|
|
|
|
uint8 param4;
|
|
|
|
uint16 param5;
|
|
|
|
uint16 param6;
|
|
|
|
uint16 param7;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
param2 = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
param3 = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
param4 = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param5 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param6 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param7 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "addSeqListElement(%d,%d,%d,%d,%d)", param1, param2, param3, param4, param5, param6, param7);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
addSeqListElement(param1, 0, param2, param3, param4, param5, param6, 0, param7);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x80:
|
|
|
|
{
|
2006-02-23 11:29:37 +00:00
|
|
|
uint8 a;
|
|
|
|
uint8 b;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 11:29:37 +00:00
|
|
|
a = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 11:29:37 +00:00
|
|
|
b = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "removeSeq(%d,%d) -> TODO", a, b);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 11:29:37 +00:00
|
|
|
removeSeq(a, 0, b);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x83:
|
|
|
|
{
|
2006-02-23 11:29:37 +00:00
|
|
|
uint8 a;
|
|
|
|
uint8 b;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 11:29:37 +00:00
|
|
|
a = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 11:29:37 +00:00
|
|
|
b = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "OP83(%d,%d) -> TODO", a, b);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 11:29:37 +00:00
|
|
|
if (isSeqRunning(a, 0, b)) {
|
2006-02-22 22:40:53 +00:00
|
|
|
scriptElement->compareResult = 1;
|
|
|
|
} else {
|
|
|
|
scriptElement->compareResult = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x84: // OP_gotoIfSup nearest
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 labelIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
labelIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
if ((scriptElement->compareResult & 2)
|
|
|
|
&& !(scriptElement->compareResult & 1)) {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "if(>) goto nearest %d (true)", labelIdx);
|
|
|
|
ASSERT(scriptElement->stack[labelIdx] != -1);
|
|
|
|
currentPosition = computeScriptStackFromScript(scriptElement->scriptPtr, currentPosition, labelIdx,
|
2006-02-25 18:16:40 +00:00
|
|
|
scriptTable[scriptElement->scriptIdx].size);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "if(>) goto nearest %d (false)", labelIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x85: // OP_gotoIfSupEqu nearest
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 labelIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
labelIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
if (scriptElement->compareResult & 2 || scriptElement->compareResult & 1) {
|
|
|
|
DEBUG_SCRIPT(currentLine, "if(>=) goto nearest %d (true)", labelIdx);
|
|
|
|
ASSERT(scriptElement->stack[labelIdx] != -1);
|
|
|
|
currentPosition = computeScriptStackFromScript(scriptElement->scriptPtr, currentPosition, labelIdx,
|
2006-02-25 18:16:40 +00:00
|
|
|
scriptTable[scriptElement->scriptIdx].size);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "if(>=) goto nearest %d (false)", labelIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x86: // OP_gotoIfInf nearest
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 labelIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
labelIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
if ((scriptElement->compareResult & 4) && !(scriptElement->compareResult & 1)) {
|
|
|
|
DEBUG_SCRIPT(currentLine, "if(<) goto nearest %d (true)", labelIdx);
|
|
|
|
ASSERT(scriptElement->stack[labelIdx] != -1);
|
|
|
|
currentPosition = computeScriptStackFromScript(scriptElement->scriptPtr,
|
2006-02-25 18:16:40 +00:00
|
|
|
currentPosition, labelIdx, scriptTable[scriptElement->scriptIdx].size);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "if(<) goto nearest %d (false)", labelIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x87: // OP_gotoIfInfEqu nearest
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 labelIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
labelIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
if ((scriptElement->compareResult & 4) || (scriptElement->compareResult & 1)) {
|
|
|
|
DEBUG_SCRIPT(currentLine, "if(<=) goto nearest %d (true)", labelIdx);
|
|
|
|
ASSERT(scriptElement->stack[labelIdx] != -1);
|
|
|
|
currentPosition = computeScriptStackFromScript(scriptElement->scriptPtr,
|
2006-02-25 18:16:40 +00:00
|
|
|
currentPosition, labelIdx, scriptTable[scriptElement->scriptIdx].size);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "if(<=) goto nearest %d (false)", labelIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x88: // OP_gotoIfEqu nearest
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 labelIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
labelIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
if (scriptElement->compareResult & 1) {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "if(==) goto nearest %d (true)", labelIdx);
|
|
|
|
ASSERT(scriptElement->stack[labelIdx] != -1);
|
|
|
|
currentPosition = computeScriptStackFromScript(scriptElement->scriptPtr,
|
2006-02-25 18:16:40 +00:00
|
|
|
currentPosition, labelIdx, scriptTable[scriptElement->scriptIdx].size);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "if(==) goto nearest %d (false)", labelIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x89: // OP_gotoIfDiff nearest
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 labelIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
labelIdx = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
if (!(scriptElement->compareResult & 1)) {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "if(!=) goto nearest %d (true)", labelIdx);
|
|
|
|
ASSERT(scriptElement->stack[labelIdx] != -1);
|
|
|
|
currentPosition = computeScriptStackFromScript(scriptElement->scriptPtr,
|
2006-02-25 18:16:40 +00:00
|
|
|
currentPosition, labelIdx, scriptTable[scriptElement->scriptIdx].size);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "if(!=) goto nearest %d (false)", labelIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8B:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
uint8 temp = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "startObjectScript(%d,%d)", temp, currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
runObjectScript(temp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8C:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
uint8 temp = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "startObjectScript(%d,%d)", temp, currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
stopObjectScript(temp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8E:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
uint8 temp = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "addBackground(%s,%d)", currentScriptPtr + currentPosition, temp);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-16 20:29:07 +00:00
|
|
|
addBackground((const char *)(currentScriptPtr + currentPosition), temp);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-16 20:29:07 +00:00
|
|
|
currentPosition += strlen((const char *)(currentScriptPtr + currentPosition));
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8F:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
uint8 temp = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "removeBackground(%d)", temp);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
ASSERT(temp);
|
|
|
|
if (additionalBgTable[temp]) {
|
|
|
|
free(additionalBgTable[temp]);
|
|
|
|
additionalBgTable[temp] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (currentAdditionalBgIdx == temp) {
|
|
|
|
currentAdditionalBgIdx = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (currentAdditionalBgIdx2 == temp) {
|
2006-02-27 21:25:59 +00:00
|
|
|
currentAdditionalBgIdx2 = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
strcpy(currentBgName[temp], "");
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x90:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
uint8 temp = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "loadABS(%d,%s)", temp, currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-16 20:29:07 +00:00
|
|
|
loadAbs((const char *)(currentScriptPtr + currentPosition), temp);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-16 20:29:07 +00:00
|
|
|
currentPosition += strlen((const char *)(currentScriptPtr + currentPosition));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x91:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
uint8 temp = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
DEBUG_SCRIPT(currentLine, "useBg(%d)", temp);
|
|
|
|
|
2006-02-23 11:05:58 +00:00
|
|
|
ASSERT(temp <= 8);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
if (additionalBgTable[temp]) {
|
|
|
|
currentAdditionalBgIdx = temp;
|
2006-02-23 19:28:36 +00:00
|
|
|
//if (adBgVar0 == 0) {
|
|
|
|
// adBgVar1 = 1;
|
|
|
|
//}
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x9D:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
uint8 temp = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "useBgScroll(%d)", temp);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 11:05:58 +00:00
|
|
|
ASSERT(temp <= 8);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
if (additionalBgTable[temp]) {
|
|
|
|
currentAdditionalBgIdx2 = temp;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x9E:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 type;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
type = *(currentScriptPtr + currentPosition);
|
|
|
|
currentPosition++;
|
|
|
|
|
|
|
|
if (type) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
param2 = *(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "additionalBgVScroll = var[%d]", param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
additionalBgVScroll = scriptElement->localVars[param2];
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param2 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "additionalBgVScroll = %d", param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
additionalBgVScroll = param2;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xA0:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 param1;
|
|
|
|
uint16 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param1 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param2 = READ_BE_UINT16(currentScriptPtr + currentPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
currentPosition += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
DEBUG_SCRIPT(currentLine, "addGfxElementA0(%d,%d)", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
addGfxElementA0(param1, param2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xA1:
|
|
|
|
{
|
|
|
|
currentPosition += 4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xA2:
|
|
|
|
{
|
|
|
|
currentPosition += 4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xA3:
|
|
|
|
{
|
|
|
|
currentPosition += 4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
2006-02-23 07:45:51 +00:00
|
|
|
error("Unsupported opcode %X", 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-02-23 09:12:21 +00:00
|
|
|
uint8 decompileBuffer[10000][1000];
|
|
|
|
uint16 decompileBufferPosition = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 bufferDec[256];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 compareString1[256];
|
|
|
|
uint8 compareString2[256];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 *getObjPramName(uint8 paramIdx) {
|
2006-02-22 22:40:53 +00:00
|
|
|
switch (paramIdx) {
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
return (".X");
|
|
|
|
}
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
return (".Y");
|
|
|
|
}
|
|
|
|
case 3:
|
|
|
|
{
|
|
|
|
return (".mask");
|
|
|
|
}
|
|
|
|
case 4:
|
|
|
|
{
|
|
|
|
return (".frame");
|
|
|
|
}
|
|
|
|
case 5:
|
|
|
|
{
|
|
|
|
return (".status");
|
|
|
|
}
|
|
|
|
case 6:
|
|
|
|
{
|
|
|
|
return (".costume");
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
sprintf(bufferDec, ".param%d", paramIdx);
|
|
|
|
return (bufferDec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
void decompileScript(uint8 *scriptPtr, int16 *stackPtr, uint16 scriptSize, uint16 scriptIdx) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 lineBuffer[256];
|
|
|
|
uint8 *localScriptPtr = scriptPtr;
|
|
|
|
uint16 exitScript;
|
|
|
|
uint32 position = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
ASSERT_PTR(scriptPtr);
|
|
|
|
// ASSERT_PTR(stackPtr);
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("%X\n", opcode - 1);
|
|
|
|
|
|
|
|
strcpy(lineBuffer, "");
|
|
|
|
|
|
|
|
switch (opcode - 1) {
|
|
|
|
case -1:
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x0:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
|
|
|
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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
|
|
|
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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
|
|
|
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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
|
|
|
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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
|
|
|
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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
|
|
|
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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
int16 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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 {
|
|
|
|
ASSERT(0);
|
|
|
|
}
|
|
|
|
} 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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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 {
|
|
|
|
ASSERT(0);
|
|
|
|
}
|
|
|
|
} 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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "loadMask0(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x14:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "OP_15(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x16:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "loadMask1(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x17:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "loadMask4(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x19:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "OP_1A(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1B:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "closeEngine7()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1D:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "label(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1E:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "goto(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1F:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 19:28:36 +00:00
|
|
|
position += strlen(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-02-23 19:28:36 +00:00
|
|
|
position += strlen(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-02-23 19:28:36 +00:00
|
|
|
position += strlen(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-02-23 19:28:36 +00:00
|
|
|
position += strlen(localScriptPtr + position) + 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x40:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "closePart()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case OP_loadNewPrcName:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 19:28:36 +00:00
|
|
|
position += strlen(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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
|
|
|
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-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, "transformPaletteRange(%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x49:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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 {
|
|
|
|
ASSERT(0);
|
|
|
|
}
|
|
|
|
} 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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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 {
|
|
|
|
ASSERT(0);
|
|
|
|
}
|
|
|
|
} 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
|
|
|
|
|
|
|
position += strlen(localScriptPtr + position);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x5A:
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
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-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 19:28:36 +00:00
|
|
|
position += strlen(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-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
|
|
|
int16 param3;
|
|
|
|
uint8 param4;
|
|
|
|
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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
|
|
|
int16 param3;
|
|
|
|
uint8 param4;
|
|
|
|
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-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
|
|
|
uint8 param3;
|
|
|
|
uint8 param4;
|
|
|
|
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-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_7F(%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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 param2;
|
|
|
|
uint16 param3;
|
|
|
|
uint16 param4;
|
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 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
|
|
|
|
|
|
|
position += strlen(localScriptPtr + position);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8F: // OS only
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 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
|
|
|
|
|
|
|
position += strlen(localScriptPtr + position);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x91: // OS only
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 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-02-23 09:12:21 +00:00
|
|
|
uint8 param1;
|
|
|
|
uint8 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-02-23 19:28:36 +00:00
|
|
|
void dumpScript(uint8 *dumpName) {
|
2006-02-22 22:40:53 +00:00
|
|
|
File *fHandle;
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
fHandle = fopen(dumpName, "wt+");
|
|
|
|
|
|
|
|
for (i = 0; i < decompileBufferPosition; i++) {
|
|
|
|
fprintf(fHandle, decompileBuffer[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(fHandle);
|
|
|
|
|
|
|
|
decompileBufferPosition = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2006-02-25 00:26:14 +00:00
|
|
|
|
|
|
|
} // End of namespace Cine
|