2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
2006-02-22 22:40:53 +00:00
|
|
|
*
|
2007-05-30 21:56:52 +00:00
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2006-02-22 22:40:53 +00:00
|
|
|
*
|
|
|
|
* 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$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \file
|
|
|
|
* Script interpreter file
|
|
|
|
*/
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-03-29 15:59:37 +00:00
|
|
|
#include "common/endian.h"
|
|
|
|
|
2006-02-22 22:40:53 +00:00
|
|
|
#include "cine/cine.h"
|
2006-02-25 01:18:01 +00:00
|
|
|
#include "cine/bg_list.h"
|
|
|
|
#include "cine/object.h"
|
2007-05-19 12:08:41 +00:00
|
|
|
#include "cine/sound.h"
|
2006-02-25 01:18:01 +00:00
|
|
|
#include "cine/various.h"
|
2008-04-07 20:24:40 +00:00
|
|
|
#include "cine/script.h"
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 00:26:14 +00:00
|
|
|
namespace Cine {
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
uint16 compareVars(int16 a, int16 b);
|
|
|
|
void palRotate(byte a, byte b, byte c);
|
|
|
|
void removeSeq(uint16 param1, uint16 param2, uint16 param3);
|
|
|
|
uint16 isSeqRunning(uint16 param1, uint16 param2, uint16 param3);
|
|
|
|
void addGfxElementA0(int16 param1, int16 param2);
|
|
|
|
void removeGfxElementA0(int16 idx, int16 param);
|
|
|
|
|
|
|
|
const Opcode FWScript::_opcodeTable[] = {
|
|
|
|
/* 00 */
|
|
|
|
{ &FWScript::o1_modifyObjectParam, "bbw" },
|
|
|
|
{ &FWScript::o1_getObjectParam, "bbb" },
|
|
|
|
{ &FWScript::o1_addObjectParam, "bbw" },
|
|
|
|
{ &FWScript::o1_subObjectParam, "bbw" },
|
|
|
|
/* 04 */
|
|
|
|
{ &FWScript::o1_add2ObjectParam, "bbw" },
|
|
|
|
{ &FWScript::o1_sub2ObjectParam, "bbw" },
|
|
|
|
{ &FWScript::o1_compareObjectParam, "bbw" },
|
|
|
|
{ &FWScript::o1_setupObject, "bwwww" },
|
|
|
|
/* 08 */
|
|
|
|
{ &FWScript::o1_checkCollision, "bwwww" },
|
|
|
|
{ &FWScript::o1_loadVar, "bc" },
|
|
|
|
{ &FWScript::o1_addVar, "bc" },
|
|
|
|
{ &FWScript::o1_subVar, "bc" },
|
|
|
|
/* 0C */
|
|
|
|
{ &FWScript::o1_mulVar, "bc" },
|
|
|
|
{ &FWScript::o1_divVar, "bc" },
|
|
|
|
{ &FWScript::o1_compareVar, "bc" },
|
|
|
|
{ &FWScript::o1_modifyObjectParam2, "bbb" },
|
|
|
|
/* 10 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_loadMask0, "b" },
|
|
|
|
/* 14 */
|
|
|
|
{ &FWScript::o1_unloadMask0, "b" },
|
|
|
|
{ &FWScript::o1_addToBgList, "b" },
|
|
|
|
{ &FWScript::o1_loadMask1, "b" },
|
|
|
|
{ &FWScript::o1_unloadMask1, "b" },
|
|
|
|
/* 18 */
|
|
|
|
{ &FWScript::o1_loadMask4, "b" },
|
|
|
|
{ &FWScript::o1_unloadMask4, "b" },
|
|
|
|
{ &FWScript::o1_addSpriteFilledToBgList, "b" },
|
|
|
|
{ &FWScript::o1_op1B, "" },
|
|
|
|
/* 1C */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_label, "l" },
|
|
|
|
{ &FWScript::o1_goto, "b" },
|
|
|
|
{ &FWScript::o1_gotoIfSup, "b" },
|
|
|
|
/* 20 */
|
|
|
|
{ &FWScript::o1_gotoIfSupEqu, "b" },
|
|
|
|
{ &FWScript::o1_gotoIfInf, "b" },
|
|
|
|
{ &FWScript::o1_gotoIfInfEqu, "b" },
|
|
|
|
{ &FWScript::o1_gotoIfEqu, "b" },
|
|
|
|
/* 24 */
|
|
|
|
{ &FWScript::o1_gotoIfDiff, "b" },
|
|
|
|
{ &FWScript::o1_removeLabel, "b" },
|
|
|
|
{ &FWScript::o1_loop, "bb" },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 28 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 2C */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 30 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_startGlobalScript, "b" },
|
|
|
|
{ &FWScript::o1_endGlobalScript, "b" },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 34 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 38 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_loadAnim, "s" },
|
|
|
|
/* 3C */
|
|
|
|
{ &FWScript::o1_loadBg, "s" },
|
|
|
|
{ &FWScript::o1_loadCt, "s" },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_loadPart, "s" },
|
|
|
|
/* 40 */
|
|
|
|
{ &FWScript::o1_closePart, "" },
|
|
|
|
{ &FWScript::o1_loadNewPrcName, "bs" },
|
|
|
|
{ &FWScript::o1_requestCheckPendingDataLoad, "" },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 44 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_blitAndFade, "" },
|
|
|
|
{ &FWScript::o1_fadeToBlack, "" },
|
|
|
|
{ &FWScript::o1_transformPaletteRange, "bbwww" },
|
|
|
|
/* 48 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_setDefaultMenuColor2, "b" },
|
|
|
|
{ &FWScript::o1_palRotate, "bbb" },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 4C */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_break, "" },
|
|
|
|
/* 50 */
|
|
|
|
{ &FWScript::o1_endScript, "x" },
|
|
|
|
{ &FWScript::o1_message, "bwwww" },
|
|
|
|
{ &FWScript::o1_loadGlobalVar, "bc" },
|
|
|
|
{ &FWScript::o1_compareGlobalVar, "bc" },
|
|
|
|
/* 54 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 58 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_declareFunctionName, "s" },
|
|
|
|
{ &FWScript::o1_freePartRange, "bb" },
|
|
|
|
{ &FWScript::o1_unloadAllMasks, "" },
|
|
|
|
// 5C */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 60 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_setScreenDimensions, "wwww" },
|
|
|
|
/* 64 */
|
|
|
|
{ &FWScript::o1_displayBackground, "" },
|
|
|
|
{ &FWScript::o1_initializeZoneData, "" },
|
|
|
|
{ &FWScript::o1_setZoneDataEntry, "bw" },
|
|
|
|
{ &FWScript::o1_getZoneDataEntry, "bb" },
|
|
|
|
/* 68 */
|
|
|
|
{ &FWScript::o1_setDefaultMenuColor, "b" },
|
|
|
|
{ &FWScript::o1_allowPlayerInput, "" },
|
|
|
|
{ &FWScript::o1_disallowPlayerInput, "" },
|
|
|
|
{ &FWScript::o1_changeDataDisk, "b" },
|
|
|
|
/* 6C */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_loadMusic, "s" },
|
|
|
|
{ &FWScript::o1_playMusic, "" },
|
|
|
|
{ &FWScript::o1_fadeOutMusic, "" },
|
|
|
|
/* 70 */
|
|
|
|
{ &FWScript::o1_stopSample, "" },
|
|
|
|
{ &FWScript::o1_op71, "bw" },
|
|
|
|
{ &FWScript::o1_op72, "wbw" },
|
|
|
|
{ &FWScript::o1_op73, "wbw" },
|
|
|
|
/* 74 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_playSample, "bbwbww" },
|
|
|
|
/* 78 */
|
|
|
|
{ &FWScript::o1_playSample, "bbwbww" },
|
|
|
|
{ &FWScript::o1_disableSystemMenu, "b" },
|
|
|
|
{ &FWScript::o1_loadMask5, "b" },
|
|
|
|
{ &FWScript::o1_unloadMask5, "b" }
|
2007-05-14 21:52:06 +00:00
|
|
|
};
|
2008-04-07 20:24:40 +00:00
|
|
|
const unsigned int FWScript::_numOpcodes = ARRAYSIZE(FWScript::_opcodeTable);
|
|
|
|
|
|
|
|
|
|
|
|
const Opcode OSScript::_opcodeTable[] = {
|
|
|
|
/* 00 */
|
|
|
|
{ &FWScript::o1_modifyObjectParam, "bbw" },
|
|
|
|
{ &FWScript::o1_getObjectParam, "bbb" },
|
|
|
|
{ &FWScript::o1_addObjectParam, "bbw" },
|
|
|
|
{ &FWScript::o1_subObjectParam, "bbw" },
|
|
|
|
/* 04 */
|
|
|
|
{ &FWScript::o1_add2ObjectParam, "bbw" },
|
|
|
|
{ &FWScript::o1_sub2ObjectParam, "bbw" },
|
|
|
|
{ &FWScript::o1_compareObjectParam, "bbw" },
|
|
|
|
{ &FWScript::o1_setupObject, "bwwww" },
|
|
|
|
/* 08 */
|
|
|
|
{ &FWScript::o1_checkCollision, "bwwww" },
|
|
|
|
{ &FWScript::o1_loadVar, "bc" },
|
|
|
|
{ &FWScript::o1_addVar, "bc" },
|
|
|
|
{ &FWScript::o1_subVar, "bc" },
|
|
|
|
/* 0C */
|
|
|
|
{ &FWScript::o1_mulVar, "bc" },
|
|
|
|
{ &FWScript::o1_divVar, "bc" },
|
|
|
|
{ &FWScript::o1_compareVar, "bc" },
|
|
|
|
{ &FWScript::o1_modifyObjectParam2, "bbb" },
|
|
|
|
/* 10 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_loadMask0, "b" },
|
|
|
|
/* 14 */
|
|
|
|
{ &FWScript::o1_unloadMask0, "b" },
|
|
|
|
{ &FWScript::o1_addToBgList, "b" },
|
|
|
|
{ &FWScript::o1_loadMask1, "b" },
|
|
|
|
{ &FWScript::o1_unloadMask1, "b" },
|
|
|
|
/* 18 */
|
|
|
|
{ &FWScript::o1_loadMask4, "b" },
|
|
|
|
{ &FWScript::o1_unloadMask4, "b" },
|
|
|
|
{ &FWScript::o1_addSpriteFilledToBgList, "b" },
|
|
|
|
{ &FWScript::o1_op1B, "" },
|
|
|
|
/* 1C */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_label, "l" },
|
|
|
|
{ &FWScript::o1_goto, "b" },
|
|
|
|
{ &FWScript::o1_gotoIfSup, "b" },
|
|
|
|
/* 20 */
|
|
|
|
{ &FWScript::o1_gotoIfSupEqu, "b" },
|
|
|
|
{ &FWScript::o1_gotoIfInf, "b" },
|
|
|
|
{ &FWScript::o1_gotoIfInfEqu, "b" },
|
|
|
|
{ &FWScript::o1_gotoIfEqu, "b" },
|
|
|
|
/* 24 */
|
|
|
|
{ &FWScript::o1_gotoIfDiff, "b" },
|
|
|
|
{ &FWScript::o1_removeLabel, "b" },
|
|
|
|
{ &FWScript::o1_loop, "bb" },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 28 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 2C */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 30 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_startGlobalScript, "b" },
|
|
|
|
{ &FWScript::o1_endGlobalScript, "b" },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 34 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 38 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_loadAnim, "s" },
|
|
|
|
/* 3C */
|
|
|
|
{ &FWScript::o1_loadBg, "s" },
|
|
|
|
{ &FWScript::o1_loadCt, "s" },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o2_loadPart, "s" },
|
|
|
|
/* 40 */
|
|
|
|
{ 0, 0 }, /* o1_closePart, triggered by some scripts (STARTA.PRC 4 for ex.) */
|
|
|
|
{ &FWScript::o1_loadNewPrcName, "bs" },
|
|
|
|
{ &FWScript::o1_requestCheckPendingDataLoad, "" },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 44 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_blitAndFade, "" },
|
|
|
|
{ &FWScript::o1_fadeToBlack, "" },
|
|
|
|
{ &FWScript::o1_transformPaletteRange, "bbwww" },
|
|
|
|
/* 48 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_setDefaultMenuColor2, "b" },
|
|
|
|
{ &FWScript::o1_palRotate, "bbb" },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 4C */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_break, "" },
|
|
|
|
/* 50 */
|
|
|
|
{ &FWScript::o1_endScript, "x" },
|
|
|
|
{ &FWScript::o1_message, "bwwww" },
|
|
|
|
{ &FWScript::o1_loadGlobalVar, "bc" },
|
|
|
|
{ &FWScript::o1_compareGlobalVar, "bc" },
|
|
|
|
/* 54 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 58 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_declareFunctionName, "s" },
|
|
|
|
{ &FWScript::o1_freePartRange, "bb" },
|
|
|
|
{ &FWScript::o1_unloadAllMasks, "" },
|
|
|
|
// 5C */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 60 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_setScreenDimensions, "wwww" },
|
|
|
|
/* 64 */
|
|
|
|
{ &FWScript::o1_displayBackground, "" },
|
|
|
|
{ &FWScript::o1_initializeZoneData, "" },
|
|
|
|
{ &FWScript::o1_setZoneDataEntry, "bw" },
|
|
|
|
{ &FWScript::o1_getZoneDataEntry, "bb" },
|
|
|
|
/* 68 */
|
|
|
|
{ &FWScript::o1_setDefaultMenuColor, "b" },
|
|
|
|
{ &FWScript::o1_allowPlayerInput, "" },
|
|
|
|
{ &FWScript::o1_disallowPlayerInput, "" },
|
|
|
|
{ &FWScript::o1_changeDataDisk, "b" },
|
|
|
|
/* 6C */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_loadMusic, "s" },
|
|
|
|
{ &FWScript::o1_playMusic, "" },
|
|
|
|
{ &FWScript::o1_fadeOutMusic, "" },
|
|
|
|
/* 70 */
|
|
|
|
{ &FWScript::o1_stopSample, "" },
|
|
|
|
{ &FWScript::o1_op71, "bw" },
|
|
|
|
{ &FWScript::o1_op72, "wbw" },
|
|
|
|
{ &FWScript::o1_op72, "wbw" },
|
|
|
|
/* 74 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o2_playSample, "bbwbww" },
|
|
|
|
/* 78 */
|
|
|
|
{ &FWScript::o2_playSampleAlt, "bbwbww" },
|
|
|
|
{ &FWScript::o1_disableSystemMenu, "b" },
|
|
|
|
{ &FWScript::o1_loadMask5, "b" },
|
|
|
|
{ &FWScript::o1_unloadMask5, "b" },
|
|
|
|
/* 7C */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o2_addSeqListElement, "bbbbwww" },
|
|
|
|
/* 80 */
|
|
|
|
{ &FWScript::o2_removeSeq, "bb" },
|
|
|
|
{ &FWScript::o2_op81, "" },
|
|
|
|
{ &FWScript::o2_op82, "bbw" },
|
|
|
|
{ &FWScript::o2_isSeqRunning, "bb" },
|
|
|
|
/* 84 */
|
|
|
|
{ &FWScript::o2_gotoIfSupNearest, "b" },
|
|
|
|
{ &FWScript::o2_gotoIfSupEquNearest, "b" },
|
|
|
|
{ &FWScript::o2_gotoIfInfNearest, "b" },
|
|
|
|
{ &FWScript::o2_gotoIfInfEquNearest, "b" },
|
|
|
|
/* 88 */
|
|
|
|
{ &FWScript::o2_gotoIfEquNearest, "b" },
|
|
|
|
{ &FWScript::o2_gotoIfDiffNearest, "b" },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o2_startObjectScript, "b" },
|
|
|
|
/* 8C */
|
|
|
|
{ &FWScript::o2_stopObjectScript, "b" },
|
|
|
|
{ &FWScript::o2_op8D, "wwwwwwww" },
|
|
|
|
{ &FWScript::o2_addBackground, "bs" },
|
|
|
|
{ &FWScript::o2_removeBackground, "b" },
|
|
|
|
/* 90 */
|
|
|
|
{ &FWScript::o2_loadAbs, "bs" },
|
|
|
|
{ &FWScript::o2_loadBg, "b" },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 94 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_changeDataDisk, "b" },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* 98 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o2_wasZoneChecked, "" },
|
|
|
|
{ &FWScript::o2_op9B, "wwwwwwww" },
|
|
|
|
/* 9C */
|
|
|
|
{ &FWScript::o2_op9C, "wwww" },
|
|
|
|
{ &FWScript::o2_useBgScroll, "b" },
|
|
|
|
{ &FWScript::o2_setAdditionalBgVScroll, "c" },
|
|
|
|
{ &FWScript::o2_op9F, "ww" },
|
|
|
|
/* A0 */
|
|
|
|
{ &FWScript::o2_addGfxElementA0, "ww" },
|
|
|
|
{ &FWScript::o2_removeGfxElementA0, "ww" },
|
|
|
|
{ &FWScript::o2_opA2, "ww" },
|
|
|
|
{ &FWScript::o2_opA3, "ww" },
|
|
|
|
/* A4 */
|
|
|
|
{ &FWScript::o2_loadMask22, "b" },
|
|
|
|
{ &FWScript::o2_unloadMask22, "b" },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
/* A8 */
|
|
|
|
{ 0, 0 },
|
|
|
|
{ &FWScript::o1_changeDataDisk, "b" }
|
|
|
|
};
|
|
|
|
const unsigned int OSScript::_numOpcodes = ARRAYSIZE(OSScript::_opcodeTable);
|
2007-05-14 21:52:06 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
FWScriptInfo *scriptInfo; ///< Script factory
|
|
|
|
RawScriptArray scriptTable; ///< Table of script bytecode
|
2006-04-08 13:20:40 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo: replace with script subsystem
|
|
|
|
*/
|
2006-04-08 13:20:40 +00:00
|
|
|
void setupOpcodes() {
|
2008-04-07 20:24:40 +00:00
|
|
|
static FWScriptInfo fw;
|
|
|
|
static OSScriptInfo os;
|
2006-10-15 01:06:44 +00:00
|
|
|
if (g_cine->getGameType() == Cine::GType_FW) {
|
2008-04-07 20:24:40 +00:00
|
|
|
scriptInfo = &fw;
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
scriptInfo = &os;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-08 06:47:58 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Allocate empty array
|
|
|
|
* \param len Size of array
|
|
|
|
*
|
|
|
|
* Explicit to prevent var=0 instead of var[i]=0 typos.
|
|
|
|
*/
|
2008-01-01 16:57:03 +00:00
|
|
|
ScriptVars::ScriptVars(unsigned int len) : _size(len), _vars(new int16[len]) {
|
|
|
|
assert(_vars);
|
|
|
|
reset();
|
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Allocate array and read contents from savefile
|
|
|
|
* \param fHandle Savefile open for reading
|
|
|
|
* \param len Size of array
|
|
|
|
*/
|
2008-01-01 16:57:03 +00:00
|
|
|
ScriptVars::ScriptVars(Common::InSaveFile &fHandle, unsigned int len)
|
|
|
|
: _size(len), _vars(new int16[len]) {
|
|
|
|
|
|
|
|
assert(_vars);
|
|
|
|
|
|
|
|
load(fHandle);
|
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Copy constructor
|
|
|
|
*/
|
2008-01-01 16:57:03 +00:00
|
|
|
ScriptVars::ScriptVars(const ScriptVars &src) : _size(src._size), _vars(new int16[_size]) {
|
|
|
|
assert(_vars);
|
|
|
|
memcpy(_vars, src._vars, _size * sizeof(int16));
|
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Destructor
|
|
|
|
*/
|
2008-01-01 16:57:03 +00:00
|
|
|
ScriptVars::~ScriptVars(void) {
|
|
|
|
delete[] _vars;
|
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Assignment operator
|
|
|
|
*/
|
2008-01-01 16:57:03 +00:00
|
|
|
ScriptVars &ScriptVars::operator=(const ScriptVars &src) {
|
|
|
|
ScriptVars tmp(src);
|
|
|
|
int16 *tmpvars = _vars;
|
|
|
|
|
|
|
|
_vars = tmp._vars;
|
|
|
|
tmp._vars = tmpvars;
|
|
|
|
_size = src._size;
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Direct array item access
|
|
|
|
* \param idx Item index
|
|
|
|
* \return Reference to item
|
|
|
|
*/
|
2008-01-01 16:57:03 +00:00
|
|
|
int16 &ScriptVars::operator[](unsigned int idx) {
|
2008-04-07 20:24:40 +00:00
|
|
|
debug(6, "assert(%d < %d)", idx, _size);
|
2008-01-01 16:57:03 +00:00
|
|
|
assert(idx < _size);
|
|
|
|
return _vars[idx];
|
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Direct read-only array item access
|
|
|
|
* \param idx Item index
|
|
|
|
* \return Copy of item
|
|
|
|
*/
|
2008-01-01 16:57:03 +00:00
|
|
|
int16 ScriptVars::operator[](unsigned int idx) const {
|
2008-04-07 20:24:40 +00:00
|
|
|
debug(6, "assert(%d < %d)", idx, _size);
|
2008-01-01 16:57:03 +00:00
|
|
|
assert(idx < _size);
|
|
|
|
return _vars[idx];
|
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Savefile writer
|
|
|
|
* \param fHandle Savefile open for writing
|
|
|
|
*/
|
|
|
|
void ScriptVars::save(Common::OutSaveFile &fHandle) const {
|
2008-01-01 16:57:03 +00:00
|
|
|
save(fHandle, _size);
|
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Savefile writer with data length limit
|
|
|
|
* \param fHandle Savefile open for writing
|
|
|
|
* \param len Length of data to be written (len <= _size)
|
|
|
|
*/
|
|
|
|
void ScriptVars::save(Common::OutSaveFile &fHandle, unsigned int len) const {
|
|
|
|
debug(6, "assert(%d <= %d)", len, _size);
|
2008-01-01 16:57:03 +00:00
|
|
|
assert(len <= _size);
|
|
|
|
for (unsigned int i = 0; i < len; i++) {
|
|
|
|
fHandle.writeUint16BE(_vars[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Restore array from savefile
|
|
|
|
* \param fHandle Savefile open for reading
|
|
|
|
*/
|
2008-01-01 16:57:03 +00:00
|
|
|
void ScriptVars::load(Common::InSaveFile &fHandle) {
|
|
|
|
load(fHandle, _size);
|
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Restore part of array from savefile
|
|
|
|
* \param fHandle Savefile open for reading
|
|
|
|
* \param len Length of data to be read
|
|
|
|
*/
|
2008-01-01 16:57:03 +00:00
|
|
|
void ScriptVars::load(Common::InSaveFile &fHandle, unsigned int len) {
|
2008-04-07 20:24:40 +00:00
|
|
|
debug(6, "assert(%d <= %d)", len, _size);
|
2008-01-01 16:57:03 +00:00
|
|
|
assert(len <= _size);
|
|
|
|
for (unsigned int i = 0; i < len; i++) {
|
|
|
|
_vars[i] = fHandle.readUint16BE();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Reset all values to 0
|
|
|
|
*/
|
2008-01-01 16:57:03 +00:00
|
|
|
void ScriptVars::reset(void) {
|
|
|
|
memset( _vars, 0, _size * sizeof(int16));
|
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Constructor for partial loading
|
|
|
|
* \param s Size of bytecode which will be added later
|
|
|
|
*
|
|
|
|
* This constructor _MUST_ be followed by setdata() method call before the
|
|
|
|
* instance can be used. It leaves the instance in partially invalid state.
|
|
|
|
*/
|
|
|
|
RawScript::RawScript(uint16 s) : _size(s), _data(NULL),
|
|
|
|
_labels(SCRIPT_STACK_SIZE) { }
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Complete constructor
|
|
|
|
* \param data Script bytecode
|
|
|
|
* \param s Bytecode length
|
|
|
|
*/
|
|
|
|
RawScript::RawScript(const FWScriptInfo &info, const byte *data, uint16 s) :
|
|
|
|
_size(s), _data(NULL), _labels(SCRIPT_STACK_SIZE) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
setData(info, data);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Copy constructor
|
|
|
|
*/
|
|
|
|
RawScript::RawScript(const RawScript &src) : _size(src._size),
|
|
|
|
_data(new byte[_size+1]), _labels(src._labels) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
assert(_data);
|
|
|
|
memcpy(_data, src._data, _size+1);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Destructor
|
|
|
|
*/
|
|
|
|
RawScript::~RawScript(void) {
|
|
|
|
delete[] _data;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Assignment operator
|
|
|
|
*/
|
|
|
|
RawScript &RawScript::operator=(const RawScript &src) {
|
|
|
|
assert(src._data);
|
|
|
|
byte *tmp = new byte[src._size+1];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
assert(tmp);
|
|
|
|
_labels = src._labels;
|
|
|
|
_size = src._size;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
delete[] _data;
|
|
|
|
_data = tmp;
|
|
|
|
memcpy(_data, src._data, _size);
|
|
|
|
_data[_size] = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
return *this;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Get the next label in bytecode
|
|
|
|
* \param info Script info instance
|
|
|
|
* \param offset Starting offset
|
|
|
|
* \return Index of the next label in bytecode or _size on end of bytecode
|
|
|
|
*
|
|
|
|
* computeScriptStackSub replacement
|
|
|
|
*/
|
|
|
|
int RawScript::getNextLabel(const FWScriptInfo &info, int offset) const {
|
|
|
|
assert(_data);
|
|
|
|
int pos = offset;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
assert(pos >= 0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
while (pos < _size) {
|
|
|
|
uint8 opcode = _data[pos++];
|
|
|
|
const char *ptr = info.opcodeInfo(opcode);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (!ptr) {
|
2007-05-14 21:52:06 +00:00
|
|
|
continue;
|
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
|
|
|
|
for (; *ptr; ++ptr) {
|
|
|
|
switch (*ptr) {
|
2007-05-14 21:52:06 +00:00
|
|
|
case 'b': // byte
|
2008-04-07 20:24:40 +00:00
|
|
|
pos++;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
2007-05-14 21:52:06 +00:00
|
|
|
case 'w': // word
|
2008-04-07 20:24:40 +00:00
|
|
|
pos += 2;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
2007-05-14 21:52:06 +00:00
|
|
|
case 'c': { // byte != 0 ? byte : word
|
2008-04-07 20:24:40 +00:00
|
|
|
uint8 test = _data[pos];
|
|
|
|
pos++;
|
2007-05-14 21:52:06 +00:00
|
|
|
if (test) {
|
2008-04-07 20:24:40 +00:00
|
|
|
pos++;
|
2007-05-14 21:52:06 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
pos += 2;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2008-04-07 20:24:40 +00:00
|
|
|
case 'l': // label
|
|
|
|
return pos;
|
2007-05-14 21:52:06 +00:00
|
|
|
case 's': // string
|
2008-04-07 20:24:40 +00:00
|
|
|
while (_data[pos++] != 0);
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
2007-05-14 21:52:06 +00:00
|
|
|
case 'x': // exit script
|
2008-04-07 20:24:40 +00:00
|
|
|
return -pos-1;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
2007-05-14 21:52:06 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return _size;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Calculate initial script labels
|
|
|
|
* \param info Script info instance
|
|
|
|
*
|
|
|
|
* computeScriptStack replacement
|
|
|
|
*/
|
|
|
|
void RawScript::computeLabels(const FWScriptInfo &info) {
|
|
|
|
assert(_data);
|
|
|
|
int pos = 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
// reset labels
|
|
|
|
for (i = 0; i < SCRIPT_STACK_SIZE; i++) {
|
|
|
|
_labels[i] = -1;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
// parse bytecode
|
|
|
|
while ((pos = getNextLabel(info, pos)) >= 0) {
|
|
|
|
i = _data[pos];
|
|
|
|
_labels[i] = ++pos;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief find the next label from current position
|
|
|
|
* \param info Script info instance
|
|
|
|
* \param index Label index to look for
|
|
|
|
* \param offset Current position in script
|
|
|
|
* \return Position of next instruction following the label
|
|
|
|
*
|
|
|
|
* computeScriptStackFromScript replacement
|
|
|
|
*/
|
|
|
|
uint16 RawScript::getLabel(const FWScriptInfo &info, byte index, uint16 offset)
|
|
|
|
const {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
assert(_data);
|
|
|
|
int pos = offset;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
while ((pos = getNextLabel(info, pos)) >= 0) {
|
|
|
|
if (_data[pos++] == index) {
|
|
|
|
return pos;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
|
|
|
|
return -pos - 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Copy bytecode and calculate labels
|
|
|
|
* \param data Bytecode to copy, must be _size long
|
|
|
|
*/
|
|
|
|
void RawScript::setData(const FWScriptInfo &info, const byte *data) {
|
|
|
|
assert(!_data); // this function should be called only once per instance
|
|
|
|
_data = new byte[_size+1];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
assert(data && _data);
|
|
|
|
memcpy(_data, data, _size * sizeof(byte));
|
|
|
|
_data[_size] = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
computeLabels(info);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Initial script labels
|
|
|
|
* \return Precalculated script labels
|
|
|
|
*/
|
|
|
|
const ScriptVars &RawScript::labels(void) const {
|
|
|
|
assert(_data);
|
|
|
|
return _labels;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief One byte of bytecode
|
|
|
|
* \param pos Index in bytecode
|
|
|
|
* \return Byte from bytecode
|
|
|
|
*/
|
|
|
|
byte RawScript::getByte(unsigned int pos) const {
|
|
|
|
assert(_data && pos < _size);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
return _data[pos];
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief One word of bytecode
|
|
|
|
* \param pos Index of the first byte in bytecode
|
|
|
|
* \return Word of bytecode
|
|
|
|
*/
|
|
|
|
uint16 RawScript::getWord(unsigned int pos) const {
|
|
|
|
assert(_data && pos+1 < _size);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
return READ_BE_UINT16(_data + pos);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief String in bytecode
|
|
|
|
* \param pos Index of the first char in string
|
|
|
|
* \return Pointer to part of bytecode
|
|
|
|
*/
|
|
|
|
const char *RawScript::getString(unsigned int pos) const {
|
|
|
|
assert(_data && pos < _size);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
return (const char*)(_data+pos);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Constructor for partial loading
|
|
|
|
* \param size Size of bytecode which will be added later
|
|
|
|
* \param p1 First object script parameter
|
|
|
|
* \param p2 Second object script parameter
|
|
|
|
* \param p3 Third object script parameter
|
|
|
|
*
|
|
|
|
* This constructor _MUST_ be followed by setdata() method call before the
|
|
|
|
* instance can be used. It leaves the instance in partially invalid state.
|
|
|
|
*/
|
|
|
|
RawObjectScript::RawObjectScript(uint16 s, uint16 p1, uint16 p2, uint16 p3)
|
|
|
|
: RawScript(s), _runCount(0), _param1(p1), _param2(p2), _param3(p3)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
/*! \brief Complete constructor
|
|
|
|
* \param data Script bytecode
|
|
|
|
* \param s Bytecode length
|
|
|
|
* \param p1 First object script parameter
|
|
|
|
* \param p2 Second object script parameter
|
|
|
|
* \param p3 Third object script parameter
|
|
|
|
*/
|
|
|
|
RawObjectScript::RawObjectScript(const FWScriptInfo &info, const byte *data,
|
|
|
|
uint16 s, uint16 p1, uint16 p2, uint16 p3) : RawScript(info, data, s),
|
|
|
|
_runCount(0), _param1(p1), _param2(p2), _param3(p3) { }
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Contructor for global scripts
|
|
|
|
* \param script Script bytecode reference
|
|
|
|
* \param idx Script bytecode index
|
|
|
|
*/
|
|
|
|
FWScript::FWScript(const RawScript &script, int16 idx) : _script(script),
|
|
|
|
_pos(0), _line(0), _compare(0), _index(idx),
|
|
|
|
_labels(script.labels()), _localVars(LOCAL_VARS_SIZE),
|
|
|
|
_globalVars(globalVars), _info(new FWScriptInfo) { }
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Copy constructor
|
|
|
|
*/
|
|
|
|
FWScript::FWScript(const FWScript &src) : _script(src._script), _pos(src._pos),
|
|
|
|
_line(src._line), _compare(src._compare), _index(src._index),
|
|
|
|
_labels(src._labels), _localVars(src._localVars),
|
|
|
|
_globalVars(src._globalVars), _info(new FWScriptInfo) { }
|
|
|
|
|
|
|
|
/*! \brief Contructor for global scripts in derived classes
|
|
|
|
* \param script Script bytecode reference
|
|
|
|
* \param idx Script bytecode index
|
|
|
|
*/
|
|
|
|
FWScript::FWScript(const RawScript &script, int16 idx, FWScriptInfo *info) :
|
|
|
|
_script(script), _pos(0), _line(0), _compare(0), _index(idx),
|
|
|
|
_labels(script.labels()), _localVars(LOCAL_VARS_SIZE),
|
|
|
|
_globalVars(globalVars), _info(info) { }
|
|
|
|
|
|
|
|
/*! \brief Constructor for object scripts in derived classes
|
|
|
|
* \param script Script bytecode reference
|
|
|
|
* \param idx Script bytecode index
|
|
|
|
*/
|
|
|
|
FWScript::FWScript(RawObjectScript &script, int16 idx, FWScriptInfo *info) :
|
|
|
|
_script(script), _pos(0), _line(0), _compare(0), _index(idx),
|
|
|
|
_labels(script.labels()), _localVars(LOCAL_VARS_SIZE),
|
|
|
|
_globalVars(globalVars), _info(info) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
_localVars[0] = script.run();
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Copy constructor for derived classes
|
|
|
|
*/
|
|
|
|
FWScript::FWScript(const FWScript &src, FWScriptInfo *info) :
|
|
|
|
_script(src._script), _pos(src._pos), _line(src._line),
|
|
|
|
_compare(src._compare), _index(src._index), _labels(src._labels),
|
|
|
|
_localVars(src._localVars), _globalVars(src._globalVars), _info(info) { }
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
FWScript::~FWScript(void) {
|
|
|
|
delete _info;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Read next byte from bytecode
|
|
|
|
* \return Byte from bytecode
|
|
|
|
*/
|
|
|
|
byte FWScript::getNextByte() {
|
|
|
|
byte val = _script.getByte(_pos);
|
|
|
|
_pos++;
|
|
|
|
return val;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Read next word from bytecode
|
|
|
|
* \return Word from bytecode
|
|
|
|
*/
|
|
|
|
uint16 FWScript::getNextWord() {
|
|
|
|
uint16 val = _script.getWord(_pos);
|
|
|
|
_pos += 2;
|
|
|
|
return val;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Read next string from bytecode
|
|
|
|
* \return Pointer to string
|
|
|
|
*/
|
|
|
|
const char *FWScript::getNextString() {
|
|
|
|
const char *val = _script.getString(_pos);
|
|
|
|
_pos += strlen(val) + 1;
|
|
|
|
return val;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Restore script state from savefile
|
|
|
|
* \param labels Restored script labels
|
|
|
|
* \param local Restored local script variables
|
|
|
|
* \param compare Restored last comparison result
|
|
|
|
* \param pos Restored script position
|
|
|
|
*/
|
|
|
|
void FWScript::load(const ScriptVars &labels, const ScriptVars &local, uint16 compare, uint16 pos) {
|
|
|
|
assert(pos < _script._size);
|
|
|
|
_labels = labels;
|
|
|
|
_localVars = local;
|
|
|
|
_compare = compare;
|
|
|
|
_pos = _line = pos;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Execute script
|
|
|
|
* \return <0 on script termination, >0 on script pause
|
|
|
|
*
|
|
|
|
* executeScript replacement.
|
|
|
|
* Instruction handler must return 0 if the script should continue or
|
|
|
|
* nonzero with the same meaning as return value of this function
|
|
|
|
*/
|
|
|
|
int FWScript::execute() {
|
|
|
|
int ret = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
while (!ret) {
|
|
|
|
_line = _pos;
|
|
|
|
byte opcode = getNextByte();
|
|
|
|
opFunc handler = _info->opcodeHandler(opcode);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (handler) {
|
|
|
|
ret = (this->*handler)();
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Save script to savefile
|
|
|
|
* \param fHandle Savefile handle
|
|
|
|
*/
|
|
|
|
void FWScript::save(Common::OutSaveFile &fHandle) const {
|
|
|
|
_labels.save(fHandle);
|
|
|
|
_localVars.save(fHandle);
|
|
|
|
fHandle.writeUint16BE(_compare);
|
|
|
|
fHandle.writeUint16BE(_pos);
|
|
|
|
// data order sucks...
|
|
|
|
fHandle.writeUint16BE(_index);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*! \brief Contructor for global scripts
|
|
|
|
* \param script Script bytecode reference
|
|
|
|
* \param idx Script bytecode index
|
|
|
|
*/
|
|
|
|
OSScript::OSScript(const RawScript &script, int16 idx) :
|
|
|
|
FWScript(script, idx, new OSScriptInfo) {}
|
|
|
|
|
|
|
|
/*! \brief Constructor for object scripts
|
|
|
|
* \param script Script bytecode reference
|
|
|
|
* \param idx Script bytecode index
|
|
|
|
*/
|
|
|
|
OSScript::OSScript(RawObjectScript &script, int16 idx) :
|
|
|
|
FWScript(script, idx, new OSScriptInfo) {}
|
|
|
|
|
|
|
|
/*! \brief Copy constructor
|
|
|
|
*/
|
|
|
|
OSScript::OSScript(const OSScript &src) : FWScript(src, new OSScriptInfo) {}
|
|
|
|
|
|
|
|
/*! \brief Restore script state from savefile
|
|
|
|
* \param labels Restored script labels
|
|
|
|
* \param local Restored local script variables
|
|
|
|
* \param compare Restored last comparison result
|
|
|
|
* \param pos Restored script position
|
|
|
|
*/
|
|
|
|
void OSScript::load(const ScriptVars &labels, const ScriptVars &local, uint16 compare, uint16 pos) {
|
|
|
|
FWScript::load(labels, local, compare, pos);
|
|
|
|
}
|
|
|
|
/*! \brief Get opcode info string
|
|
|
|
* \param opcode Opcode to look for in opcode table
|
|
|
|
*/
|
|
|
|
const char *FWScriptInfo::opcodeInfo(byte opcode) const {
|
|
|
|
if (opcode == 0 || opcode > FWScript::_numOpcodes) {
|
|
|
|
return NULL;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (!FWScript::_opcodeTable[opcode - 1].args) {
|
|
|
|
warning("Undefined opcode 0x%02X in FWScriptInfo::opcodeInfo", opcode - 1);
|
|
|
|
return NULL;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
return FWScript::_opcodeTable[opcode - 1].args;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Get opcode handler pointer
|
|
|
|
* \param opcode Opcode to look for in opcode table
|
|
|
|
*/
|
|
|
|
opFunc FWScriptInfo::opcodeHandler(byte opcode) const {
|
|
|
|
if (opcode == 0 || opcode > FWScript::_numOpcodes) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (!FWScript::_opcodeTable[opcode - 1].proc) {
|
|
|
|
warning("Undefined opcode 0x%02X in FWScriptInfo::opcodeHandler", opcode - 1);
|
|
|
|
return NULL;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
return FWScript::_opcodeTable[opcode - 1].proc;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Create new FWScript instance
|
|
|
|
* \param script Script bytecode
|
|
|
|
* \param index Bytecode index
|
|
|
|
*/
|
|
|
|
FWScript *FWScriptInfo::create(const RawScript &script, int16 index) const {
|
|
|
|
return new FWScript(script, index);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Create new FWScript instance
|
|
|
|
* \param script Object script bytecode
|
|
|
|
* \param index Bytecode index
|
|
|
|
*/
|
|
|
|
FWScript *FWScriptInfo::create(const RawObjectScript &script, int16 index) const {
|
|
|
|
return new FWScript(script, index);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Load saved FWScript instance
|
|
|
|
* \param script Script bytecode
|
|
|
|
* \param index Bytecode index
|
|
|
|
* \param local Local variables
|
|
|
|
* \param labels Script labels
|
|
|
|
* \param compare Last compare result
|
|
|
|
* \param pos Position in script
|
|
|
|
*/
|
|
|
|
FWScript *FWScriptInfo::create(const RawScript &script, int16 index, const ScriptVars &labels, const ScriptVars &local, uint16 compare, uint16 pos) const {
|
|
|
|
FWScript *tmp = new FWScript(script, index);
|
|
|
|
assert(tmp);
|
|
|
|
tmp->load(labels, local, compare, pos);
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*! \brief Load saved FWScript instance
|
|
|
|
* \param script Object script bytecode
|
|
|
|
* \param index Bytecode index
|
|
|
|
* \param local Local variables
|
|
|
|
* \param labels Script labels
|
|
|
|
* \param compare Last compare result
|
|
|
|
* \param pos Position in script
|
|
|
|
*/
|
|
|
|
FWScript *FWScriptInfo::create(const RawObjectScript &script, int16 index, const ScriptVars &labels, const ScriptVars &local, uint16 compare, uint16 pos) const {
|
|
|
|
FWScript *tmp = new FWScript(script, index);
|
|
|
|
assert(tmp);
|
|
|
|
tmp->load(labels, local, compare, pos);
|
|
|
|
return tmp;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Get opcode info string
|
|
|
|
* \param opcode Opcode to look for in opcode table
|
|
|
|
*/
|
|
|
|
const char *OSScriptInfo::opcodeInfo(byte opcode) const {
|
|
|
|
if (opcode == 0 || opcode > OSScript::_numOpcodes) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (!OSScript::_opcodeTable[opcode - 1].args) {
|
|
|
|
warning("Undefined opcode 0x%02X in OSScriptInfo::opcodeInfo", opcode - 1);
|
|
|
|
return NULL;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
return OSScript::_opcodeTable[opcode - 1].args;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Get opcode handler pointer
|
|
|
|
* \param opcode Opcode to look for in opcode table
|
|
|
|
*/
|
|
|
|
opFunc OSScriptInfo::opcodeHandler(byte opcode) const {
|
|
|
|
if (opcode == 0 || opcode > OSScript::_numOpcodes) {
|
|
|
|
return NULL;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (!OSScript::_opcodeTable[opcode - 1].proc) {
|
|
|
|
warning("Undefined opcode 0x%02X in OSScriptInfo::opcodeHandler", opcode - 1);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OSScript::_opcodeTable[opcode - 1].proc;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Create new OSScript instance
|
|
|
|
* \param script Script bytecode
|
|
|
|
* \param index Bytecode index
|
|
|
|
*/
|
|
|
|
FWScript *OSScriptInfo::create(const RawScript &script, int16 index) const {
|
|
|
|
return new OSScript(script, index);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Create new OSScript instance
|
|
|
|
* \param script Object script bytecode
|
|
|
|
* \param index Bytecode index
|
|
|
|
*/
|
|
|
|
FWScript *OSScriptInfo::create(const RawObjectScript &script, int16 index) const {
|
|
|
|
return new OSScript(script, index);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Load saved OSScript instance
|
|
|
|
* \param script Script bytecode
|
|
|
|
* \param index Bytecode index
|
|
|
|
* \param local Local variables
|
|
|
|
* \param labels Script labels
|
|
|
|
* \param compare Last compare result
|
|
|
|
* \param pos Position in script
|
|
|
|
*/
|
|
|
|
FWScript *OSScriptInfo::create(const RawScript &script, int16 index, const ScriptVars &labels, const ScriptVars &local, uint16 compare, uint16 pos) const {
|
|
|
|
OSScript *tmp = new OSScript(script, index);
|
|
|
|
assert(tmp);
|
|
|
|
tmp->load(labels, local, compare, pos);
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*! \brief Load saved OSScript instance
|
|
|
|
* \param script Object script bytecode
|
|
|
|
* \param index Bytecode index
|
|
|
|
* \param local Local variables
|
|
|
|
* \param labels Script labels
|
|
|
|
* \param compare Last compare result
|
|
|
|
* \param pos Position in script
|
|
|
|
*/
|
|
|
|
FWScript *OSScriptInfo::create(const RawObjectScript &script, int16 index, const ScriptVars &labels, const ScriptVars &local, uint16 compare, uint16 pos) const {
|
|
|
|
OSScript *tmp = new OSScript(script, index);
|
|
|
|
assert(tmp);
|
|
|
|
tmp->load(labels, local, compare, pos);
|
|
|
|
return tmp;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// FUTURE WARS opcodes
|
|
|
|
// ------------------------------------------------------------------------
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_modifyObjectParam() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte objIdx = getNextByte();
|
|
|
|
byte paramIdx = getNextByte();
|
|
|
|
int16 newValue = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: modifyObjectParam(objIdx:%d,paramIdx:%d,newValue:%d)", _line, objIdx, paramIdx, newValue);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
modifyObjectParam(objIdx, paramIdx, newValue);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-04-08 06:47:58 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_getObjectParam() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte objIdx = getNextByte();
|
|
|
|
byte paramIdx = getNextByte();
|
|
|
|
byte newValue = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: getObjectParam(objIdx:%d,paramIdx:%d,var:%d)", _line, objIdx, paramIdx, newValue);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
_localVars[newValue] = getObjectParam(objIdx, paramIdx);
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_addObjectParam() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte objIdx = getNextByte();
|
|
|
|
byte paramIdx = getNextByte();
|
|
|
|
int16 newValue = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addObjectParam(objIdx:%d,paramIdx:%d,newValue:%d)", _line, objIdx, paramIdx, newValue);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
addObjectParam(objIdx, paramIdx, newValue);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-04-06 22:33:23 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_subObjectParam() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte objIdx = getNextByte();
|
|
|
|
byte paramIdx = getNextByte();
|
|
|
|
int16 newValue = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: subObjectParam(objIdx:%d,paramIdx:%d,newValue:%d)", _line, objIdx, paramIdx, newValue);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
subObjectParam(objIdx, paramIdx, newValue);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo Implement this instruction
|
|
|
|
*/
|
|
|
|
int FWScript::o1_add2ObjectParam() {
|
|
|
|
uint16 a = getNextByte();
|
|
|
|
uint16 b = getNextByte();
|
|
|
|
uint16 c = getNextWord();
|
|
|
|
warning("STUB: o1_add2ObjectParam(%x, %x, %x)", a, b, c);
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo Implement this instruction
|
|
|
|
*/
|
|
|
|
int FWScript::o1_sub2ObjectParam() {
|
|
|
|
uint16 a = getNextByte();
|
|
|
|
uint16 b = getNextByte();
|
|
|
|
uint16 c = getNextWord();
|
|
|
|
warning("STUB: o1_sub2ObjectParam(%x, %x, %x)", a, b, c);
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_compareObjectParam() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte objIdx = getNextByte();
|
|
|
|
byte param1 = getNextByte();
|
|
|
|
int16 param2 = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: compareObjectParam(objIdx:%d,type:%d,value:%d)", _line, objIdx, param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
_compare = compareObjectParam(objIdx, param1, param2);
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_setupObject() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte objIdx = getNextByte();
|
|
|
|
int16 param1 = getNextWord();
|
|
|
|
int16 param2 = getNextWord();
|
|
|
|
int16 param3 = getNextWord();
|
|
|
|
int16 param4 = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: setupObject(objIdx:%d,%d,%d,%d,%d)", _line, objIdx, param1, param2, param3, param4);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
setupObject(objIdx, param1, param2, param3, param4);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_checkCollision() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte objIdx = getNextByte();
|
|
|
|
int16 param1 = getNextWord();
|
|
|
|
int16 param2 = getNextWord();
|
|
|
|
int16 param3 = getNextWord();
|
|
|
|
int16 param4 = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: checkCollision(objIdx:%d,%d,%d,%d,%d)", _line, objIdx, param1, param2, param3, param4);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
_compare = checkCollision(objIdx, param1, param2, param3, param4);
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_loadVar() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte varType = getNextByte();
|
|
|
|
|
|
|
|
if (varType) {
|
|
|
|
byte dataIdx = getNextByte();
|
|
|
|
int16 var;
|
|
|
|
|
|
|
|
switch (varType) {
|
|
|
|
case 1:
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] = var[%d]", _line, varIdx, dataIdx);
|
|
|
|
_localVars[varIdx] = _localVars[dataIdx];
|
2006-04-08 13:20:40 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] = globalVars[%d]", _line, varIdx, dataIdx);
|
|
|
|
_localVars[varIdx] = _globalVars[dataIdx];
|
2006-04-08 13:20:40 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] = mouseX", _line, varIdx);
|
|
|
|
getMouseData(mouseUpdateStatus, &dummyU16, (uint16 *)&var, &dummyU16);
|
|
|
|
_localVars[varIdx] = var;
|
2006-04-08 13:20:40 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] = mouseY", _line, varIdx);
|
|
|
|
getMouseData(mouseUpdateStatus, &dummyU16, &dummyU16, (uint16 *)&var);
|
|
|
|
_localVars[varIdx] = var;
|
2006-04-08 13:20:40 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] = rand mod %d", _line, varIdx, dataIdx);
|
|
|
|
_localVars[varIdx] = g_cine->_rnd.getRandomNumber(dataIdx - 1);
|
2006-04-08 13:20:40 +00:00
|
|
|
break;
|
|
|
|
case 8:
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] = file[%d].packedSize", _line, varIdx, dataIdx);
|
|
|
|
_localVars[varIdx] = partBuffer[dataIdx].packedSize;
|
2006-04-08 13:20:40 +00:00
|
|
|
break;
|
|
|
|
case 9:
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] = file[%d].unpackedSize", _line, varIdx, dataIdx);
|
|
|
|
_localVars[varIdx] = partBuffer[dataIdx].unpackedSize;
|
2006-04-08 13:20:40 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("executeScript: o1_loadVar: Unknown variable type %d", varType);
|
|
|
|
}
|
|
|
|
} else {
|
2006-04-08 14:03:14 +00:00
|
|
|
int16 value = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] = %d", _line, varIdx, value);
|
|
|
|
_localVars[varIdx] = value;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_addVar() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte varType = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType) {
|
|
|
|
byte dataIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (varType == 1) {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] += var[%d]", _line, varIdx, dataIdx);
|
|
|
|
_localVars[varIdx] += _localVars[dataIdx];
|
|
|
|
} else if (varType == 2) {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] += globalVar[%d]", _line, varIdx, dataIdx);
|
|
|
|
_localVars[varIdx] += _globalVars[dataIdx];
|
|
|
|
}
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2006-04-08 14:03:14 +00:00
|
|
|
int16 value = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] += %d", _line, varIdx, value);
|
|
|
|
_localVars[varIdx] += value;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_subVar() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte varType = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType) {
|
|
|
|
byte dataIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (varType == 1) {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] -= var[%d]", _line, varIdx, dataIdx);
|
|
|
|
_localVars[varIdx] -= _localVars[dataIdx];
|
|
|
|
} else if (varType == 2) {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] -= globalVar[%d]", _line, varIdx, dataIdx);
|
|
|
|
_localVars[varIdx] -= _globalVars[dataIdx];
|
|
|
|
}
|
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2006-04-08 14:03:14 +00:00
|
|
|
int16 value = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] -= %d", _line, varIdx, value);
|
|
|
|
_localVars[varIdx] -= value;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_mulVar() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte varType = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType) {
|
|
|
|
byte dataIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (varType == 1) {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] *= var[%d]", _line, varIdx, dataIdx);
|
|
|
|
_localVars[varIdx] *= _localVars[dataIdx];
|
|
|
|
} else if (varType == 2) {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] *= globalVar[%d]", _line, varIdx, dataIdx);
|
|
|
|
_localVars[varIdx] *= _globalVars[dataIdx];
|
|
|
|
}
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2006-04-08 14:03:14 +00:00
|
|
|
int16 value = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] *= %d", _line, varIdx, value);
|
|
|
|
_localVars[varIdx] *= value;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_divVar() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte varType = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType) {
|
|
|
|
byte dataIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (varType == 1) {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] /= var[%d]", _line, varIdx, dataIdx);
|
|
|
|
_localVars[varIdx] /= _localVars[dataIdx];
|
|
|
|
} else if (varType == 2) {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] /= globalVar[%d]", _line, varIdx, dataIdx);
|
|
|
|
_localVars[varIdx] /= _globalVars[dataIdx];
|
|
|
|
}
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2006-04-08 14:03:14 +00:00
|
|
|
int16 value = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: var[%d] /= %d", _line, varIdx, value);
|
|
|
|
_localVars[varIdx] /= value;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_compareVar() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte varType = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType) {
|
|
|
|
byte dataIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType == 1) {
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: compare var[%d] and var[%d]", _line, varIdx, dataIdx);
|
|
|
|
_compare = compareVars(_localVars[varIdx], _localVars[dataIdx]);
|
2006-04-08 13:20:40 +00:00
|
|
|
} else if (varType == 2) {
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: compare var[%d] and globalVar[%d]", _line, varIdx, dataIdx);
|
|
|
|
_compare = compareVars(_localVars[varIdx], _globalVars[dataIdx]);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
int16 value = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: compare var[%d] and %d", _line, varIdx, value);
|
|
|
|
_compare = compareVars(_localVars[varIdx], value);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_modifyObjectParam2() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte objIdx = getNextByte();
|
|
|
|
byte paramIdx = getNextByte();
|
|
|
|
byte newValue = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: modifyObjectParam2(objIdx:%d,paramIdx:%d,var[%d])", _line, objIdx, paramIdx, newValue);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
modifyObjectParam(objIdx, paramIdx, _localVars[newValue]);
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_loadMask0() {
|
2006-04-08 13:20:40 +00:00
|
|
|
// OP_loadV7Element
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addSpriteOverlay(%d)", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
loadOverlayElement(param, 0);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_unloadMask0() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: removeSpriteOverlay(%d)", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
freeOverlay(param, 0);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_addToBgList() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addToBGList(%d)", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
addToBGList(param);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_loadMask1() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addOverlay1(%d)", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
loadOverlayElement(param, 1);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_unloadMask1() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: removeOverlay1(%d)", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
freeOverlay(param, 1);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_loadMask4() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addOverlayType4(%d)", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
loadOverlayElement(param, 4);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_unloadMask4() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: removeSpriteOverlay4(%d)", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
freeOverlay(param, 4);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_addSpriteFilledToBgList() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: op1A(%d) -> TODO !", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
addSpriteFilledToBGList(param);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_op1B() {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: freeBgIncrustList", _line);
|
|
|
|
bgIncrustList.clear();
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_label() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: label(%d)", _line, labelIdx);
|
|
|
|
_labels[labelIdx] = _pos;
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_goto() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
assert(_labels[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: goto label(%d)", _line, labelIdx);
|
|
|
|
_pos = _labels[labelIdx];
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_gotoIfSup() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (_compare == kCmpGT) {
|
|
|
|
assert(_labels[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(>) goto %d (true)", _line, labelIdx);
|
|
|
|
_pos = _labels[labelIdx];
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(>) goto %d (false)", _line, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_gotoIfSupEqu() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (_compare & (kCmpGT | kCmpEQ)) {
|
|
|
|
assert(_labels[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(>=) goto %d (true)", _line, labelIdx);
|
|
|
|
_pos = _labels[labelIdx];
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(>=) goto %d (false)", _line, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_gotoIfInf() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (_compare == kCmpLT) {
|
|
|
|
assert(_labels[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(<) goto %d (true)", _line, labelIdx);
|
|
|
|
_pos = _labels[labelIdx];
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(<) goto %d (false)", _line, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_gotoIfInfEqu() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (_compare & (kCmpLT | kCmpEQ)) {
|
|
|
|
assert(_labels[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(<=) goto %d (true)", _line, labelIdx);
|
|
|
|
_pos = _labels[labelIdx];
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(<=) goto %d (false)", _line, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_gotoIfEqu() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (_compare == kCmpEQ) {
|
|
|
|
assert(_labels[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(==) goto %d (true)", _line, labelIdx);
|
|
|
|
_pos = _labels[labelIdx];
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(==) goto %d (false)", _line, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_gotoIfDiff() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (_compare != kCmpEQ) {
|
|
|
|
assert(_labels[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(!=) goto %d (true)", _line, labelIdx);
|
|
|
|
_pos = _labels[labelIdx];
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(!=) goto %d (false)", _line, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_removeLabel() {
|
2006-04-08 17:51:20 +00:00
|
|
|
byte labelIdx = getNextByte();
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: removeLabel(%d)", _line, labelIdx);
|
|
|
|
_labels[labelIdx] = -1;
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_loop() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
_localVars[varIdx]--;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (_localVars[varIdx] >= 0) {
|
|
|
|
assert(_labels[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loop(var[%d]) goto %d (continue)", _line, varIdx, labelIdx);
|
|
|
|
_pos = _labels[labelIdx];
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loop(var[%d]) goto %d (stop)", _line, varIdx, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_startGlobalScript() {
|
2006-04-08 13:20:40 +00:00
|
|
|
// OP_startScript
|
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(param < NUM_MAX_SCRIPT);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: startScript(%d)", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
addScriptToList0(param);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_endGlobalScript() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte scriptIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: stopGlobalScript(%d)", _line, scriptIdx);
|
|
|
|
|
|
|
|
ScriptList::iterator it = globalScripts.begin();
|
|
|
|
|
|
|
|
for (; it != globalScripts.end(); ++it) {
|
|
|
|
if ((*it)->_index == scriptIdx) {
|
|
|
|
(*it)->_index = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_loadAnim() {
|
2006-04-08 13:20:40 +00:00
|
|
|
// OP_loadResource
|
|
|
|
const char *param = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadResource(\"%s\")", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
loadResource(param);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_loadBg() {
|
2006-04-08 13:20:40 +00:00
|
|
|
const char *param = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadBg(\"%s\")", _line, param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
loadBg(param);
|
2008-04-07 20:24:40 +00:00
|
|
|
bgIncrustList.clear();
|
2006-04-08 13:20:40 +00:00
|
|
|
bgVar0 = 0;
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_loadCt() {
|
2006-04-08 13:20:40 +00:00
|
|
|
const char *param = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadCt(\"%s\")", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
loadCt(param);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_loadPart() {
|
2006-04-08 13:20:40 +00:00
|
|
|
const char *param = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadPart(\"%s\")", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
loadPart(param);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_closePart() {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: closePart", _line);
|
2006-04-08 13:20:40 +00:00
|
|
|
closePart();
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_loadNewPrcName() {
|
2006-04-08 13:20:40 +00:00
|
|
|
// OP_loadData
|
|
|
|
byte param1 = getNextByte();
|
|
|
|
const char *param2 = getNextString();
|
|
|
|
|
|
|
|
assert(param1 <= 3);
|
|
|
|
|
|
|
|
switch (param1) {
|
|
|
|
case 0:
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadPrc(\"%s\")", _line, param2);
|
2006-04-08 13:20:40 +00:00
|
|
|
strcpy(newPrcName, param2);
|
|
|
|
break;
|
|
|
|
case 1:
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadRel(\"%s\")", _line, param2);
|
2006-04-08 13:20:40 +00:00
|
|
|
strcpy(newRelName, param2);
|
|
|
|
break;
|
|
|
|
case 2:
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadObject(\"%s\")", _line, param2);
|
2006-04-08 13:20:40 +00:00
|
|
|
strcpy(newObjectName, param2);
|
|
|
|
break;
|
|
|
|
case 3:
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadMsg(\"%s\")", _line, param2);
|
2006-04-08 13:20:40 +00:00
|
|
|
strcpy(newMsgName, param2);
|
|
|
|
break;
|
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_requestCheckPendingDataLoad() {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: request data load", _line);
|
2006-04-08 13:20:40 +00:00
|
|
|
checkForPendingDataLoadSwitch = 1;
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_blitAndFade() {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: request fadein", _line);
|
2006-04-08 13:20:40 +00:00
|
|
|
// TODO: use real code
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
drawOverlays();
|
2007-12-09 13:41:59 +00:00
|
|
|
fadeRequired = true;
|
2006-04-08 13:20:40 +00:00
|
|
|
flip();
|
2008-04-07 20:24:40 +00:00
|
|
|
|
|
|
|
// fadeFromBlack();
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_fadeToBlack() {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: request fadeout", _line);
|
2006-11-18 20:57:37 +00:00
|
|
|
|
|
|
|
fadeToBlack();
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_transformPaletteRange() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte startColor = getNextByte();
|
|
|
|
byte numColor = getNextByte();
|
|
|
|
uint16 r = getNextWord();
|
|
|
|
uint16 g = getNextWord();
|
|
|
|
uint16 b = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: transformPaletteRange(from:%d,numIdx:%d,r:%d,g:%d,b:%d)", _line, startColor, numColor, r, g, b);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
transformPaletteRange(startColor, numColor, r, g, b);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_setDefaultMenuColor2() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: setDefaultMenuColor2(%d)", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
defaultMenuBoxColor2 = param;
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_palRotate() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte a = getNextByte();
|
|
|
|
byte b = getNextByte();
|
|
|
|
byte c = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: palRotate(%d,%d,%d)", _line, a, b, c);
|
2006-04-08 13:20:40 +00:00
|
|
|
palRotate(a, b, c);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*!\brief Pause script
|
|
|
|
* \todo Make sure it works
|
|
|
|
*/
|
|
|
|
int FWScript::o1_break() {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: break", _line);
|
2006-04-08 06:47:58 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
return 1;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \brief Terminate script
|
|
|
|
* \todo Make sure it works
|
|
|
|
*/
|
|
|
|
int FWScript::o1_endScript() {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: endScript", _line);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
return -1;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_message() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param1 = getNextByte();
|
|
|
|
uint16 param2 = getNextWord();
|
|
|
|
uint16 param3 = getNextWord();
|
|
|
|
uint16 param4 = getNextWord();
|
|
|
|
uint16 param5 = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: message(%d,%d,%d,%d,%d)", _line, param1, param2, param3, param4, param5);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
addMessage(param1, param2, param3, param4, param5);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_loadGlobalVar() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte varType = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType) {
|
|
|
|
byte dataIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType == 1) {
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: globalVars[%d] = var[%d]", _line, varIdx, dataIdx);
|
|
|
|
_globalVars[varIdx] = _localVars[dataIdx];
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: globalVars[%d] = globalVars[%d]", _line, varIdx, dataIdx);
|
|
|
|
_globalVars[varIdx] = _globalVars[dataIdx];
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
} else {
|
2006-04-08 14:03:14 +00:00
|
|
|
uint16 value = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: globalVars[%d] = %d", _line, varIdx, value);
|
|
|
|
_globalVars[varIdx] = value;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_compareGlobalVar() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte varIdx = getNextByte();
|
|
|
|
byte varType = getNextByte();
|
2006-04-06 22:33:23 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (varType) {
|
|
|
|
byte value = getNextByte();
|
2006-04-06 22:33:23 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (varType == 1) {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: compare globalVars[%d] and var[%d]", _line, varIdx, value);
|
|
|
|
_compare = compareVars(_globalVars[varIdx], _localVars[value]);
|
|
|
|
} else {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: compare globalVars[%d] and globalVars[%d]", _line, varIdx, value);
|
|
|
|
_compare = compareVars(_globalVars[varIdx], _globalVars[value]);
|
|
|
|
}
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2006-04-08 14:03:14 +00:00
|
|
|
uint16 value = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: compare globalVars[%d] and %d", _line, varIdx, value);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-10-15 01:06:44 +00:00
|
|
|
if (varIdx == 255 && (g_cine->getGameType() == Cine::GType_FW)) { // TODO: fix
|
2008-04-07 20:24:40 +00:00
|
|
|
_compare = 1;
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
_compare = compareVars(_globalVars[varIdx], value);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_declareFunctionName() {
|
2006-04-08 13:20:40 +00:00
|
|
|
const char *param = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: comment(%s)", _line, param);
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_freePartRange() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte startIdx = getNextByte();
|
|
|
|
byte numIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(startIdx + numIdx <= NUM_MAX_ANIMDATA);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: freePartRange(%d,%d)", _line, startIdx, numIdx);
|
2007-05-29 20:22:20 +00:00
|
|
|
freeAnimDataRange(startIdx, numIdx);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_unloadAllMasks() {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: unloadAllMasks()", _line);
|
2006-04-08 13:20:40 +00:00
|
|
|
unloadAllMasks();
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo Implement this instruction
|
|
|
|
*/
|
|
|
|
int FWScript::o1_setScreenDimensions() {
|
|
|
|
uint16 a = getNextWord();
|
|
|
|
uint16 b = getNextWord();
|
|
|
|
uint16 c = getNextWord();
|
|
|
|
uint16 d = getNextWord();
|
|
|
|
warning("STUB: o1_setScreenDimensions(%x, %x, %x, %x)", a, b, c, d);
|
2006-04-08 19:26:15 +00:00
|
|
|
// setupScreenParam
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo Implement this instruction
|
|
|
|
*/
|
|
|
|
int FWScript::o1_displayBackground() {
|
2007-12-14 19:21:19 +00:00
|
|
|
warning("STUB: o1_displayBackground()");
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_initializeZoneData() {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: initializeZoneData()", _line);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
for (int i = 0; i < NUM_MAX_ZONE; i++) {
|
|
|
|
zoneData[i] = i;
|
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_setZoneDataEntry() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte zoneIdx = getNextByte();
|
|
|
|
uint16 var = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: setZone[%d] = %d", _line, zoneIdx, var);
|
2006-04-08 13:20:40 +00:00
|
|
|
zoneData[zoneIdx] = var;
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_getZoneDataEntry() {
|
2007-05-14 21:52:06 +00:00
|
|
|
byte zoneIdx = getNextByte();
|
|
|
|
byte var = getNextByte();
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
_localVars[var] = zoneData[zoneIdx];
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_setDefaultMenuColor() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: setDefaultMenuColor(%d)", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
defaultMenuBoxColor = param;
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_allowPlayerInput() {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: allowPlayerInput()", _line);
|
2006-04-08 13:20:40 +00:00
|
|
|
allowPlayerInput = 1;
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_disallowPlayerInput() {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: dissallowPlayerInput()", _line);
|
2006-04-08 13:20:40 +00:00
|
|
|
allowPlayerInput = 0;
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_changeDataDisk() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte newDisk = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: changeDataDisk(%d)", _line, newDisk);
|
2006-04-08 13:20:40 +00:00
|
|
|
checkDataDisk(newDisk);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_loadMusic() {
|
2006-04-08 13:20:40 +00:00
|
|
|
const char *param = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadMusic(%s)", _line, param);
|
2007-05-19 12:08:41 +00:00
|
|
|
g_sound->loadMusic(param);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_playMusic() {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: playMusic()", _line);
|
2007-05-19 12:08:41 +00:00
|
|
|
g_sound->playMusic();
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_fadeOutMusic() {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: fadeOutMusic()", _line);
|
2007-05-19 12:08:41 +00:00
|
|
|
g_sound->fadeOutMusic();
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_stopSample() {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: stopSample()", _line);
|
2007-05-19 12:08:41 +00:00
|
|
|
g_sound->stopMusic();
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo Implement this instruction
|
|
|
|
*/
|
|
|
|
int FWScript::o1_op71() {
|
|
|
|
byte a = getNextByte();
|
|
|
|
uint16 b = getNextWord();
|
|
|
|
warning("STUB: o1_op71(%x, %x)", a, b);
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo Implement this instruction
|
|
|
|
*/
|
|
|
|
int FWScript::o1_op72() {
|
|
|
|
uint16 a = getNextWord();
|
|
|
|
byte b = getNextByte();
|
|
|
|
uint16 c = getNextWord();
|
|
|
|
warning("STUB: o1_op72(%x, %x, %x)", a, b, c);
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo Implement this instruction
|
|
|
|
*/
|
|
|
|
int FWScript::o1_op73() {
|
2006-04-08 19:26:15 +00:00
|
|
|
// I believe this opcode is identical to o1_op72(). In fact, Operation
|
|
|
|
// Stealth doesn't even have it. It uses o1_op72() instead.
|
2008-04-07 20:24:40 +00:00
|
|
|
uint16 a = getNextWord();
|
|
|
|
byte b = getNextByte();
|
|
|
|
uint16 c = getNextWord();
|
|
|
|
warning("STUB: o1_op72(%x, %x, %x)", a, b, c);
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_playSample() {
|
|
|
|
debugC(5, kCineDebugScript, "Line: %d: playSample()", _line);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
byte anim = getNextByte();
|
|
|
|
byte channel = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2007-05-19 12:08:41 +00:00
|
|
|
uint16 freq = getNextWord();
|
|
|
|
byte repeat = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
int16 volume = getNextWord();
|
2007-05-19 12:08:41 +00:00
|
|
|
uint16 size = getNextWord();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
const byte *data = animDataTable[anim].data();
|
|
|
|
|
|
|
|
if (!data) {
|
|
|
|
return 0;
|
2007-05-19 12:08:41 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2007-05-19 12:08:41 +00:00
|
|
|
if (g_cine->getPlatform() == Common::kPlatformAmiga || g_cine->getPlatform() == Common::kPlatformAtariST) {
|
|
|
|
if (size == 0xFFFF) {
|
2008-04-07 20:24:40 +00:00
|
|
|
size = animDataTable[anim]._width * animDataTable[anim]._height;
|
2007-05-19 12:08:41 +00:00
|
|
|
}
|
|
|
|
if (channel < 10) { // || _currentOpcode == 0x78
|
|
|
|
int channel1, channel2;
|
|
|
|
if (channel == 0) {
|
|
|
|
channel1 = 0;
|
|
|
|
channel2 = 1;
|
|
|
|
} else {
|
|
|
|
channel1 = 2;
|
2007-09-19 08:40:12 +00:00
|
|
|
channel2 = 3;
|
2007-05-19 12:08:41 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
g_sound->playSound(channel1, freq, data, size, -1, volume, 63, repeat);
|
|
|
|
g_sound->playSound(channel2, freq, data, size, 1, volume, 0, repeat);
|
2007-05-19 12:08:41 +00:00
|
|
|
} else {
|
|
|
|
channel -= 10;
|
|
|
|
if (volume > 63) {
|
|
|
|
volume = 63;
|
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
g_sound->playSound(channel, freq, data, size, 0, 0, volume, repeat);
|
2007-05-19 12:08:41 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (volume > 63 || volume < 0) {
|
|
|
|
volume = 63;
|
|
|
|
}
|
2006-04-08 13:20:40 +00:00
|
|
|
if (channel >= 10) {
|
|
|
|
channel -= 10;
|
|
|
|
}
|
|
|
|
if (volume < 50) {
|
|
|
|
volume = 50;
|
|
|
|
}
|
2007-12-09 13:41:59 +00:00
|
|
|
if (g_cine->getGameType() == Cine::GType_OS && size == 0) {
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2007-12-09 13:41:59 +00:00
|
|
|
}
|
2007-05-19 12:08:41 +00:00
|
|
|
g_sound->stopMusic();
|
|
|
|
if (size == 0xFFFF) {
|
2008-04-07 20:24:40 +00:00
|
|
|
g_sound->playSound(channel, 0, data, 0, 0, 0, volume, 0);
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2007-05-19 12:08:41 +00:00
|
|
|
g_sound->stopSound(channel);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_disableSystemMenu() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: disableSystemMenu(%d)", _line, param);
|
2006-11-24 20:25:55 +00:00
|
|
|
disableSystemMenu = (param != 0);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_loadMask5() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addOverlay5(%d)", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
loadOverlayElement(param, 5);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-04-08 06:47:58 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o1_unloadMask5() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: freeOverlay5(%d)", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
freeOverlay(param, 5);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// OPERATION STEALTH opcodes
|
|
|
|
// ------------------------------------------------------------------------
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o2_loadPart() {
|
2006-04-08 13:20:40 +00:00
|
|
|
const char *param = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadPart(\"%s\")", _line, param);
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o2_playSample() {
|
2007-05-13 16:11:19 +00:00
|
|
|
if (g_cine->getPlatform() == Common::kPlatformAmiga || g_cine->getPlatform() == Common::kPlatformAtariST) {
|
|
|
|
// no-op in these versions
|
2007-05-14 21:52:06 +00:00
|
|
|
getNextByte();
|
|
|
|
getNextByte();
|
|
|
|
getNextWord();
|
|
|
|
getNextByte();
|
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2007-05-13 16:11:19 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return o1_playSample();
|
2006-04-08 19:26:15 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o2_playSampleAlt() {
|
2007-05-19 12:08:41 +00:00
|
|
|
byte num = getNextByte();
|
|
|
|
byte channel = getNextByte();
|
|
|
|
uint16 frequency = getNextWord();
|
2007-05-13 16:11:19 +00:00
|
|
|
getNextByte();
|
|
|
|
getNextWord();
|
2007-05-19 12:08:41 +00:00
|
|
|
uint16 size = getNextWord();
|
2007-05-13 16:11:19 +00:00
|
|
|
|
|
|
|
if (size == 0xFFFF) {
|
2008-04-07 20:24:40 +00:00
|
|
|
size = animDataTable[num]._width * animDataTable[num]._height;
|
2007-05-13 16:11:19 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
if (animDataTable[num].data()) {
|
2007-05-13 16:11:19 +00:00
|
|
|
if (g_cine->getPlatform() == Common::kPlatformPC) {
|
2007-12-09 13:41:59 +00:00
|
|
|
// if speaker output is available, play sound on it
|
2007-05-13 16:11:19 +00:00
|
|
|
// if it's another device, don't play anything
|
2007-12-09 13:41:59 +00:00
|
|
|
// TODO: implement this, it's used in the introduction for example
|
|
|
|
// on each letter displayed
|
2007-05-13 16:11:19 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
g_sound->playSound(channel, frequency, animDataTable[num].data(), size, 0, 0, 63, 0);
|
2007-05-13 16:11:19 +00:00
|
|
|
}
|
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2007-05-13 16:11:19 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o2_addSeqListElement() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param1 = getNextByte();
|
|
|
|
byte param2 = getNextByte();
|
|
|
|
byte param3 = getNextByte();
|
|
|
|
byte param4 = getNextByte();
|
|
|
|
uint16 param5 = getNextWord();
|
|
|
|
uint16 param6 = getNextWord();
|
|
|
|
uint16 param7 = getNextWord();
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addSeqListElement(%d,%d,%d,%d,%d,%d,%d)", _line, param1, param2, param3, param4, param5, param6, param7);
|
2006-04-08 13:20:40 +00:00
|
|
|
addSeqListElement(param1, 0, param2, param3, param4, param5, param6, 0, param7);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-04-08 06:47:58 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o2_removeSeq() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte a = getNextByte();
|
|
|
|
byte b = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: removeSeq(%d,%d) -> TODO", _line, a, b);
|
2006-04-08 13:20:40 +00:00
|
|
|
removeSeq(a, 0, b);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo Implement this instruction
|
|
|
|
*/
|
|
|
|
int FWScript::o2_op81() {
|
2006-04-08 13:20:40 +00:00
|
|
|
warning("STUB: o2_op81()");
|
2006-04-08 19:26:15 +00:00
|
|
|
// freeUnkList();
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo Implement this instruction
|
|
|
|
*/
|
|
|
|
int FWScript::o2_op82() {
|
|
|
|
byte a = getNextByte();
|
|
|
|
byte b = getNextByte();
|
|
|
|
uint16 c = getNextWord();
|
|
|
|
warning("STUB: o2_op82(%x, %x, %x)", a, b, c);
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o2_isSeqRunning() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte a = getNextByte();
|
|
|
|
byte b = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: OP83(%d,%d) -> TODO", _line, a, b);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (isSeqRunning(a, 0, b)) {
|
2008-04-07 20:24:40 +00:00
|
|
|
_compare = 1;
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
_compare = 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo The assert may produce false positives and requires testing
|
|
|
|
*/
|
|
|
|
int FWScript::o2_gotoIfSupNearest() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (_compare == kCmpGT) {
|
|
|
|
assert(_labels[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(>) goto nearest %d (true)", _line, labelIdx);
|
|
|
|
_pos = _script.getLabel(*_info, labelIdx, _pos);
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(>) goto nearest %d (false)", _line, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo The assert may produce false positives and requires testing
|
|
|
|
*/
|
|
|
|
int FWScript::o2_gotoIfSupEquNearest() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (_compare & (kCmpGT | kCmpEQ)) {
|
|
|
|
assert(_labels[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(>=) goto nearest %d (true)", _line, labelIdx);
|
|
|
|
_pos = _script.getLabel(*_info, labelIdx, _pos);
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(>=) goto nearest %d (false)", _line, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo The assert may produce false positives and requires testing
|
|
|
|
*/
|
|
|
|
int FWScript::o2_gotoIfInfNearest() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (_compare == kCmpLT) {
|
|
|
|
assert(_labels[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(<) goto nearest %d (true)", _line, labelIdx);
|
|
|
|
_pos = _script.getLabel(*_info, labelIdx, _pos);
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(<) goto nearest %d (false)", _line, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo The assert may produce false positives and requires testing
|
|
|
|
*/
|
|
|
|
int FWScript::o2_gotoIfInfEquNearest() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (_compare & (kCmpLT | kCmpEQ)) {
|
|
|
|
assert(_labels[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(<=) goto nearest %d (true)", _line, labelIdx);
|
|
|
|
_pos = _script.getLabel(*_info, labelIdx, _pos);
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(<=) goto nearest %d (false)", _line, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo The assert may produce false positives and requires testing
|
|
|
|
*/
|
|
|
|
int FWScript::o2_gotoIfEquNearest() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (_compare == kCmpEQ) {
|
|
|
|
assert(_labels[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(==) goto nearest %d (true)", _line, labelIdx);
|
|
|
|
_pos = _script.getLabel(*_info, labelIdx, _pos);
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(==) goto nearest %d (false)", _line, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo The assert may produce false positives and requires testing
|
|
|
|
*/
|
|
|
|
int FWScript::o2_gotoIfDiffNearest() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte labelIdx = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (_compare != kCmpEQ) {
|
|
|
|
assert(_labels[labelIdx] != -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(!=) goto nearest %d (true)", _line, labelIdx);
|
|
|
|
_pos = _script.getLabel(*_info, labelIdx, _pos);
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: if(!=) goto nearest %d (false)", _line, labelIdx);
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o2_startObjectScript() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: startObjectScript(%d)", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
runObjectScript(param);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o2_stopObjectScript() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: stopObjectScript(%d)", _line, param);
|
|
|
|
ScriptList::iterator it = objectScripts.begin();
|
|
|
|
|
|
|
|
for (; it != objectScripts.end(); ++it) {
|
|
|
|
if ((*it)->_index == param) {
|
|
|
|
(*it)->_index = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo Implement this instruction
|
|
|
|
*/
|
|
|
|
int FWScript::o2_op8D() {
|
|
|
|
uint16 a = getNextWord();
|
|
|
|
uint16 b = getNextWord();
|
|
|
|
uint16 c = getNextWord();
|
|
|
|
uint16 d = getNextWord();
|
|
|
|
uint16 e = getNextWord();
|
|
|
|
uint16 f = getNextWord();
|
|
|
|
uint16 g = getNextWord();
|
|
|
|
uint16 h = getNextWord();
|
|
|
|
warning("STUB: o2_op8D(%x, %x, %x, %x, %x, %x, %x, %x)", a, b, c, d, e, f, g, h);
|
2006-04-08 19:26:15 +00:00
|
|
|
// _currentScriptElement->compareResult = ...
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o2_addBackground() {
|
2006-04-08 14:23:33 +00:00
|
|
|
byte param1 = getNextByte();
|
2006-04-08 13:20:40 +00:00
|
|
|
const char *param2 = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addBackground(%s,%d)", _line, param2, param1);
|
2006-04-08 13:20:40 +00:00
|
|
|
addBackground(param2, param1);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o2_removeBackground() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: removeBackground(%d)", _line, param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (additionalBgTable[param]) {
|
|
|
|
free(additionalBgTable[param]);
|
|
|
|
additionalBgTable[param] = NULL;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (currentAdditionalBgIdx == param) {
|
|
|
|
currentAdditionalBgIdx = 0;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (currentAdditionalBgIdx2 == param) {
|
|
|
|
currentAdditionalBgIdx2 = 0;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
strcpy(currentBgName[param], "");
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o2_loadAbs() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param1 = getNextByte();
|
|
|
|
const char *param2 = getNextString();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: loadABS(%d,%s)", _line, param1, param2);
|
2006-04-08 13:20:40 +00:00
|
|
|
loadAbs(param2, param1);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o2_loadBg() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(param <= 8);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: useBg(%d)", _line, param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
if (additionalBgTable[param]) {
|
|
|
|
currentAdditionalBgIdx = param;
|
2008-04-07 20:24:40 +00:00
|
|
|
if (param == 8) {
|
|
|
|
newColorMode = 3;
|
|
|
|
} else {
|
|
|
|
newColorMode = bgColorMode + 1;
|
|
|
|
}
|
2007-12-09 13:41:59 +00:00
|
|
|
//if (_screenNeedFadeOut == 0) {
|
2006-04-08 13:20:40 +00:00
|
|
|
// adBgVar1 = 1;
|
|
|
|
//}
|
2007-12-09 13:41:59 +00:00
|
|
|
fadeRequired = true;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo Implement this instruction
|
|
|
|
*/
|
|
|
|
int FWScript::o2_wasZoneChecked() {
|
2006-04-08 13:20:40 +00:00
|
|
|
warning("STUB: o2_wasZoneChecked()");
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo Implement this instruction
|
|
|
|
*/
|
|
|
|
int FWScript::o2_op9B() {
|
|
|
|
uint16 a = getNextWord();
|
|
|
|
uint16 b = getNextWord();
|
|
|
|
uint16 c = getNextWord();
|
|
|
|
uint16 d = getNextWord();
|
|
|
|
uint16 e = getNextWord();
|
|
|
|
uint16 f = getNextWord();
|
|
|
|
uint16 g = getNextWord();
|
|
|
|
uint16 h = getNextWord();
|
|
|
|
warning("STUB: o2_op9B(%x, %x, %x, %x, %x, %x, %x, %x)", a, b, c, d, e, f, g, h);
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo Implement this instruction
|
|
|
|
*/
|
|
|
|
int FWScript::o2_op9C() {
|
|
|
|
uint16 a = getNextWord();
|
|
|
|
uint16 b = getNextWord();
|
|
|
|
uint16 c = getNextWord();
|
|
|
|
uint16 d = getNextWord();
|
|
|
|
warning("STUB: o2_op9C(%x, %x, %x, %x)", a, b, c, d);
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o2_useBgScroll() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param = getNextByte();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-08 13:20:40 +00:00
|
|
|
assert(param <= 8);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: useBgScroll(%d)", _line, param);
|
2006-04-08 13:20:40 +00:00
|
|
|
|
|
|
|
if (additionalBgTable[param]) {
|
|
|
|
currentAdditionalBgIdx2 = param;
|
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o2_setAdditionalBgVScroll() {
|
2006-04-08 13:20:40 +00:00
|
|
|
byte param1 = getNextByte();
|
|
|
|
|
|
|
|
if (param1) {
|
|
|
|
byte param2 = getNextByte();
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: additionalBgVScroll = var[%d]", _line, param2);
|
|
|
|
additionalBgVScroll = _localVars[param2];
|
2006-04-08 13:20:40 +00:00
|
|
|
} else {
|
|
|
|
uint16 param2 = getNextWord();
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: additionalBgVScroll = %d", _line, param2);
|
2006-04-08 13:20:40 +00:00
|
|
|
additionalBgVScroll = param2;
|
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo Implement this instruction
|
|
|
|
*/
|
|
|
|
int FWScript::o2_op9F() {
|
2006-04-08 13:20:40 +00:00
|
|
|
warning("o2_op9F()");
|
2006-04-08 19:26:15 +00:00
|
|
|
getNextWord();
|
|
|
|
getNextWord();
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o2_addGfxElementA0() {
|
2006-04-08 13:20:40 +00:00
|
|
|
uint16 param1 = getNextWord();
|
|
|
|
uint16 param2 = getNextWord();
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addGfxElementA0(%d,%d)", _line, param1, param2);
|
2006-04-08 13:20:40 +00:00
|
|
|
addGfxElementA0(param1, param2);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo Implement this instruction
|
|
|
|
*/
|
|
|
|
int FWScript::o2_removeGfxElementA0() {
|
|
|
|
uint16 idx = getNextWord();
|
|
|
|
uint16 param = getNextWord();
|
|
|
|
warning("STUB? o2_removeGfxElementA0(%x, %x)", idx, param);
|
|
|
|
removeGfxElementA0(idx, param);
|
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo Implement this instruction
|
|
|
|
*/
|
|
|
|
int FWScript::o2_opA2() {
|
|
|
|
uint16 a = getNextWord();
|
|
|
|
uint16 b = getNextWord();
|
|
|
|
warning("STUB: o2_opA2(%x, %x)", a, b);
|
2006-04-08 19:26:15 +00:00
|
|
|
// addGfxElementA2();
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo Implement this instruction
|
|
|
|
*/
|
|
|
|
int FWScript::o2_opA3() {
|
|
|
|
uint16 a = getNextWord();
|
|
|
|
uint16 b = getNextWord();
|
|
|
|
warning("STUB: o2_opA3(%x, %x)", a, b);
|
2006-04-08 19:26:15 +00:00
|
|
|
// removeGfxElementA2();
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o2_loadMask22() {
|
2006-04-08 19:26:15 +00:00
|
|
|
byte param = getNextByte();
|
2006-04-08 13:20:40 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: addOverlay22(%d)", _line, param);
|
2006-04-08 19:26:15 +00:00
|
|
|
loadOverlayElement(param, 22);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int FWScript::o2_unloadMask22() {
|
2006-04-08 19:26:15 +00:00
|
|
|
byte param = getNextByte();
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
debugC(5, kCineDebugScript, "Line: %d: removeOverlay22(%d)", _line, param);
|
2006-04-08 19:26:15 +00:00
|
|
|
freeOverlay(param, 22);
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
//-----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void addGfxElementA0(int16 param1, int16 param2) {
|
|
|
|
overlayHeadElement *currentHead = &overlayHead;
|
|
|
|
overlayHeadElement *tempHead = currentHead;
|
|
|
|
overlayHeadElement *newElement;
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
if (objectTable[currentHead->objIdx].mask == objectTable[param1].mask) {
|
|
|
|
if (currentHead->type == 2 || currentHead->objIdx == 3) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-04-08 13:20:40 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
tempHead = currentHead;
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
}
|
2006-04-08 13:20:40 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (currentHead && currentHead->objIdx == param1 && currentHead->type == 20 && currentHead->x == param2)
|
2006-04-08 13:20:40 +00:00
|
|
|
return;
|
2008-04-07 20:24:40 +00:00
|
|
|
|
|
|
|
newElement = new overlayHeadElement;
|
|
|
|
|
|
|
|
newElement->next = tempHead->next;
|
|
|
|
tempHead->next = newElement;
|
|
|
|
|
|
|
|
newElement->objIdx = param1;
|
|
|
|
newElement->type = 20;
|
|
|
|
|
|
|
|
newElement->x = param2;
|
|
|
|
newElement->y = 0;
|
|
|
|
newElement->width = 0;
|
|
|
|
newElement->color = 0;
|
|
|
|
|
|
|
|
if (!currentHead)
|
|
|
|
currentHead = &overlayHead;
|
|
|
|
|
|
|
|
newElement->previous = currentHead->previous;
|
|
|
|
|
|
|
|
currentHead->previous = newElement;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*! \todo Check that it works
|
|
|
|
*/
|
|
|
|
void removeGfxElementA0(int16 idx, int16 param) {
|
|
|
|
overlayHeadElement *parent = &overlayHead;
|
|
|
|
overlayHeadElement *head = overlayHead.next;
|
|
|
|
overlayHeadElement *tmp;
|
|
|
|
|
|
|
|
while (head) {
|
|
|
|
if (head->objIdx == idx && head->x == param) {
|
|
|
|
parent->next = head->next;
|
|
|
|
tmp = head->next ? head->next : &overlayHead;
|
|
|
|
tmp->previous = parent;
|
|
|
|
delete head;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
parent = head;
|
|
|
|
head = head->next;
|
2006-04-08 13:20:40 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
}
|
2006-04-08 13:20:40 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
void removeSeq(uint16 param1, uint16 param2, uint16 param3) {
|
|
|
|
SeqListElement *currentHead = &seqList;
|
|
|
|
SeqListElement *tempHead = currentHead;
|
2006-04-08 13:20:40 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
while (currentHead && (currentHead->var6 != param1 || currentHead->var4 != param2 || currentHead->varE != param3)) {
|
|
|
|
tempHead = currentHead;
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
}
|
2006-04-08 13:20:40 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (currentHead && currentHead->var6 == param1 && currentHead->var4 == param2 && currentHead->varE == param3) {
|
|
|
|
currentHead->var4 = -1;
|
|
|
|
}
|
|
|
|
}
|
2006-04-08 13:20:40 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
uint16 isSeqRunning(uint16 param1, uint16 param2, uint16 param3) {
|
|
|
|
SeqListElement *currentHead = &seqList;
|
|
|
|
SeqListElement *tempHead = currentHead;
|
2006-04-08 13:20:40 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
while (currentHead && (currentHead->var6 != param1 || currentHead->var4 != param2 || currentHead->varE != param3)) {
|
|
|
|
tempHead = currentHead;
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (currentHead && currentHead->var6 == param1 && currentHead->var4 == param2 && currentHead->varE == param3) {
|
|
|
|
return 1;
|
|
|
|
}
|
2006-04-08 13:20:40 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void palRotate(byte a, byte b, byte c) {
|
|
|
|
if (c == 1) {
|
|
|
|
uint16 currentColor = c_palette[b];
|
|
|
|
|
|
|
|
for (int16 i = b; i > a; i--) {
|
|
|
|
c_palette[i] = c_palette[i - 1];
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
|
|
|
|
c_palette[a] = currentColor;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
void addScriptToList0(uint16 idx) {
|
|
|
|
ScriptPtr tmp(scriptInfo->create(*scriptTable[idx], idx));
|
|
|
|
assert(tmp);
|
|
|
|
globalScripts.push_back(tmp);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
int16 getZoneFromPosition(byte *page, int16 x, int16 y, int16 width) {
|
|
|
|
byte *ptr = page + (y * width) + x / 2;
|
|
|
|
byte zoneVar;
|
|
|
|
|
|
|
|
if (!(x % 2)) {
|
|
|
|
zoneVar = (*(ptr) >> 4) & 0xF;
|
|
|
|
} else {
|
|
|
|
zoneVar = (*(ptr)) & 0xF;
|
|
|
|
}
|
|
|
|
|
|
|
|
return zoneVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
int16 getZoneFromPositionRaw(byte *page, int16 x, int16 y, int16 width) {
|
|
|
|
byte *ptr = page + (y * width) + x;
|
|
|
|
byte zoneVar;
|
|
|
|
|
|
|
|
zoneVar = (*(ptr)) & 0xF;
|
|
|
|
|
|
|
|
return zoneVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
int16 checkCollision(int16 objIdx, int16 x, int16 y, int16 numZones, int16 zoneIdx) {
|
|
|
|
int16 lx = objectTable[objIdx].x + x;
|
|
|
|
int16 ly = objectTable[objIdx].y + y;
|
|
|
|
int16 idx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
for (int16 i = 0; i < numZones; i++) {
|
|
|
|
idx = getZoneFromPositionRaw(page3Raw, lx + i, ly, 320);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
assert(idx >= 0 && idx <= NUM_MAX_ZONE);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (zoneData[idx] == zoneIdx) {
|
|
|
|
return 1;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
|
|
|
|
return 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
uint16 compareVars(int16 a, int16 b) {
|
|
|
|
uint16 flag = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
if (a == b) {
|
|
|
|
flag |= kCmpEQ;
|
|
|
|
} else if (a > b) {
|
|
|
|
flag |= kCmpGT;
|
|
|
|
} else if (a < b) {
|
|
|
|
flag |= kCmpLT;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
return flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
void executeList1(void) {
|
|
|
|
ScriptList::iterator it = objectScripts.begin();
|
|
|
|
for (; it != objectScripts.end();) {
|
|
|
|
if ((*it)->_index < 0 || (*it)->execute() < 0) {
|
|
|
|
it = objectScripts.erase(it);
|
|
|
|
} else {
|
|
|
|
++it;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
void executeList0(void) {
|
|
|
|
ScriptList::iterator it = globalScripts.begin();
|
|
|
|
for (; it != globalScripts.end();) {
|
|
|
|
if ((*it)->_index < 0 || (*it)->execute() < 0) {
|
|
|
|
it = globalScripts.erase(it);
|
|
|
|
} else {
|
|
|
|
++it;
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-07 20:24:40 +00:00
|
|
|
/*! \todo objectScripts.clear()?
|
|
|
|
*/
|
2006-02-22 22:40:53 +00:00
|
|
|
void purgeList1(void) {
|
|
|
|
}
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
void purgeList0(void) {
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////
|
|
|
|
// SCRIPT DECOMPILER
|
|
|
|
|
|
|
|
#ifdef DUMP_SCRIPTS
|
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
char decompileBuffer[10000][1000];
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 decompileBufferPosition = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
char bufferDec[256];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
char compareString1[256];
|
|
|
|
char compareString2[256];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
const char *getObjPramName(byte paramIdx) {
|
2006-02-22 22:40:53 +00:00
|
|
|
switch (paramIdx) {
|
|
|
|
case 1:
|
2006-04-08 08:04:23 +00:00
|
|
|
return ".X";
|
2006-02-22 22:40:53 +00:00
|
|
|
case 2:
|
2006-04-08 08:04:23 +00:00
|
|
|
return ".Y";
|
2006-02-22 22:40:53 +00:00
|
|
|
case 3:
|
2006-04-08 08:04:23 +00:00
|
|
|
return ".mask";
|
2006-02-22 22:40:53 +00:00
|
|
|
case 4:
|
2006-04-08 08:04:23 +00:00
|
|
|
return ".frame";
|
2006-02-22 22:40:53 +00:00
|
|
|
case 5:
|
2006-04-08 08:04:23 +00:00
|
|
|
return ".status";
|
2006-02-22 22:40:53 +00:00
|
|
|
case 6:
|
2006-04-08 08:04:23 +00:00
|
|
|
return ".costume";
|
2006-02-22 22:40:53 +00:00
|
|
|
default:
|
2006-04-08 08:04:23 +00:00
|
|
|
sprintf(bufferDec, ".param%d", paramIdx);
|
|
|
|
return bufferDec;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-23 03:45:52 +00:00
|
|
|
void decompileScript(byte *scriptPtr, int16 *stackPtr, uint16 scriptSize, uint16 scriptIdx) {
|
2006-04-12 03:45:54 +00:00
|
|
|
char lineBuffer[256];
|
2006-03-23 03:45:52 +00:00
|
|
|
byte *localScriptPtr = scriptPtr;
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 exitScript;
|
|
|
|
uint32 position = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
assert(scriptPtr);
|
|
|
|
// assert(stackPtr);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
exitScript = 0;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(decompileBuffer[decompileBufferPosition++], "--------- SCRIPT %d ---------\n", scriptIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
do {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 opcode = *(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position++;
|
|
|
|
|
|
|
|
if (position == scriptSize) {
|
|
|
|
opcode = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
strcpy(lineBuffer, "");
|
|
|
|
|
|
|
|
switch (opcode - 1) {
|
|
|
|
case -1:
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x0:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "obj[%d]%s = %d\n", param1, getObjPramName(param2), param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
|
|
|
byte param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]=obj[%d]%s\n", param3, param1, getObjPramName(param2));
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x2:
|
|
|
|
case 0x3:
|
|
|
|
case 0x4:
|
|
|
|
case 0x5:
|
|
|
|
case 0x6:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2007-12-14 13:51:41 +00:00
|
|
|
if (opcode - 1 == 0x2) {
|
|
|
|
sprintf(lineBuffer, "obj[%d]%s+=%d\n", param1, getObjPramName(param2), param3);
|
|
|
|
} else if (opcode - 1 == 0x3) {
|
|
|
|
sprintf(lineBuffer, "obj[%d]%s-=%d\n", param1, getObjPramName(param2), param3);
|
|
|
|
} else if (opcode - 1 == 0x4) {
|
|
|
|
sprintf(lineBuffer, "obj[%d]%s+=obj[%d]%s\n", param1, getObjPramName(param2), param3, getObjPramName(param2));
|
|
|
|
} else if (opcode - 1 == 0x5) {
|
|
|
|
sprintf(lineBuffer, "obj[%d]%s-=obj[%d]%s\n", param1, getObjPramName(param2), param3, getObjPramName(param2));
|
|
|
|
} else if (opcode - 1 == 0x6) {
|
|
|
|
sprintf(compareString1, "obj[%d]%s", param1, getObjPramName(param2));
|
|
|
|
sprintf(compareString2, "%d", param3);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x7:
|
|
|
|
case 0x8:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param2;
|
|
|
|
int16 param3;
|
|
|
|
int16 param4;
|
|
|
|
int16 param5;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param2 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param4 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param5 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2007-12-14 13:51:41 +00:00
|
|
|
if (opcode - 1 == 0x7) {
|
|
|
|
sprintf(lineBuffer, "setupObject(Idx:%d,X:%d,Y:%d,mask:%d,frame:%d)\n", param1, param2, param3, param4, param5);
|
|
|
|
} else if (opcode - 1 == 0x8) {
|
|
|
|
sprintf(lineBuffer, "checkCollision(%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x9:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2 == 1) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]=var[%d]\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else if (param2 == 2) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]=globalVar[%d]\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else if (param2 == 3) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]=mouse.X\n", param1);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else if (param2 == 4) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]=mouse.Y\n", param1);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else if (param2 == 5) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]=rand() mod %d\n", param1, param3);
|
2006-11-23 06:52:03 +00:00
|
|
|
} else if (param2 == 8) {
|
|
|
|
sprintf(lineBuffer, "var[%d]=file[%d].packedSize\n", param1, param3);
|
|
|
|
} else if (param2 == 9) {
|
|
|
|
sprintf(lineBuffer, "var[%d]=file[%d].unpackedSize\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-04-05 13:06:03 +00:00
|
|
|
error("decompileScript: 0x09: param2 = %d", param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "var[%d]=%d\n", param1, param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xA:
|
|
|
|
case 0xB:
|
|
|
|
case 0xC:
|
|
|
|
case 0xD:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2007-12-14 13:51:41 +00:00
|
|
|
if (opcode - 1 == 0xA) {
|
|
|
|
sprintf(lineBuffer, "var[%d]+=var[%d]\n", param1, param3);
|
|
|
|
} else if (opcode - 1 == 0xB) {
|
|
|
|
sprintf(lineBuffer, "var[%d]-=var[%d]\n", param1, param3);
|
|
|
|
} else if (opcode - 1 == 0xC) {
|
|
|
|
sprintf(lineBuffer, "var[%d]*=var[%d]\n", param1, param3);
|
|
|
|
} else if (opcode - 1 == 0xD) {
|
|
|
|
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
|
|
|
|
2007-12-14 13:51:41 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2007-12-14 13:51:41 +00:00
|
|
|
if (opcode - 1 == 0xA) {
|
|
|
|
sprintf(lineBuffer, "var[%d]+=%d\n", param1, param3);
|
|
|
|
} else if (opcode - 1 == 0xB) {
|
|
|
|
sprintf(lineBuffer, "var[%d]-=%d\n", param1, param3);
|
|
|
|
} else if (opcode - 1 == 0xC) {
|
|
|
|
sprintf(lineBuffer, "var[%d]*=%d\n", param1, param3);
|
|
|
|
} else if (opcode - 1 == 0xD) {
|
|
|
|
sprintf(lineBuffer, "var[%d]/=%d\n", param1, param3);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xE:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2 == 1) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(compareString1, "var[%d]", param1);
|
|
|
|
sprintf(compareString2, "var[%d]", param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
} else if (param2 == 2) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(compareString1, "var[%d]", param1);
|
|
|
|
sprintf(compareString2, "globalVar[%d]", param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-04-05 13:06:03 +00:00
|
|
|
error("decompileScript: 0x0E: param2 = %d", param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(compareString1, "var[%d]", param1);
|
2006-02-22 22:40:53 +00:00
|
|
|
sprintf(compareString2, "%d", param3);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xF:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
|
|
|
byte param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "obj[%d]%s=var[%d]\n", param1, getObjPramName(param2), param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x13:
|
|
|
|
case 0x14:
|
|
|
|
case 0x15:
|
|
|
|
case 0x16:
|
|
|
|
case 0x17:
|
|
|
|
case 0x18:
|
|
|
|
case 0x19:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2007-12-14 13:51:41 +00:00
|
|
|
if (opcode - 1 == 0x13) {
|
|
|
|
sprintf(lineBuffer, "loadMask0(%d)\n", param);
|
|
|
|
} else if (opcode - 1 == 0x14) {
|
|
|
|
sprintf(lineBuffer, "unloadMask0(%d)\n", param);
|
|
|
|
} else if (opcode - 1 == 0x15) {
|
|
|
|
sprintf(lineBuffer, "OP_15(%d)\n", param);
|
|
|
|
} else if (opcode - 1 == 0x16) {
|
|
|
|
sprintf(lineBuffer, "loadMask1(%d)\n", param);
|
|
|
|
} else if (opcode - 1 == 0x17) {
|
|
|
|
sprintf(lineBuffer, "unloadMask0(%d)\n", param);
|
|
|
|
} else if (opcode - 1 == 0x18) {
|
|
|
|
sprintf(lineBuffer, "loadMask4(%d)\n", param);
|
|
|
|
} else if (opcode - 1 == 0x19) {
|
|
|
|
sprintf(lineBuffer, "unloadMask4(%d)\n", param);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1A:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "OP_1A(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1B:
|
|
|
|
{
|
2008-04-07 20:24:40 +00:00
|
|
|
sprintf(lineBuffer, "bgIncrustList.clear()\n");
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1D:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "label(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x1E:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "goto(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2007-12-14 13:51:41 +00:00
|
|
|
// If cases
|
2006-02-22 22:40:53 +00:00
|
|
|
case 0x1F:
|
|
|
|
case 0x20:
|
|
|
|
case 0x21:
|
|
|
|
case 0x22:
|
|
|
|
case 0x23:
|
|
|
|
case 0x24:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2007-12-14 13:51:41 +00:00
|
|
|
if (opcode - 1 == 0x1F) {
|
|
|
|
sprintf(lineBuffer, "if(%s>%s) goto(%d)\n", compareString1, compareString2, param);
|
|
|
|
} else if (opcode - 1 == 0x20) {
|
|
|
|
sprintf(lineBuffer, "if(%s>=%s) goto(%d)\n", compareString1, compareString2, param);
|
|
|
|
} else if (opcode - 1 == 0x21) {
|
|
|
|
sprintf(lineBuffer, "if(%s<%s) goto(%d)\n", compareString1, compareString2, param);
|
|
|
|
} else if (opcode - 1 == 0x22) {
|
|
|
|
sprintf(lineBuffer, "if(%s<=%s) goto(%d)\n", compareString1, compareString2, param);
|
|
|
|
} else if (opcode - 1 == 0x23) {
|
|
|
|
sprintf(lineBuffer, "if(%s==%s) goto(%d)\n", compareString1, compareString2, param);
|
|
|
|
} else if (opcode - 1 == 0x24) {
|
|
|
|
sprintf(lineBuffer, "if(%s!=%s) goto(%d)\n", compareString1, compareString2, param);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x25:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "removeLabel(%d)\n", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x26:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "loop(--var[%d]) -> label(%d)\n", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x31:
|
|
|
|
case 0x32:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2007-12-14 13:51:41 +00:00
|
|
|
if (opcode - 1 == 0x31) {
|
|
|
|
sprintf(lineBuffer, "startGlobalScript(%d)\n", param);
|
|
|
|
} else if (opcode - 1 == 0x32) {
|
|
|
|
sprintf(lineBuffer, "endGlobalScript(%d)\n", param);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x3B:
|
|
|
|
case 0x3C:
|
|
|
|
case 0x3D:
|
|
|
|
case OP_loadPart:
|
|
|
|
{
|
2007-12-14 13:51:41 +00:00
|
|
|
if (opcode - 1 == 0x3B) {
|
|
|
|
sprintf(lineBuffer, "loadResource(%s)\n", localScriptPtr + position);
|
|
|
|
} else if (opcode - 1 == 0x3C) {
|
|
|
|
sprintf(lineBuffer, "loadBg(%s)\n", localScriptPtr + position);
|
|
|
|
} else if (opcode - 1 == 0x3D) {
|
|
|
|
sprintf(lineBuffer, "loadCt(%s)\n", localScriptPtr + position);
|
|
|
|
} else if (opcode - 1 == OP_loadPart) {
|
|
|
|
sprintf(lineBuffer, "loadPart(%s)\n", localScriptPtr + position);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
position += strlen((char *)localScriptPtr + position) + 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x40:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "closePart()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case OP_loadNewPrcName:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "loadPrc(%d,%s)\n", param, localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
position += strlen((char *)localScriptPtr + position) + 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case OP_requestCheckPendingDataLoad: // nop
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "requestCheckPendingDataLoad()\n");
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x45:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "blitAndFade()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x46:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "fadeToBlack()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x47:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
|
|
|
int16 param4;
|
|
|
|
int16 param5;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
param4 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param5 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "transformPaletteRange(%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x49:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "setDefaultMenuColor2(%d)\n", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x4F:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "break()\n");
|
|
|
|
exitScript = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x50:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "endScript()\n\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x51:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param2;
|
|
|
|
int16 param3;
|
|
|
|
int16 param4;
|
|
|
|
int16 param5;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param2 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param4 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param5 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "message(%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x52:
|
2007-12-14 13:51:41 +00:00
|
|
|
case 0x53:
|
2006-02-22 22:40:53 +00:00
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2) {
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param2 == 1) {
|
2007-12-14 13:51:41 +00:00
|
|
|
if (opcode - 1 == 0x52) {
|
|
|
|
sprintf(lineBuffer, "globalVar[%d] = var[%d]\n", param1, param3);
|
|
|
|
} else if (opcode - 1 == 0x53) {
|
|
|
|
sprintf(compareString1, "globalVar[%d]", param1);
|
|
|
|
sprintf(compareString2, "var[%d]", param3);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
} else if (param2 == 2) {
|
2007-12-14 13:51:41 +00:00
|
|
|
if (opcode - 1 == 0x52) {
|
|
|
|
sprintf(lineBuffer, "globalVar[%d] = globalVar[%d]\n", param1, param3);
|
|
|
|
} else if (opcode - 1 == 0x53) {
|
|
|
|
sprintf(compareString1, "globalVar[%d]", param1);
|
|
|
|
sprintf(compareString2, "globalVar[%d]", param3);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2007-12-14 13:51:41 +00:00
|
|
|
if (opcode - 1 == 0x52) {
|
|
|
|
error("decompileScript: 0x52: param2 = %d", param2);
|
|
|
|
} else if (opcode - 1 == 0x53) {
|
|
|
|
error("decompileScript: 0x53: param2 = %d", param2);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2007-12-14 13:51:41 +00:00
|
|
|
if (opcode - 1 == 0x52) {
|
|
|
|
sprintf(lineBuffer, "globalVar[%d] = %d\n", param1, param3);
|
|
|
|
} else if (opcode - 1 == 0x53) {
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(compareString1, "globalVar[%d]", param1);
|
2007-12-14 13:51:41 +00:00
|
|
|
sprintf(compareString2, "%d", param3);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x59:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "comment: %s\n", localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
position += strlen((char *)localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x5A:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "freePartRang(%d,%d)\n", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x5B:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "unloadAllMasks()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x65:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "setupTableUnk1()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x66:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param2 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "tableUnk1[%d] = %d\n", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x68:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "setDefaultMenuBoxColor(%d)\n", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x69:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "allowPlayerInput()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x6A:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "disallowPlayerInput()\n");
|
|
|
|
break;
|
|
|
|
}
|
2008-04-07 20:24:40 +00:00
|
|
|
case 0x6B:
|
2006-02-22 22:40:53 +00:00
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte newDisk;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
newDisk = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "changeDataDisk(%d)\n", newDisk);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x6D:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "loadDat(%s)\n", localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
position += strlen((char *)localScriptPtr + position) + 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x6E: // nop
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "updateDat()\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x6F:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_6F() -> dat related\n");
|
2006-02-22 22:40:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x70:
|
|
|
|
{
|
|
|
|
sprintf(lineBuffer, "stopSample()\n");
|
|
|
|
break;
|
|
|
|
}
|
2007-12-14 19:21:19 +00:00
|
|
|
case 0x79:
|
2006-02-22 22:40:53 +00:00
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-11-24 20:25:55 +00:00
|
|
|
sprintf(lineBuffer, "disableSystemMenu(%d)\n", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x77:
|
|
|
|
case 0x78:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param3;
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param4;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param5;
|
|
|
|
int16 param6;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
|
|
|
param4 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param5 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param6 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2007-12-14 13:51:41 +00:00
|
|
|
if (opcode - 1 == 0x77) {
|
|
|
|
sprintf(lineBuffer, "playSample(%d,%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5, param6);
|
2008-04-07 20:24:40 +00:00
|
|
|
} else if (opcode - 1 == 0x78) {
|
2007-12-14 13:51:41 +00:00
|
|
|
sprintf(lineBuffer, "OP_78(%d,%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5, param6);
|
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x7A:
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "OP_7A(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x7B: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "OP_7B(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x7F: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
|
|
|
byte param3;
|
|
|
|
byte param4;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param5;
|
|
|
|
int16 param6;
|
|
|
|
int16 param7;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param3 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param4 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param5 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param6 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param7 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
sprintf(lineBuffer, "OP_7F(%d,%d,%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5, param6, param7);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x80: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_80(%d,%d)\n", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x82: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 param3;
|
|
|
|
uint16 param4;
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param5;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param4 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
|
|
|
param5 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_82(%d,%d,%d,%d,%d)\n", param1, param2, param3, param4, param5);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x83: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_83(%d,%d)\n", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x89: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "if(%s!=%s) goto next label(%d)\n", compareString1, compareString2, param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8B: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "OP_8B(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8C: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "OP_8C(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8D: // OS only
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param1;
|
|
|
|
int16 param2;
|
|
|
|
int16 param3;
|
|
|
|
int16 param4;
|
|
|
|
int16 param5;
|
|
|
|
int16 param6;
|
|
|
|
int16 param7;
|
|
|
|
int16 param8;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param1 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param2 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param3 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param4 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param5 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param6 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param7 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param8 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
|
|
|
sprintf(compareString1, "obj[%d]", param1);
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(compareString2, "{%d,%d,%d,%d,%d,%d,%d}", param2, param3, param4, param5, param6, param7, param8);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8E: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "ADDBG(%d,%s)\n", param1, localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
position += strlen((char *)localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8F: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "OP_8F(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x90: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "loadABS(%d,%s)\n", param1, localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
position += strlen((char *)localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x91: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
sprintf(lineBuffer, "OP_91(%d)\n", param);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x9D: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_9D(%d) -> flip img idx\n", param);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x9E: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
if (param) {
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_9E(%d,%d)\n", param, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 18:16:40 +00:00
|
|
|
param2 = READ_BE_UINT16(localScriptPtr + position);
|
2006-02-22 22:40:53 +00:00
|
|
|
position += 2;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_9E(%d,%d)\n", param, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xA0: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_A0(%d,%d)\n", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xA1: // OS only
|
|
|
|
{
|
2006-03-23 03:45:52 +00:00
|
|
|
byte param1;
|
|
|
|
byte param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
param1 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
|
|
|
param2 = *(localScriptPtr + position);
|
|
|
|
position++;
|
|
|
|
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "OP_A1(%d,%d)\n", param1, param2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
2006-02-23 19:28:36 +00:00
|
|
|
sprintf(lineBuffer, "Unsupported opcode %X in decompileScript\n\n", opcode - 1);
|
2006-02-22 22:40:53 +00:00
|
|
|
position = scriptSize;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// printf(lineBuffer);
|
|
|
|
strcpy(decompileBuffer[decompileBufferPosition++], lineBuffer);
|
|
|
|
|
|
|
|
exitScript = 0;
|
|
|
|
if (position >= scriptSize) {
|
|
|
|
exitScript = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
} while (!exitScript);
|
|
|
|
}
|
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
void dumpScript(char *dumpName) {
|
|
|
|
Common::File fHandle;
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
fHandle.open(dumpName, Common::File::kFileWriteMode);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
for (i = 0; i < decompileBufferPosition; i++) {
|
2006-04-12 03:45:54 +00:00
|
|
|
fHandle.writeString(Common::String(decompileBuffer[i]));
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2006-04-12 03:45:54 +00:00
|
|
|
fHandle.close();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
decompileBufferPosition = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2006-02-25 00:26:14 +00:00
|
|
|
|
|
|
|
} // End of namespace Cine
|