2001-10-16 10:01:48 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
2002-03-20 17:51:07 +00:00
|
|
|
* Copyright (C) 2001/2002 The ScummVM project
|
2001-10-16 10:01:48 +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
2001-11-06 20:00:47 +00:00
|
|
|
* $Header$
|
2001-10-16 10:01:48 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "scumm.h"
|
2002-05-14 23:32:34 +00:00
|
|
|
#include "actor.h"
|
2002-11-29 15:13:49 +00:00
|
|
|
#include "verbs.h"
|
2002-08-24 15:31:37 +00:00
|
|
|
#include "smush/player.h"
|
|
|
|
#include "smush/scumm_renderer.h"
|
2002-04-23 18:11:36 +00:00
|
|
|
|
2002-04-21 21:33:47 +00:00
|
|
|
#include "sound/mididrv.h"
|
2002-08-29 23:45:15 +00:00
|
|
|
#include "scumm/sound.h"
|
2002-08-21 16:07:07 +00:00
|
|
|
#include "scumm/imuse.h"
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-11-02 11:51:44 +00:00
|
|
|
#include "dialogs.h" // FIXME: This is just for the FT-INSANE warning.
|
|
|
|
// Remove when INSANE is implemented
|
2002-11-06 16:44:57 +00:00
|
|
|
|
|
|
|
#define OPCODE(x) { &Scumm::x, #x }
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::setupOpcodes2()
|
|
|
|
{
|
2002-11-06 16:44:57 +00:00
|
|
|
static const OpcodeEntry opcodes[256] = {
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 00 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_pushByte),
|
|
|
|
OPCODE(o6_pushWord),
|
|
|
|
OPCODE(o6_pushByteVar),
|
|
|
|
OPCODE(o6_pushWordVar),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 04 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_byteArrayRead),
|
|
|
|
OPCODE(o6_wordArrayRead),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 08 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_byteArrayIndexedRead),
|
|
|
|
OPCODE(o6_wordArrayIndexedRead),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 0C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_dup),
|
|
|
|
OPCODE(o6_zero),
|
|
|
|
OPCODE(o6_eq),
|
|
|
|
OPCODE(o6_neq),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 10 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_gt),
|
|
|
|
OPCODE(o6_lt),
|
|
|
|
OPCODE(o6_le),
|
|
|
|
OPCODE(o6_ge),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 14 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_add),
|
|
|
|
OPCODE(o6_sub),
|
|
|
|
OPCODE(o6_mul),
|
|
|
|
OPCODE(o6_div),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 18 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_land),
|
|
|
|
OPCODE(o6_lor),
|
|
|
|
OPCODE(o6_kill),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 1C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 20 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 24 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 28 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 2C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 30 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 34 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 38 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 3C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 40 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_writeByteVar),
|
|
|
|
OPCODE(o6_writeWordVar),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 44 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_byteArrayWrite),
|
|
|
|
OPCODE(o6_wordArrayWrite),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 48 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_byteArrayIndexedWrite),
|
|
|
|
OPCODE(o6_wordArrayIndexedWrite),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 4C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_byteVarInc),
|
|
|
|
OPCODE(o6_wordVarInc),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 50 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_byteArrayInc),
|
|
|
|
OPCODE(o6_wordArrayInc),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 54 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_byteVarDec),
|
|
|
|
OPCODE(o6_wordVarDec),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 58 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_byteArrayDec),
|
|
|
|
OPCODE(o6_wordArrayDec),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 5C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_jumpTrue),
|
|
|
|
OPCODE(o6_jumpFalse),
|
|
|
|
OPCODE(o6_startScriptEx),
|
|
|
|
OPCODE(o6_startScript),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 60 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_startObject),
|
|
|
|
OPCODE(o6_setObjectState),
|
|
|
|
OPCODE(o6_setObjectXY),
|
|
|
|
OPCODE(o6_drawBlastObject),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 64 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_setBlastObjectWindow),
|
|
|
|
OPCODE(o6_stopObjectCode),
|
|
|
|
OPCODE(o6_stopObjectCode),
|
|
|
|
OPCODE(o6_endCutscene),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 68 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_cutScene),
|
|
|
|
OPCODE(o6_stopMusic),
|
|
|
|
OPCODE(o6_freezeUnfreeze),
|
|
|
|
OPCODE(o6_cursorCommand),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 6C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_breakHere),
|
|
|
|
OPCODE(o6_ifClassOfIs),
|
|
|
|
OPCODE(o6_setClass),
|
|
|
|
OPCODE(o6_getState),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 70 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_setState),
|
|
|
|
OPCODE(o6_setOwner),
|
|
|
|
OPCODE(o6_getOwner),
|
|
|
|
OPCODE(o6_jump),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 74 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_startSound),
|
|
|
|
OPCODE(o6_stopSound),
|
|
|
|
OPCODE(o6_startMusic),
|
|
|
|
OPCODE(o6_stopObjectScript),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 78 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_panCameraTo),
|
|
|
|
OPCODE(o6_actorFollowCamera),
|
|
|
|
OPCODE(o6_setCameraAt),
|
|
|
|
OPCODE(o6_loadRoom),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 7C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_stopScript),
|
|
|
|
OPCODE(o6_walkActorToObj),
|
|
|
|
OPCODE(o6_walkActorTo),
|
|
|
|
OPCODE(o6_putActorInRoom),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 80 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_putActorAtObject),
|
|
|
|
OPCODE(o6_faceActor),
|
|
|
|
OPCODE(o6_animateActor),
|
|
|
|
OPCODE(o6_doSentence),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 84 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_pickupObject),
|
|
|
|
OPCODE(o6_loadRoomWithEgo),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_getRandomNumber),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 88 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_getRandomNumberRange),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_getActorMoving),
|
|
|
|
OPCODE(o6_getScriptRunning),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 8C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_getActorRoom),
|
|
|
|
OPCODE(o6_getObjectX),
|
|
|
|
OPCODE(o6_getObjectY),
|
|
|
|
OPCODE(o6_getObjectOldDir),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 90 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_getActorWalkBox),
|
|
|
|
OPCODE(o6_getActorCostume),
|
|
|
|
OPCODE(o6_findInventory),
|
|
|
|
OPCODE(o6_getInventoryCount),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 94 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_getVerbFromXY),
|
|
|
|
OPCODE(o6_beginOverride),
|
|
|
|
OPCODE(o6_endOverride),
|
|
|
|
OPCODE(o6_setObjectName),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 98 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_isSoundRunning),
|
|
|
|
OPCODE(o6_setBoxFlags),
|
|
|
|
OPCODE(o6_createBoxMatrix),
|
|
|
|
OPCODE(o6_resourceRoutines),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 9C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_roomOps),
|
|
|
|
OPCODE(o6_actorSet),
|
|
|
|
OPCODE(o6_verbOps),
|
|
|
|
OPCODE(o6_getActorFromXY),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* A0 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_findObject),
|
|
|
|
OPCODE(o6_pseudoRoom),
|
|
|
|
OPCODE(o6_getActorElevation),
|
|
|
|
OPCODE(o6_getVerbEntrypoint),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* A4 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_arrayOps),
|
|
|
|
OPCODE(o6_saveRestoreVerbs),
|
|
|
|
OPCODE(o6_drawBox),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* A8 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_getActorWidth),
|
|
|
|
OPCODE(o6_wait),
|
|
|
|
OPCODE(o6_getActorScaleX),
|
|
|
|
OPCODE(o6_getActorAnimCounter1),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* AC */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_soundKludge),
|
|
|
|
OPCODE(o6_isAnyOf),
|
|
|
|
OPCODE(o6_quitPauseRestart),
|
|
|
|
OPCODE(o6_isActorInBox),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* B0 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_delay),
|
|
|
|
OPCODE(o6_delayLonger),
|
|
|
|
OPCODE(o6_delayVeryLong),
|
|
|
|
OPCODE(o6_stopSentence),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* B4 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_print_0),
|
|
|
|
OPCODE(o6_print_1),
|
|
|
|
OPCODE(o6_print_2),
|
|
|
|
OPCODE(o6_print_3),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* B8 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_printActor),
|
|
|
|
OPCODE(o6_printEgo),
|
|
|
|
OPCODE(o6_talkActor),
|
|
|
|
OPCODE(o6_talkEgo),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* BC */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_dim),
|
|
|
|
OPCODE(o5_dummy),
|
|
|
|
OPCODE(o6_runVerbCodeQuick),
|
|
|
|
OPCODE(o6_runScriptQuick),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* C0 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_dim2),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* C4 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_abs),
|
|
|
|
OPCODE(o6_distObjectObject),
|
|
|
|
OPCODE(o6_distObjectPt),
|
|
|
|
OPCODE(o6_distPtPt),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* C8 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_kernelFunction),
|
|
|
|
OPCODE(o6_miscOps),
|
|
|
|
OPCODE(o6_delayFrames),
|
|
|
|
OPCODE(o6_pickOneOf),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* CC */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_pickOneOfDefault),
|
|
|
|
OPCODE(o6_unknownCD),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* D0 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_getAnimateVariable),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* D4 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_jumpToScript),
|
|
|
|
OPCODE(o6_band),
|
|
|
|
OPCODE(o6_bor),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* D8 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_isRoomScriptRunning),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* DC */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* E0 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* E4 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* E8 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* EC */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_getActorPriority),
|
|
|
|
OPCODE(o6_getObjectNewDir),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* F0 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* F4 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* F8 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* FC */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-03-05 09:58:12 +00:00
|
|
|
};
|
|
|
|
|
2002-11-06 16:44:57 +00:00
|
|
|
_opcodes = opcodes;
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
2002-04-21 21:20:32 +00:00
|
|
|
void Scumm::o6_setBlastObjectWindow()
|
2002-04-11 17:19:16 +00:00
|
|
|
{ // Set BOMP processing window
|
2002-03-07 04:29:24 +00:00
|
|
|
int a, b, c, d;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-03-07 04:29:24 +00:00
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
|
|
|
|
warning("o6_bompWindow(%d, %d, %d, %d)", a, b, c, d);
|
2002-03-07 04:29:24 +00:00
|
|
|
// sub_274EF(a, b, c, d);
|
|
|
|
}
|
2002-03-07 05:41:53 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
int Scumm::popRoomAndObj(int *room)
|
|
|
|
{
|
2001-12-27 17:51:58 +00:00
|
|
|
int obj;
|
|
|
|
|
|
|
|
if (_features & GF_HAS_ROOMTABLE) {
|
|
|
|
obj = pop();
|
|
|
|
*room = getObjectRoom(obj);
|
|
|
|
} else {
|
|
|
|
*room = pop();
|
|
|
|
obj = pop();
|
|
|
|
}
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
int Scumm::readArray(int array, int idx, int base)
|
|
|
|
{
|
2002-07-07 13:14:34 +00:00
|
|
|
ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(array));
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
if (ah == NULL) {
|
|
|
|
error("readArray: invalid array %d (%d)", array, readVar(array));
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
base += idx * ah->dim1_size;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-11-30 23:16:19 +00:00
|
|
|
// FIXME: comment this for the time being as it was causing ft to crash
|
|
|
|
// in the minefeild
|
|
|
|
// assert(base >= 0 && base < ah->dim1_size * ah->dim2_size);
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
if (ah->type == 4) {
|
2001-10-16 10:01:48 +00:00
|
|
|
return ah->data[base];
|
|
|
|
} else {
|
2002-07-07 13:14:34 +00:00
|
|
|
return (int16)READ_LE_UINT16(ah->data + base * 2);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::writeArray(int array, int idx, int base, int value)
|
|
|
|
{
|
2002-07-07 13:14:34 +00:00
|
|
|
ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(array));
|
2002-10-18 09:58:16 +00:00
|
|
|
if (!ah)
|
|
|
|
return;
|
2002-04-11 17:19:16 +00:00
|
|
|
base += idx * ah->dim1_size;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
assert(base >= 0 && base < ah->dim1_size * ah->dim2_size);
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
if (ah->type == 4) {
|
2001-10-16 10:01:48 +00:00
|
|
|
ah->data[base] = value;
|
|
|
|
} else {
|
2002-04-11 17:19:16 +00:00
|
|
|
((uint16 *)ah->data)[base] = TO_LE_16(value);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-07 13:14:34 +00:00
|
|
|
int Scumm::getStackList(int16 *args, uint maxnum)
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
uint num, i;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
for (i = 0; i < maxnum; i++)
|
2001-10-16 10:01:48 +00:00
|
|
|
args[i] = 0;
|
|
|
|
|
|
|
|
num = pop();
|
|
|
|
|
|
|
|
if (num > maxnum)
|
|
|
|
error("Too many items %d in stack list, max %d", num, maxnum);
|
|
|
|
|
|
|
|
i = num;
|
2002-04-11 17:19:16 +00:00
|
|
|
while (((int)--i) >= 0) {
|
2001-10-16 10:01:48 +00:00
|
|
|
args[i] = pop();
|
|
|
|
}
|
|
|
|
|
|
|
|
return num;
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_pushByte()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
push(fetchScriptByte());
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_pushWord()
|
|
|
|
{
|
2002-07-07 13:14:34 +00:00
|
|
|
push((int16)fetchScriptWord());
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_pushByteVar()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
push(readVar(fetchScriptByte()));
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_pushWordVar()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
push(readVar(fetchScriptWord()));
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_invalid()
|
|
|
|
{
|
2002-07-07 13:14:34 +00:00
|
|
|
error("Invalid opcode '%x' at %x", _opcode, _scriptPointer - _scriptOrgPointer);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_byteArrayRead()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int base = pop();
|
|
|
|
push(readArray(fetchScriptByte(), 0, base));
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_wordArrayRead()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int base = pop();
|
|
|
|
push(readArray(fetchScriptWord(), 0, base));
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_byteArrayIndexedRead()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int base = pop();
|
2002-03-08 08:42:11 +00:00
|
|
|
int idx = pop();
|
|
|
|
push(readArray(fetchScriptByte(), idx, base));
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_wordArrayIndexedRead()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int base = pop();
|
2002-03-08 08:42:11 +00:00
|
|
|
int idx = pop();
|
|
|
|
push(readArray(fetchScriptWord(), idx, base));
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_dup()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
|
|
|
push(a);
|
|
|
|
push(a);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_zero()
|
|
|
|
{
|
|
|
|
push(pop() == 0);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_eq()
|
|
|
|
{
|
|
|
|
push(pop() == pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_neq()
|
|
|
|
{
|
|
|
|
push(pop() != pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_gt()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() > a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_lt()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() < a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_le()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() <= a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_ge()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() >= a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_add()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() + a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_sub()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() - a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_mul()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() * a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_div()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
if (a == 0)
|
|
|
|
error("division by zero");
|
|
|
|
push(pop() / a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-11-02 08:18:21 +00:00
|
|
|
void Scumm::o6_land() // Logical And
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() && a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-11-02 08:18:21 +00:00
|
|
|
void Scumm::o6_lor() // Logical Or
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() || a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-11-02 08:18:21 +00:00
|
|
|
void Scumm::o6_bor() // Bitwise Or
|
|
|
|
{
|
|
|
|
int a = pop();
|
|
|
|
push(pop() | a);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm::o6_band() // Bitwise And
|
|
|
|
{
|
|
|
|
int a = pop();
|
|
|
|
push(pop() | a);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_kill()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
pop();
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_writeByteVar()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
writeVar(fetchScriptByte(), pop());
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_writeWordVar()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
writeVar(fetchScriptWord(), pop());
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_byteArrayWrite()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
|
|
|
writeArray(fetchScriptByte(), 0, pop(), a);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_wordArrayWrite()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
|
|
|
writeArray(fetchScriptWord(), 0, pop(), a);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_byteArrayIndexedWrite()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int val = pop();
|
|
|
|
int base = pop();
|
|
|
|
writeArray(fetchScriptByte(), pop(), base, val);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_wordArrayIndexedWrite()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int val = pop();
|
|
|
|
int base = pop();
|
|
|
|
writeArray(fetchScriptWord(), pop(), base, val);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_byteVarInc()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int var = fetchScriptByte();
|
2002-04-11 17:19:16 +00:00
|
|
|
writeVar(var, readVar(var) + 1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_wordVarInc()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int var = fetchScriptWord();
|
2002-04-11 17:19:16 +00:00
|
|
|
writeVar(var, readVar(var) + 1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_byteArrayInc()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int var = fetchScriptByte();
|
|
|
|
int base = pop();
|
|
|
|
writeArray(var, 0, base, readArray(var, 0, base) + 1);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_wordArrayInc()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int var = fetchScriptWord();
|
|
|
|
int base = pop();
|
|
|
|
writeArray(var, 0, base, readArray(var, 0, base) + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_byteVarDec()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int var = fetchScriptByte();
|
2002-04-11 17:19:16 +00:00
|
|
|
writeVar(var, readVar(var) - 1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_wordVarDec()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int var = fetchScriptWord();
|
2002-04-11 17:19:16 +00:00
|
|
|
writeVar(var, readVar(var) - 1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_byteArrayDec()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int var = fetchScriptByte();
|
|
|
|
int base = pop();
|
|
|
|
writeArray(var, 0, base, readArray(var, 0, base) - 1);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_wordArrayDec()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int var = fetchScriptWord();
|
|
|
|
int base = pop();
|
|
|
|
writeArray(var, 0, base, readArray(var, 0, base) - 1);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_jumpTrue()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
if (pop())
|
2001-10-23 19:51:50 +00:00
|
|
|
o6_jump();
|
2001-10-16 10:01:48 +00:00
|
|
|
else
|
|
|
|
fetchScriptWord();
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_jumpFalse()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
if (!pop())
|
2001-10-23 19:51:50 +00:00
|
|
|
o6_jump();
|
2001-10-16 10:01:48 +00:00
|
|
|
else
|
|
|
|
fetchScriptWord();
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_jump()
|
|
|
|
{
|
2002-07-07 13:14:34 +00:00
|
|
|
_scriptPointer += (int16)fetchScriptWord();
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_startScriptEx()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 args[16];
|
2002-04-11 17:19:16 +00:00
|
|
|
int script, flags;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
getStackList(args, sizeof(args) / sizeof(args[0]));
|
2001-10-16 10:01:48 +00:00
|
|
|
script = pop();
|
|
|
|
flags = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
runScript(script, flags & 1, flags & 2, args);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_jumpToScript()
|
|
|
|
{
|
2001-11-26 19:57:57 +00:00
|
|
|
int16 args[16];
|
2002-04-11 17:19:16 +00:00
|
|
|
int script, flags;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
getStackList(args, sizeof(args) / sizeof(args[0]));
|
2001-11-26 19:57:57 +00:00
|
|
|
script = pop();
|
|
|
|
flags = pop();
|
|
|
|
o6_stopObjectCode();
|
2002-04-11 17:19:16 +00:00
|
|
|
runScript(script, flags & 1, flags & 2, args);
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_startScript()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 args[16];
|
|
|
|
int script;
|
2002-04-11 17:19:16 +00:00
|
|
|
getStackList(args, sizeof(args) / sizeof(args[0]));
|
2001-10-16 10:01:48 +00:00
|
|
|
script = pop();
|
|
|
|
runScript(script, 0, 0, args);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_startObject()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 args[16];
|
2002-04-11 17:19:16 +00:00
|
|
|
int script, entryp;
|
2001-10-16 10:01:48 +00:00
|
|
|
int flags;
|
2002-04-11 17:19:16 +00:00
|
|
|
getStackList(args, sizeof(args) / sizeof(args[0]));
|
2001-10-16 10:01:48 +00:00
|
|
|
entryp = pop();
|
|
|
|
script = pop();
|
|
|
|
flags = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
runVerbCode(script, entryp, flags & 1, flags & 2, args);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_setObjectState()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2001-11-26 19:57:57 +00:00
|
|
|
int b = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
if (a == 0)
|
|
|
|
a = 1;
|
|
|
|
// debug(1, "setObjectState(%d,%d)", a, b);
|
|
|
|
|
2001-11-26 19:57:57 +00:00
|
|
|
setObjectState(b, a, -1, -1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_setObjectXY()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int y = pop();
|
|
|
|
int x = pop();
|
2001-11-26 19:57:57 +00:00
|
|
|
int obj = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
// debug(1, "setObjectXY(%d,%d,%d)", obj, x, y);
|
2001-11-26 19:57:57 +00:00
|
|
|
setObjectState(obj, 1, x, y);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_stopObjectCode()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
stopObjectCode();
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_endCutscene()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
endCutscene();
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_cutScene()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 args[16];
|
2002-04-11 17:19:16 +00:00
|
|
|
getStackList(args, sizeof(args) / sizeof(args[0]));
|
2001-10-16 10:01:48 +00:00
|
|
|
cutscene(args);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_stopMusic()
|
|
|
|
{
|
2002-08-14 20:43:56 +00:00
|
|
|
_sound->stopAllSounds();
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_freezeUnfreeze()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
|
|
|
if (a)
|
|
|
|
freezeScripts(a);
|
|
|
|
else
|
|
|
|
unfreezeScripts();
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_cursorCommand()
|
|
|
|
{
|
|
|
|
int a, i;
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 args[16];
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
switch (fetchScriptByte()) {
|
2001-10-16 10:01:48 +00:00
|
|
|
case 0x90:
|
|
|
|
_cursorState = 1;
|
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
|
|
|
case 0x91:
|
|
|
|
_cursorState = 0;
|
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
|
|
|
case 0x92:
|
|
|
|
_userPut = 1;
|
|
|
|
break;
|
|
|
|
case 0x93:
|
|
|
|
_userPut = 0;
|
|
|
|
break;
|
|
|
|
case 0x94:
|
|
|
|
_cursorState++;
|
|
|
|
if (_cursorState > 1)
|
|
|
|
error("Cursor state greater than 1 in script");
|
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
|
|
|
case 0x95:
|
|
|
|
_cursorState--;
|
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
|
|
|
case 0x96:
|
|
|
|
_userPut++;
|
|
|
|
break;
|
|
|
|
case 0x97:
|
|
|
|
_userPut--;
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 0x99:{
|
|
|
|
int room, obj = popRoomAndObj(&room);
|
|
|
|
setCursorImg(obj, room, 1);
|
|
|
|
break;
|
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
case 0x9A:
|
|
|
|
a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
setCursorHotspot2(pop(), a);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 0x9C: /* init charset */
|
2001-10-16 10:01:48 +00:00
|
|
|
initCharset(pop());
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 0x9D: /* set charset colors */
|
|
|
|
getStackList(args, sizeof(args) / sizeof(args[0]));
|
|
|
|
for (i = 0; i < 16; i++)
|
2002-09-22 01:17:53 +00:00
|
|
|
charset._colorMap[i] = _charsetData[_string[1].t_charset][i] = (unsigned char)args[i];
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
case 0xD6:
|
2001-11-06 20:00:47 +00:00
|
|
|
makeCursorColorTransparent(pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2001-11-26 19:57:57 +00:00
|
|
|
default:
|
|
|
|
error("o6_cursorCommand: default case");
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_vars[VAR_CURSORSTATE] = _cursorState;
|
|
|
|
_vars[VAR_USERPUT] = _userPut;
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_breakHere()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
updateScriptPtr();
|
|
|
|
_currentScript = 0xFF;
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_ifClassOfIs()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 args[16];
|
2002-04-11 17:19:16 +00:00
|
|
|
int num, obj, cls;
|
2001-10-16 10:01:48 +00:00
|
|
|
bool b;
|
|
|
|
int cond = 1;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
num = getStackList(args, sizeof(args) / sizeof(args[0]));
|
2001-10-16 10:01:48 +00:00
|
|
|
obj = pop();
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
while (--num >= 0) {
|
2001-10-16 10:01:48 +00:00
|
|
|
cls = args[num];
|
|
|
|
b = getClass(obj, cls);
|
2002-04-11 17:19:16 +00:00
|
|
|
if (cls & 0x80 && !b || !(cls & 0x80) && b)
|
2001-10-16 10:01:48 +00:00
|
|
|
cond = 0;
|
|
|
|
}
|
|
|
|
push(cond);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_setClass()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 args[16];
|
2002-04-11 17:19:16 +00:00
|
|
|
int num, obj, cls;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
num = getStackList(args, sizeof(args) / sizeof(args[0]));
|
2001-10-16 10:01:48 +00:00
|
|
|
obj = pop();
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
while (--num >= 0) {
|
2001-10-16 10:01:48 +00:00
|
|
|
cls = args[num];
|
2002-04-11 17:19:16 +00:00
|
|
|
if (cls == 0)
|
2001-10-16 10:01:48 +00:00
|
|
|
_classData[num] = 0;
|
2002-04-11 17:19:16 +00:00
|
|
|
else if (cls & 0x80)
|
2001-10-16 10:01:48 +00:00
|
|
|
putClass(obj, cls, 1);
|
|
|
|
else
|
|
|
|
putClass(obj, cls, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getState()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
push(getState(pop()));
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_setState()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int state = pop();
|
|
|
|
int obj = pop();
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
// debug(1, "setState(%d,%d)", obj, state);
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
putState(obj, state);
|
|
|
|
removeObjectFromRoom(obj);
|
|
|
|
if (_BgNeedsRedraw)
|
|
|
|
clearDrawObjectQueue();
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_setOwner()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int owner = pop();
|
|
|
|
int obj = pop();
|
|
|
|
|
|
|
|
setOwnerOf(obj, owner);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getOwner()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
push(getOwner(pop()));
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_startSound()
|
|
|
|
{
|
2002-08-14 20:43:56 +00:00
|
|
|
_sound->addSoundToQueue(pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_stopSound()
|
|
|
|
{
|
2002-08-14 20:43:56 +00:00
|
|
|
_sound->stopSound(pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_startMusic()
|
|
|
|
{
|
2002-08-14 20:43:56 +00:00
|
|
|
_sound->addSoundToQueue(pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_stopObjectScript()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
stopObjectScript(pop());
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_panCameraTo()
|
|
|
|
{
|
|
|
|
if (_features & GF_AFTER_V7) {
|
2002-03-05 20:13:47 +00:00
|
|
|
int y = pop();
|
|
|
|
int x = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
panCameraTo(x, y);
|
2002-03-05 20:13:47 +00:00
|
|
|
} else {
|
|
|
|
panCameraTo(pop(), 0);
|
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_actorFollowCamera()
|
|
|
|
{
|
|
|
|
if (_features & GF_AFTER_V7)
|
2002-03-06 00:18:22 +00:00
|
|
|
setCameraFollows(derefActorSafe(pop(), "actorFollowCamera"));
|
|
|
|
else
|
|
|
|
actorFollowCamera(pop());
|
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_setCameraAt()
|
|
|
|
{
|
|
|
|
if (_features & GF_AFTER_V7) {
|
|
|
|
int x, y;
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2002-03-06 00:18:22 +00:00
|
|
|
camera._follows = 0;
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2002-03-06 00:18:22 +00:00
|
|
|
y = pop();
|
|
|
|
x = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
|
|
|
|
setCameraAt(x, y);
|
2002-03-06 00:18:22 +00:00
|
|
|
} else {
|
|
|
|
setCameraAtEx(pop());
|
2002-04-11 17:19:16 +00:00
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_loadRoom()
|
|
|
|
{
|
2002-04-07 04:29:15 +00:00
|
|
|
int room;
|
|
|
|
/* Begin: Autosave
|
2002-04-11 17:19:16 +00:00
|
|
|
_saveLoadSlot = 0;
|
|
|
|
sprintf(_saveLoadName, "Autosave", _saveLoadSlot);
|
|
|
|
_saveLoadFlag = 1;
|
|
|
|
_saveLoadCompatible = false;
|
|
|
|
End: Autosave */
|
2002-04-07 04:29:15 +00:00
|
|
|
|
|
|
|
room = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
startScene(room, 0, 0);
|
|
|
|
_fullRedraw = 1;
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_stopScript()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int script = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
if (script == 0)
|
2001-10-16 10:01:48 +00:00
|
|
|
stopObjectCode();
|
|
|
|
else
|
|
|
|
stopScriptNr(script);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_walkActorToObj()
|
|
|
|
{
|
|
|
|
int obj, dist;
|
2001-10-16 10:01:48 +00:00
|
|
|
Actor *a, *a2;
|
|
|
|
int x;
|
|
|
|
|
|
|
|
dist = pop();
|
|
|
|
obj = pop();
|
2001-10-23 19:51:50 +00:00
|
|
|
a = derefActorSafe(pop(), "o6_walkActorToObj");
|
2002-04-11 17:19:16 +00:00
|
|
|
if (!a)
|
|
|
|
return;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2001-11-26 19:57:57 +00:00
|
|
|
if (obj >= NUM_ACTORS) {
|
2002-04-11 17:19:16 +00:00
|
|
|
if (whereIsObject(obj) == WIO_NOT_FOUND)
|
2001-10-16 10:01:48 +00:00
|
|
|
return;
|
2002-10-22 11:48:24 +00:00
|
|
|
int y, dir;
|
2002-07-16 18:51:27 +00:00
|
|
|
getObjectXYPos(obj, x, y, dir);
|
|
|
|
a->startWalkActor(x, y, dir);
|
2001-10-16 10:01:48 +00:00
|
|
|
} else {
|
2001-10-23 19:51:50 +00:00
|
|
|
a2 = derefActorSafe(obj, "o6_walkActorToObj(2)");
|
2002-04-11 17:19:16 +00:00
|
|
|
if (!a2)
|
|
|
|
return;
|
2002-08-04 13:03:33 +00:00
|
|
|
if (!a->isInCurrentRoom() || !a2->isInCurrentRoom())
|
2002-04-11 17:19:16 +00:00
|
|
|
return;
|
|
|
|
if (dist == 0) {
|
2001-10-16 10:01:48 +00:00
|
|
|
dist = a2->scalex * a2->width / 0xFF;
|
2002-04-11 17:19:16 +00:00
|
|
|
dist += dist >> 1;
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
x = a2->x;
|
|
|
|
if (x < a->x)
|
|
|
|
x += dist;
|
|
|
|
else
|
|
|
|
x -= dist;
|
2002-05-14 19:11:20 +00:00
|
|
|
a->startWalkActor(x, a2->y, -1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_walkActorTo()
|
|
|
|
{
|
|
|
|
int x, y;
|
2001-10-16 10:01:48 +00:00
|
|
|
y = pop();
|
|
|
|
x = pop();
|
2002-05-14 19:11:20 +00:00
|
|
|
derefActorSafe(pop(), "o6_walkActorTo")->startWalkActor(x, y, -1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_putActorInRoom()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int room, x, y;
|
|
|
|
Actor *a;
|
|
|
|
|
|
|
|
room = pop();
|
|
|
|
y = pop();
|
|
|
|
x = pop();
|
2001-10-23 19:51:50 +00:00
|
|
|
a = derefActorSafe(pop(), "o6_putActorInRoom");
|
2002-03-05 09:58:12 +00:00
|
|
|
if (!a)
|
|
|
|
return;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
if (room == 0xFF) {
|
2001-10-16 10:01:48 +00:00
|
|
|
room = a->room;
|
|
|
|
} else {
|
2002-07-07 13:14:34 +00:00
|
|
|
if (a->visible && _currentRoom != room && _vars[VAR_TALK_ACTOR] == a->number) {
|
2001-10-16 10:01:48 +00:00
|
|
|
clearMsgQueue();
|
|
|
|
}
|
|
|
|
if (room != 0)
|
|
|
|
a->room = room;
|
|
|
|
}
|
2002-07-18 15:45:10 +00:00
|
|
|
a->putActor(x, y, room);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_putActorAtObject()
|
|
|
|
{
|
2002-07-16 21:03:14 +00:00
|
|
|
int room, obj, x, y;
|
2001-10-16 10:01:48 +00:00
|
|
|
Actor *a;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
obj = popRoomAndObj(&room);
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2001-10-23 19:51:50 +00:00
|
|
|
a = derefActorSafe(pop(), "o6_putActorAtObject");
|
2002-04-11 17:19:16 +00:00
|
|
|
if (whereIsObject(obj) != WIO_NOT_FOUND) {
|
2002-07-16 18:51:27 +00:00
|
|
|
getObjectXYPos(obj, x, y);
|
2001-10-16 10:01:48 +00:00
|
|
|
} else {
|
2002-09-01 15:01:40 +00:00
|
|
|
x = (_realWidth / 2);
|
2001-10-16 10:01:48 +00:00
|
|
|
y = 120;
|
|
|
|
}
|
|
|
|
if (room == 0xFF)
|
|
|
|
room = a->room;
|
2002-07-18 15:45:10 +00:00
|
|
|
a->putActor(x, y, room);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_faceActor()
|
|
|
|
{
|
|
|
|
int act, obj;
|
2001-10-16 10:01:48 +00:00
|
|
|
obj = pop();
|
|
|
|
act = pop();
|
|
|
|
faceActorToObj(act, obj);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_animateActor()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int anim = pop();
|
|
|
|
int act = pop();
|
2001-11-05 19:21:49 +00:00
|
|
|
|
2002-08-04 02:53:50 +00:00
|
|
|
Actor *a = derefActorSafe(act, "o6_animateActor");
|
|
|
|
if (!a)
|
|
|
|
return;
|
|
|
|
|
|
|
|
a->animateActor(anim);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_doSentence()
|
|
|
|
{
|
|
|
|
int a, b, c;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
|
|
|
a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
pop(); //dummy pop
|
2001-10-16 10:01:48 +00:00
|
|
|
b = pop();
|
|
|
|
c = pop();
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
doSentence(c, b, a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_pickupObject()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int obj, room;
|
2001-11-26 19:57:57 +00:00
|
|
|
int i;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
obj = popRoomAndObj(&room);
|
|
|
|
if (room == 0)
|
2001-12-27 17:51:58 +00:00
|
|
|
room = _roomResource;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
for (i = 1; i < _maxInventoryItems; i++) {
|
2001-11-26 19:57:57 +00:00
|
|
|
if (_inventory[i] == (uint16)obj) {
|
|
|
|
putOwner(obj, _vars[VAR_EGO]);
|
|
|
|
runHook(obj);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
addObjectToInventory(obj, room);
|
2001-10-26 17:34:50 +00:00
|
|
|
putOwner(obj, _vars[VAR_EGO]);
|
2001-10-16 10:01:48 +00:00
|
|
|
putClass(obj, 32, 1);
|
|
|
|
putState(obj, 1);
|
|
|
|
removeObjectFromRoom(obj);
|
|
|
|
clearDrawObjectQueue();
|
2002-04-11 17:19:16 +00:00
|
|
|
runHook(obj); /* Difference */
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_loadRoomWithEgo()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
Actor *a;
|
2002-08-15 20:12:15 +00:00
|
|
|
int obj, room, x, y;
|
2002-04-07 04:29:15 +00:00
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
y = pop();
|
|
|
|
x = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
|
|
|
|
obj = popRoomAndObj(&room);
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2002-08-15 20:12:15 +00:00
|
|
|
a = derefActorSafe(_vars[VAR_EGO], "o6_loadRoomWithEgo");
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-07-18 15:45:10 +00:00
|
|
|
a->putActor(0, 0, room);
|
2001-10-26 17:34:50 +00:00
|
|
|
_egoPositioned = false;
|
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
_vars[VAR_WALKTO_OBJ] = obj;
|
|
|
|
startScene(a->room, a, obj);
|
|
|
|
_vars[VAR_WALKTO_OBJ] = 0;
|
|
|
|
|
2001-10-26 17:34:50 +00:00
|
|
|
/* startScene maybe modifies VAR_EGO, i hope not */
|
2002-04-11 17:19:16 +00:00
|
|
|
|
|
|
|
if (!(_features & GF_AFTER_V7)) {
|
2002-08-11 09:05:30 +00:00
|
|
|
setCameraAt(a->x, a->y);
|
2002-03-06 00:18:22 +00:00
|
|
|
setCameraFollows(a);
|
|
|
|
}
|
2002-08-15 20:12:15 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
_fullRedraw = 1;
|
2002-08-15 20:12:15 +00:00
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
if (x != -1) {
|
2002-05-14 19:11:20 +00:00
|
|
|
a->startWalkActor(x, y, -1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getRandomNumber()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int rnd;
|
2002-12-01 14:57:50 +00:00
|
|
|
rnd = _rnd.getRandomNumber(pop());
|
2001-10-23 19:51:50 +00:00
|
|
|
_vars[VAR_V6_RANDOM_NR] = rnd;
|
2001-10-16 10:01:48 +00:00
|
|
|
push(rnd);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getRandomNumberRange()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int max = pop();
|
|
|
|
int min = pop();
|
2002-12-01 14:57:50 +00:00
|
|
|
int rnd = _rnd.getRandomNumberRng(min, max);
|
2001-10-23 19:51:50 +00:00
|
|
|
_vars[VAR_V6_RANDOM_NR] = rnd;
|
2001-10-16 10:01:48 +00:00
|
|
|
push(rnd);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getActorMoving()
|
|
|
|
{
|
|
|
|
push(derefActorSafe(pop(), "o6_getActorMoving")->moving);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getScriptRunning()
|
|
|
|
{
|
2001-11-26 19:57:57 +00:00
|
|
|
push(isScriptRunning(pop()));
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_isRoomScriptRunning()
|
|
|
|
{
|
2001-11-26 19:57:57 +00:00
|
|
|
push(isRoomScriptRunning(pop()));
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getActorRoom()
|
|
|
|
{
|
|
|
|
push(derefActorSafe(pop(), "o6_getActorRoom")->room);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getObjectX()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
push(getObjX(pop()));
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getObjectY()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
push(getObjY(pop()));
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getObjectOldDir()
|
|
|
|
{
|
2001-12-27 17:51:58 +00:00
|
|
|
push(getObjOldDir(pop()));
|
|
|
|
}
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getObjectNewDir()
|
|
|
|
{
|
2001-12-27 17:51:58 +00:00
|
|
|
push(getObjNewDir(pop()));
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getActorWalkBox()
|
|
|
|
{
|
|
|
|
Actor *a = derefActorSafe(pop(), "o6_getActorWalkBox");
|
2001-11-26 19:57:57 +00:00
|
|
|
push(a->ignoreBoxes ? 0 : a->walkbox);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getActorCostume()
|
|
|
|
{
|
|
|
|
push(derefActorSafe(pop(), "o6_getActorCostume")->costume);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_findInventory()
|
|
|
|
{
|
2002-03-08 08:42:11 +00:00
|
|
|
int idx = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
int owner = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(findInventory(owner, idx));
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getInventoryCount()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
push(getInventoryCount(pop()));
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getVerbFromXY()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int y = pop();
|
|
|
|
int x = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
int over = checkMouseOver(x, y);
|
2001-10-16 10:01:48 +00:00
|
|
|
if (over)
|
|
|
|
over = _verbs[over].verbid;
|
|
|
|
push(over);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_beginOverride()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
beginOverride();
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_endOverride()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
endOverride();
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_setObjectName()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int obj = pop();
|
|
|
|
int i;
|
|
|
|
|
2001-11-26 19:57:57 +00:00
|
|
|
if (obj < NUM_ACTORS)
|
2001-10-16 10:01:48 +00:00
|
|
|
error("Can't set actor %d name with new-name-of", obj);
|
|
|
|
|
2002-04-24 14:13:09 +00:00
|
|
|
if (!(_features & GF_AFTER_V7) && !getOBCDFromObject(obj))
|
2001-10-16 10:01:48 +00:00
|
|
|
error("Can't set name of object %d", obj);
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
for (i = 1; i < 50; i++) {
|
2001-10-16 10:01:48 +00:00
|
|
|
if (_newNames[i] == obj) {
|
2001-11-05 19:21:49 +00:00
|
|
|
nukeResource(rtObjectName, i);
|
2001-10-16 10:01:48 +00:00
|
|
|
_newNames[i] = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
for (i = 1; i < 50; i++) {
|
2001-10-16 10:01:48 +00:00
|
|
|
if (_newNames[i] == 0) {
|
2001-11-05 19:21:49 +00:00
|
|
|
loadPtrToResource(rtObjectName, i, NULL);
|
2001-10-16 10:01:48 +00:00
|
|
|
_newNames[i] = obj;
|
|
|
|
runHook(0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
error("New name of %d overflows name table (max = %d)", obj, 50);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_isSoundRunning()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int snd = pop();
|
2002-05-10 18:47:37 +00:00
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
if (snd)
|
2002-08-14 20:43:56 +00:00
|
|
|
snd = _sound->isSoundRunning(snd);
|
2002-07-07 13:14:34 +00:00
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
push(snd);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_setBoxFlags()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 table[65];
|
2002-04-11 17:19:16 +00:00
|
|
|
int num, value;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
|
|
|
value = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
num = getStackList(table, sizeof(table) / sizeof(table[0]));
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
while (--num >= 0) {
|
2001-10-16 10:01:48 +00:00
|
|
|
setBoxFlags(table[num], value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_createBoxMatrix()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
createBoxMatrix();
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_resourceRoutines()
|
|
|
|
{
|
2002-03-08 08:42:11 +00:00
|
|
|
int resid;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
switch (fetchScriptByte()) {
|
|
|
|
case 100: /* load script */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
if (_features & GF_AFTER_V7)
|
2002-03-08 08:42:11 +00:00
|
|
|
if (resid >= _numGlobalScripts)
|
2002-03-06 00:18:22 +00:00
|
|
|
break;
|
2002-03-08 08:42:11 +00:00
|
|
|
ensureResourceLoaded(rtScript, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 101: /* load sound */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
ensureResourceLoaded(rtSound, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 102: /* load costume */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
ensureResourceLoaded(rtCostume, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 103: /* load room */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
ensureResourceLoaded(rtRoom, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 104: /* nuke script */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
if (_features & GF_AFTER_V7)
|
2002-03-08 08:42:11 +00:00
|
|
|
if (resid >= _numGlobalScripts)
|
2002-03-06 00:18:22 +00:00
|
|
|
break;
|
2002-03-08 08:42:11 +00:00
|
|
|
setResourceCounter(rtScript, resid, 0x7F);
|
|
|
|
debug(5, "nuke script %d", resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 105: /* nuke sound */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
setResourceCounter(rtSound, resid, 0x7F);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 106: /* nuke costume */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
setResourceCounter(rtCostume, resid, 0x7F);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 107: /* nuke room */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
setResourceCounter(rtRoom, resid, 0x7F);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 108: /* lock script */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
if (resid >= _numGlobalScripts)
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
lock(rtScript, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 109: /* lock sound */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
lock(rtSound, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 110: /* lock costume */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
lock(rtCostume, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 111: /* lock room */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
if (resid > 0x7F)
|
2002-04-11 17:19:16 +00:00
|
|
|
resid = _resourceMapper[resid & 0x7F];
|
|
|
|
lock(rtRoom, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 112: /* unlock script */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
if (resid >= _numGlobalScripts)
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
unlock(rtScript, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 113: /* unlock sound */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
unlock(rtSound, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 114: /* unlock costume */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
unlock(rtCostume, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 115: /* unlock room */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
if (resid > 0x7F)
|
2002-04-11 17:19:16 +00:00
|
|
|
resid = _resourceMapper[resid & 0x7F];
|
|
|
|
unlock(rtRoom, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 116: /* clear heap */
|
2001-10-16 10:01:48 +00:00
|
|
|
/* this is actually a scumm message */
|
|
|
|
error("clear heap not working yet");
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 117: /* load charset */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
loadCharset(resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 118: /* nuke charset */
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
nukeCharset(resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 119:{ /* load fl object */
|
|
|
|
int room, obj = popRoomAndObj(&room);
|
|
|
|
loadFlObject(obj, room);
|
|
|
|
break;
|
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
default:
|
2001-10-23 19:51:50 +00:00
|
|
|
error("o6_resourceRoutines: default case");
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_roomOps()
|
|
|
|
{
|
|
|
|
int a, b, c, d, e;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
switch (fetchScriptByte()) {
|
|
|
|
case 172: /* room scroll */
|
2001-10-16 10:01:48 +00:00
|
|
|
b = pop();
|
|
|
|
a = pop();
|
2002-09-01 15:01:40 +00:00
|
|
|
if (a < (_realWidth / 2))
|
|
|
|
a = (_realWidth / 2);
|
|
|
|
if (b < (_realWidth / 2))
|
|
|
|
b = (_realWidth / 2);
|
|
|
|
if (a > _scrWidth - (_realWidth / 2))
|
|
|
|
a = _scrWidth - (_realWidth / 2);
|
|
|
|
if (b > _scrWidth - (_realWidth / 2))
|
|
|
|
b = _scrWidth - (_realWidth / 2);
|
2001-11-26 19:57:57 +00:00
|
|
|
_vars[VAR_CAMERA_MIN_X] = a;
|
|
|
|
_vars[VAR_CAMERA_MAX_X] = b;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
case 174: /* set screen */
|
2001-10-16 10:01:48 +00:00
|
|
|
b = pop();
|
|
|
|
a = pop();
|
2002-09-01 15:01:40 +00:00
|
|
|
initScreens(0, a, _realWidth, b);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
case 175: /* set palette color */
|
2001-10-16 10:01:48 +00:00
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
setPalColor(d, a, b, c);
|
|
|
|
break;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
case 176: /* shake on */
|
2001-10-16 10:01:48 +00:00
|
|
|
setShake(1);
|
|
|
|
break;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
case 177: /* shake off */
|
2001-10-16 10:01:48 +00:00
|
|
|
setShake(0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 179:
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
darkenPalette(b, c, a, a, a);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 180:
|
2001-10-26 17:34:50 +00:00
|
|
|
_saveLoadCompatible = true;
|
|
|
|
_saveLoadSlot = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
_saveLoadFlag = pop();
|
2001-10-23 19:51:50 +00:00
|
|
|
warning("o6_roomops:180: partially unimplemented");
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 181:
|
|
|
|
a = pop();
|
|
|
|
if (a) {
|
|
|
|
_switchRoomEffect = (byte)(a);
|
2002-04-11 17:19:16 +00:00
|
|
|
_switchRoomEffect2 = (byte)(a >> 8);
|
2001-10-16 10:01:48 +00:00
|
|
|
} else {
|
2002-07-13 14:07:37 +00:00
|
|
|
fadeIn(_newEffect);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 182:
|
|
|
|
e = pop();
|
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
2001-10-26 17:34:50 +00:00
|
|
|
darkenPalette(d, e, a, b, c);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 183:
|
|
|
|
e = pop();
|
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
unkRoomFunc3(d, e, a, b, c);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 184:
|
|
|
|
error("save string not implemented");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 185:
|
|
|
|
error("load string not implemented");
|
|
|
|
break;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
case 186: /* palmanip? */
|
2001-10-16 10:01:48 +00:00
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
2002-09-13 11:54:59 +00:00
|
|
|
palManipulateInit(a, b, c, d);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
case 187: /* color cycle delay */
|
2001-10-16 10:01:48 +00:00
|
|
|
b = pop();
|
|
|
|
a = pop();
|
2001-10-26 17:34:50 +00:00
|
|
|
checkRange(16, 1, a, "o6_roomOps: 187: color cycle out of range (%d)");
|
2002-04-11 17:19:16 +00:00
|
|
|
_colorCycle[a - 1].delay = (b != 0) ? 0x4000 / (b * 0x4C) : 0;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
case 213: /* set palette */
|
2002-07-28 01:40:24 +00:00
|
|
|
// One case where this is used is to turn off Sam & Max film
|
|
|
|
// noir mode. Unfortunately it only restores color to the
|
|
|
|
// palette, it doesn't take palette manipulation (darkening,
|
|
|
|
// etc.) into account. So, for instance, if you turn on film
|
|
|
|
// noir mode in Sam & Max's office, turn off the light and turn
|
|
|
|
// off film noir mode, the room will no longer look dark.
|
|
|
|
//
|
|
|
|
// This bug is present in the original interpreter, so it may
|
|
|
|
// not be worth the trouble fixing it.
|
2001-10-16 10:01:48 +00:00
|
|
|
setPalette(pop());
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2001-10-23 19:51:50 +00:00
|
|
|
error("o6_roomOps: default case");
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_actorSet()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
Actor *a;
|
2002-04-11 17:19:16 +00:00
|
|
|
int i, j, k;
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 args[8];
|
|
|
|
byte b;
|
|
|
|
|
|
|
|
b = fetchScriptByte();
|
2002-04-11 17:19:16 +00:00
|
|
|
if (b == 197) {
|
2001-10-16 10:01:48 +00:00
|
|
|
_curActor = pop();
|
|
|
|
return;
|
|
|
|
}
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2001-10-23 19:51:50 +00:00
|
|
|
a = derefActorSafe(_curActor, "o6_actorSet");
|
2002-04-11 17:19:16 +00:00
|
|
|
if (!a)
|
|
|
|
return;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
switch (b) {
|
|
|
|
case 76: /* actor-costume */
|
2002-05-14 19:11:20 +00:00
|
|
|
a->setActorCostume(pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 77: /* actor-speed */
|
2001-10-16 10:01:48 +00:00
|
|
|
j = pop();
|
|
|
|
i = pop();
|
2002-05-14 19:11:20 +00:00
|
|
|
a->setActorWalkSpeed(i, j);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 78: /* actor-sound */
|
|
|
|
k = getStackList(args, sizeof(args) / sizeof(args[0]));
|
|
|
|
for (i = 0; i < k; i++)
|
2001-10-16 10:01:48 +00:00
|
|
|
a->sound[i] = args[i];
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 79: /* actor-walkframe */
|
2001-10-16 10:01:48 +00:00
|
|
|
a->walkFrame = pop();
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 80: /* actor-talkframe */
|
2001-10-16 10:01:48 +00:00
|
|
|
a->talkFrame2 = pop();
|
|
|
|
a->talkFrame1 = pop();
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 81: /* actor-standframe */
|
2001-10-16 10:01:48 +00:00
|
|
|
a->standFrame = pop();
|
|
|
|
break;
|
|
|
|
case 82:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 83:
|
2002-05-14 19:11:20 +00:00
|
|
|
a->initActor(0);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 84: /* actor-elevation */
|
2001-10-16 10:01:48 +00:00
|
|
|
a->elevation = pop();
|
|
|
|
a->needRedraw = true;
|
|
|
|
a->needBgReset = true;
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 85: /* actor-defaultanims */
|
2001-10-16 10:01:48 +00:00
|
|
|
a->initFrame = 1;
|
|
|
|
a->walkFrame = 2;
|
|
|
|
a->standFrame = 3;
|
|
|
|
a->talkFrame1 = 4;
|
|
|
|
a->talkFrame2 = 5;
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 86: /* actor-palette */
|
2001-10-16 10:01:48 +00:00
|
|
|
j = pop();
|
|
|
|
i = pop();
|
|
|
|
checkRange(31, 0, i, "Illegal palet slot %d");
|
|
|
|
a->palette[i] = j;
|
|
|
|
a->needRedraw = true;
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 87: /* actor-talkcolor */
|
2001-10-16 10:01:48 +00:00
|
|
|
a->talkColor = pop();
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 88: /* actor-name */
|
2001-11-14 20:09:39 +00:00
|
|
|
loadPtrToResource(rtActorName, a->number, NULL);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 89: /* actor-initframe */
|
2001-10-16 10:01:48 +00:00
|
|
|
a->initFrame = pop();
|
|
|
|
break;
|
|
|
|
case 91:
|
|
|
|
a->width = pop();
|
|
|
|
break;
|
|
|
|
case 92:
|
|
|
|
a->scalex = a->scaley = pop();
|
|
|
|
a->needRedraw = true;
|
|
|
|
a->needBgReset = true;
|
|
|
|
break;
|
|
|
|
case 93:
|
2001-11-27 17:56:04 +00:00
|
|
|
a->forceClip = 0;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2001-11-26 19:57:57 +00:00
|
|
|
case 225:
|
2001-10-16 10:01:48 +00:00
|
|
|
case 94:
|
2001-11-27 17:56:04 +00:00
|
|
|
a->forceClip = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
case 95:
|
|
|
|
a->ignoreBoxes = 1;
|
2002-07-07 13:14:34 +00:00
|
|
|
if (_features & GF_AFTER_V7) // yazoo: I don't know if it's supposed to be 100 in other games too...
|
2002-05-22 12:56:26 +00:00
|
|
|
a->forceClip = 100;
|
|
|
|
else
|
|
|
|
a->forceClip = 0;
|
2002-04-11 17:19:16 +00:00
|
|
|
FixRooms:;
|
2002-06-04 23:32:53 +00:00
|
|
|
if (a->isInCurrentRoom())
|
2002-07-18 15:45:10 +00:00
|
|
|
a->putActor(a->x, a->y, a->room);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
case 96:
|
|
|
|
a->ignoreBoxes = 0;
|
2002-07-07 13:14:34 +00:00
|
|
|
if (_features & GF_AFTER_V7) // yazoo: I don't know if it's supposed to be 100 in other games too...
|
2002-05-22 12:56:26 +00:00
|
|
|
a->forceClip = 100;
|
|
|
|
else
|
|
|
|
a->forceClip = 0;
|
2001-10-16 10:01:48 +00:00
|
|
|
goto FixRooms;
|
|
|
|
case 97:
|
|
|
|
a->animSpeed = pop();
|
|
|
|
a->animProgress = 0;
|
|
|
|
break;
|
2001-11-26 19:57:57 +00:00
|
|
|
case 98:
|
2001-12-27 17:51:58 +00:00
|
|
|
a->shadow_mode = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
case 99:
|
|
|
|
a->new_1 = pop();
|
|
|
|
a->new_2 = pop();
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 198: /* set anim variable */
|
|
|
|
i = pop(); /* value */
|
2002-05-23 00:37:00 +00:00
|
|
|
a->setAnimVar(pop(), i);
|
2001-12-27 17:51:58 +00:00
|
|
|
break;
|
2001-10-16 10:01:48 +00:00
|
|
|
case 215:
|
|
|
|
a->new_3 = 1;
|
2002-04-11 17:19:16 +00:00
|
|
|
break;
|
2001-10-16 10:01:48 +00:00
|
|
|
case 216:
|
|
|
|
a->new_3 = 0;
|
|
|
|
break;
|
|
|
|
case 217:
|
2002-05-14 19:11:20 +00:00
|
|
|
a->initActor(2);
|
2001-11-26 19:57:57 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 227: /* actor_layer */
|
2001-12-27 17:51:58 +00:00
|
|
|
a->layer = pop();
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 228: /* walk script */
|
2001-12-27 17:51:58 +00:00
|
|
|
a->walk_script = pop();
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 235: /* talk_script */
|
2001-11-26 19:57:57 +00:00
|
|
|
a->talk_script = pop();
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 229: /* stand */
|
2002-05-14 19:11:20 +00:00
|
|
|
a->stopActorMoving();
|
|
|
|
a->startAnimActor(a->standFrame);
|
2001-12-27 17:51:58 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 230: /* set direction */
|
2002-06-04 23:32:53 +00:00
|
|
|
a->moving &= ~MF_TURN;
|
2002-07-18 15:45:10 +00:00
|
|
|
a->setDirection(pop());
|
2001-12-27 17:51:58 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 231: /* turn to direction */
|
2002-05-14 19:11:20 +00:00
|
|
|
a->turnToDirection(pop());
|
2001-12-27 17:51:58 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 233: /* freeze actor */
|
|
|
|
a->moving |= 0x80;
|
2001-12-27 17:51:58 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 234: /* unfreeze actor */
|
|
|
|
a->moving &= ~0x7f;
|
2001-12-27 17:51:58 +00:00
|
|
|
break;
|
2001-10-16 10:01:48 +00:00
|
|
|
default:
|
2001-11-26 19:57:57 +00:00
|
|
|
error("o6_actorset: default case %d", b);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_verbOps()
|
|
|
|
{
|
|
|
|
int slot, a, b;
|
2001-10-16 10:01:48 +00:00
|
|
|
VerbSlot *vs;
|
|
|
|
byte *ptr, op;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-10-01 09:27:09 +00:00
|
|
|
// Full Throttle implements conversation by creating new verbs, one
|
|
|
|
// for each option, but it never tells when to actually draw them.
|
|
|
|
|
|
|
|
if (_gameId == GID_FT)
|
|
|
|
_verbRedraw = true;
|
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
op = fetchScriptByte();
|
2002-04-11 17:19:16 +00:00
|
|
|
if (op == 196) {
|
2001-10-16 10:01:48 +00:00
|
|
|
_curVerb = pop();
|
|
|
|
_curVerbSlot = getVerbSlot(_curVerb, 0);
|
2002-04-11 17:19:16 +00:00
|
|
|
checkRange(_maxVerbs - 1, 0, _curVerbSlot, "Illegal new verb slot %d");
|
2001-10-16 10:01:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
vs = &_verbs[_curVerbSlot];
|
|
|
|
slot = _curVerbSlot;
|
2002-04-11 17:19:16 +00:00
|
|
|
switch (op) {
|
|
|
|
case 124: /* load img */
|
2001-10-16 10:01:48 +00:00
|
|
|
a = pop();
|
|
|
|
if (_curVerbSlot) {
|
2002-04-11 17:19:16 +00:00
|
|
|
setVerbObject(_roomResource, a, slot);
|
2002-11-29 18:27:35 +00:00
|
|
|
vs->type = kImageVerbType;
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 125:
|
2001-11-14 20:09:39 +00:00
|
|
|
loadPtrToResource(rtVerb, slot, NULL);
|
2002-11-29 18:27:35 +00:00
|
|
|
vs->type = kTextVerbType;
|
2001-10-16 10:01:48 +00:00
|
|
|
vs->imgindex = 0;
|
|
|
|
break;
|
|
|
|
case 126:
|
|
|
|
vs->color = pop();
|
|
|
|
break;
|
|
|
|
case 127:
|
|
|
|
vs->hicolor = pop();
|
|
|
|
break;
|
|
|
|
case 128:
|
|
|
|
vs->y = pop();
|
|
|
|
vs->x = pop();
|
|
|
|
break;
|
|
|
|
case 129:
|
|
|
|
vs->curmode = 1;
|
|
|
|
break;
|
|
|
|
case 130:
|
|
|
|
vs->curmode = 0;
|
|
|
|
break;
|
|
|
|
case 131:
|
|
|
|
killVerb(slot);
|
|
|
|
break;
|
|
|
|
case 132:
|
|
|
|
slot = getVerbSlot(_curVerb, 0);
|
2002-04-11 17:19:16 +00:00
|
|
|
if (slot == 0) {
|
|
|
|
for (slot = 1; slot < _maxVerbs; slot++) {
|
|
|
|
if (_verbs[slot].verbid == 0)
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-04-11 17:19:16 +00:00
|
|
|
if (slot == _maxVerbs)
|
2001-10-16 10:01:48 +00:00
|
|
|
error("Too many verbs");
|
|
|
|
_curVerbSlot = slot;
|
|
|
|
}
|
|
|
|
vs = &_verbs[slot];
|
|
|
|
vs->verbid = _curVerb;
|
|
|
|
vs->color = 2;
|
|
|
|
vs->hicolor = 0;
|
|
|
|
vs->dimcolor = 8;
|
2002-11-29 18:27:35 +00:00
|
|
|
vs->type = kTextVerbType;
|
2002-09-22 01:17:53 +00:00
|
|
|
vs->charset_nr = _string[0].t_charset;
|
2001-10-16 10:01:48 +00:00
|
|
|
vs->curmode = 0;
|
|
|
|
vs->saveid = 0;
|
|
|
|
vs->key = 0;
|
|
|
|
vs->center = 0;
|
|
|
|
vs->imgindex = 0;
|
|
|
|
break;
|
|
|
|
case 133:
|
|
|
|
vs->dimcolor = pop();
|
|
|
|
break;
|
|
|
|
case 134:
|
|
|
|
vs->curmode = 2;
|
|
|
|
break;
|
|
|
|
case 135:
|
|
|
|
vs->key = pop();
|
|
|
|
break;
|
|
|
|
case 136:
|
|
|
|
vs->center = 1;
|
|
|
|
break;
|
|
|
|
case 137:
|
|
|
|
a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
if (a == 0) {
|
|
|
|
ptr = (byte *)"";
|
2001-10-16 10:01:48 +00:00
|
|
|
} else {
|
2001-10-24 20:12:52 +00:00
|
|
|
ptr = getStringAddress(a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
2001-11-14 20:09:39 +00:00
|
|
|
loadPtrToResource(rtVerb, slot, ptr);
|
2002-11-29 18:27:35 +00:00
|
|
|
vs->type = kTextVerbType;
|
2001-10-16 10:01:48 +00:00
|
|
|
vs->imgindex = 0;
|
|
|
|
break;
|
|
|
|
case 139:
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
if (slot && a != vs->imgindex) {
|
|
|
|
setVerbObject(b, a, slot);
|
2002-11-29 18:27:35 +00:00
|
|
|
vs->type = kImageVerbType;
|
2001-10-16 10:01:48 +00:00
|
|
|
vs->imgindex = a;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 140:
|
|
|
|
vs->bkcolor = pop();
|
|
|
|
break;
|
|
|
|
case 255:
|
|
|
|
drawVerb(slot, 0);
|
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
|
|
|
default:
|
2001-10-23 19:51:50 +00:00
|
|
|
error("o6_verbops: default case");
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getActorFromXY()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int y = pop();
|
|
|
|
int x = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(getActorFromPos(x, y));
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_findObject()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int y = pop();
|
|
|
|
int x = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
int r = findObject(x, y);
|
2001-10-16 10:01:48 +00:00
|
|
|
push(r);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_pseudoRoom()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 list[100];
|
2002-04-11 17:19:16 +00:00
|
|
|
int num, a, value;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
num = getStackList(list, sizeof(list) / sizeof(list[0]));
|
2001-10-16 10:01:48 +00:00
|
|
|
value = pop();
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
while (--num >= 0) {
|
2001-10-16 10:01:48 +00:00
|
|
|
a = list[num];
|
|
|
|
if (a > 0x7F)
|
2002-04-11 17:19:16 +00:00
|
|
|
_resourceMapper[a & 0x7F] = value;
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getActorElevation()
|
|
|
|
{
|
|
|
|
push(derefActorSafe(pop(), "o6_getActorElevation")->elevation);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getVerbEntrypoint()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int e = pop();
|
|
|
|
int v = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(getVerbEntrypoint(v, e));
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_arrayOps()
|
|
|
|
{
|
|
|
|
int a, b, c, d, num;
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 list[128];
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
switch (fetchScriptByte()) {
|
2001-10-16 10:01:48 +00:00
|
|
|
case 205:
|
|
|
|
a = fetchScriptWord();
|
|
|
|
pop();
|
|
|
|
arrayop_1(a, NULL);
|
|
|
|
break;
|
|
|
|
case 208:
|
|
|
|
a = fetchScriptWord();
|
|
|
|
b = pop();
|
|
|
|
c = pop();
|
|
|
|
d = readVar(a);
|
2002-04-11 17:19:16 +00:00
|
|
|
if (d == 0) {
|
|
|
|
defineArray(a, 5, 0, b + c);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
while (c--) {
|
2002-04-11 17:19:16 +00:00
|
|
|
writeArray(a, 0, b + c, pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 212:
|
|
|
|
a = fetchScriptWord();
|
|
|
|
b = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
num = getStackList(list, sizeof(list) / sizeof(list[0]));
|
2001-10-16 10:01:48 +00:00
|
|
|
d = readVar(a);
|
2002-04-11 17:19:16 +00:00
|
|
|
if (d == 0)
|
2001-10-16 10:01:48 +00:00
|
|
|
error("Must DIM a two dimensional array before assigning");
|
|
|
|
c = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
while (--num >= 0) {
|
|
|
|
writeArray(a, c, b + num, list[num]);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2001-10-23 19:51:50 +00:00
|
|
|
error("o6_arrayOps: default case");
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_saveRestoreVerbs()
|
|
|
|
{
|
|
|
|
int a, b, c;
|
|
|
|
int slot, slot2;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
switch (fetchScriptByte()) {
|
2001-10-16 10:01:48 +00:00
|
|
|
case 141:
|
2002-04-11 17:19:16 +00:00
|
|
|
while (a <= b) {
|
|
|
|
slot = getVerbSlot(a, 0);
|
|
|
|
if (slot && _verbs[slot].saveid == 0) {
|
2001-10-16 10:01:48 +00:00
|
|
|
_verbs[slot].saveid = c;
|
|
|
|
drawVerb(slot, 0);
|
|
|
|
verbMouseOver(0);
|
|
|
|
}
|
|
|
|
a++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 142:
|
2002-04-11 17:19:16 +00:00
|
|
|
while (a <= b) {
|
2001-10-16 10:01:48 +00:00
|
|
|
slot = getVerbSlot(a, c);
|
|
|
|
if (slot) {
|
2002-04-11 17:19:16 +00:00
|
|
|
slot2 = getVerbSlot(a, 0);
|
2001-10-16 10:01:48 +00:00
|
|
|
if (slot2)
|
|
|
|
killVerb(slot2);
|
2002-04-11 17:19:16 +00:00
|
|
|
slot = getVerbSlot(a, c);
|
2001-10-16 10:01:48 +00:00
|
|
|
_verbs[slot].saveid = 0;
|
|
|
|
drawVerb(slot, 0);
|
|
|
|
verbMouseOver(0);
|
|
|
|
}
|
|
|
|
a++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 143:
|
2002-04-11 17:19:16 +00:00
|
|
|
while (a <= b) {
|
|
|
|
slot = getVerbSlot(a, c);
|
2001-10-16 10:01:48 +00:00
|
|
|
if (slot)
|
|
|
|
killVerb(slot);
|
|
|
|
a++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2001-10-23 19:51:50 +00:00
|
|
|
error("o6_saveRestoreVerbs: default case");
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_drawBox()
|
|
|
|
{
|
|
|
|
int x, y, x2, y2, color;
|
2001-10-16 10:01:48 +00:00
|
|
|
color = pop();
|
|
|
|
y2 = pop();
|
|
|
|
x2 = pop();
|
|
|
|
y = pop();
|
|
|
|
x = pop();
|
|
|
|
drawBox(x, y, x2, y2, color);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getActorWidth()
|
|
|
|
{
|
|
|
|
push(derefActorSafe(pop(), "o6_getActorWidth")->width);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_wait()
|
|
|
|
{
|
|
|
|
switch (fetchScriptByte()) {
|
|
|
|
case 168:{
|
2002-07-07 13:14:34 +00:00
|
|
|
int offs = (int16)fetchScriptWord();
|
2002-04-11 17:19:16 +00:00
|
|
|
if (derefActorSafe(pop(), "o6_wait")->moving) {
|
|
|
|
_scriptPointer += offs;
|
|
|
|
o6_breakHere();
|
|
|
|
}
|
|
|
|
return;
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
case 169:
|
2002-11-10 18:29:59 +00:00
|
|
|
// HACK: For Conroy Bumpus' song in Sam & Max.
|
|
|
|
// During the song three calls to o6_wait() appear,
|
|
|
|
// but because of the way in which the actor talk is done
|
|
|
|
// and the fact that the song extends beyond the span
|
|
|
|
// of each individual line, no end-of-talk is ever
|
|
|
|
// detected and the script hangs on o6_wait().
|
|
|
|
if (_gameId == GID_SAMNMAX && vm.slot[_currentScript].number == 99 && _sound->isSoundRunning (64)) {
|
|
|
|
debug (2, "Sam & Max hack: Bypassing o6_wait() during Conroy's song.");
|
|
|
|
return;
|
|
|
|
}
|
2002-07-07 13:14:34 +00:00
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
if (_vars[VAR_HAVE_MSG])
|
|
|
|
break;
|
|
|
|
return;
|
|
|
|
case 170:
|
2002-04-11 17:19:16 +00:00
|
|
|
if (!(_features & GF_AFTER_V7)) {
|
|
|
|
if (camera._cur.x >> 3 != camera._dest.x >> 3)
|
2001-12-27 17:51:58 +00:00
|
|
|
break;
|
2002-03-06 00:18:22 +00:00
|
|
|
} else {
|
2002-04-11 17:19:16 +00:00
|
|
|
if (camera._dest.x != camera._cur.x || camera._dest.y != camera._cur.y)
|
|
|
|
break;
|
2002-03-06 00:18:22 +00:00
|
|
|
}
|
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
return;
|
|
|
|
case 171:
|
2002-04-22 08:16:16 +00:00
|
|
|
printf("wait for sentence");
|
2001-11-26 19:57:57 +00:00
|
|
|
if (_sentenceNum) {
|
2002-09-22 01:17:53 +00:00
|
|
|
if (_sentence[_sentenceNum - 1].unk && !isScriptInUse(_vars[VAR_SENTENCE_SCRIPT]))
|
2001-10-16 10:01:48 +00:00
|
|
|
return;
|
|
|
|
break;
|
|
|
|
}
|
2001-11-05 19:21:49 +00:00
|
|
|
if (!isScriptInUse(_vars[VAR_SENTENCE_SCRIPT]))
|
2001-10-16 10:01:48 +00:00
|
|
|
return;
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 226:{ /* wait until actor drawn */
|
2002-10-18 04:33:46 +00:00
|
|
|
int actnum = pop();
|
|
|
|
Actor *a = derefActorSafe(actnum, "o6_wait:226");
|
2002-07-07 13:14:34 +00:00
|
|
|
int offs = (int16)fetchScriptWord();
|
2002-10-16 11:58:56 +00:00
|
|
|
|
2002-06-26 11:32:21 +00:00
|
|
|
if (a && a->isInCurrentRoom() && a->needRedraw) {
|
2002-04-11 17:19:16 +00:00
|
|
|
_scriptPointer += offs;
|
|
|
|
o6_breakHere();
|
|
|
|
}
|
|
|
|
return;
|
2001-12-27 17:51:58 +00:00
|
|
|
}
|
2002-04-11 17:19:16 +00:00
|
|
|
case 232:{ /* wait until actor stops turning */
|
|
|
|
Actor *a = derefActorSafe(pop(), "o6_wait:226");
|
2002-07-07 13:14:34 +00:00
|
|
|
int offs = (int16)fetchScriptWord();
|
2002-06-26 11:32:21 +00:00
|
|
|
if (a && a->isInCurrentRoom() && a->moving & MF_TURN) {
|
2002-04-11 17:19:16 +00:00
|
|
|
_scriptPointer += offs;
|
|
|
|
o6_breakHere();
|
|
|
|
}
|
|
|
|
return;
|
2001-12-27 17:51:58 +00:00
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
default:
|
2001-10-23 19:51:50 +00:00
|
|
|
error("o6_wait: default case");
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_scriptPointer -= 2;
|
2001-10-23 19:51:50 +00:00
|
|
|
o6_breakHere();
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getActorScaleX()
|
|
|
|
{
|
|
|
|
push(derefActorSafe(pop(), "o6_getActorScale")->scalex);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getActorAnimCounter1()
|
|
|
|
{
|
|
|
|
push(derefActorSafe(pop(), "o6_getActorAnimCounter")->cost.animCounter1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_getAnimateVariable()
|
|
|
|
{
|
2001-12-27 17:51:58 +00:00
|
|
|
int var = pop();
|
2002-05-23 00:37:00 +00:00
|
|
|
push(derefActorSafe(pop(), "o6_getAnimateVariable")->getAnimVar(var));
|
2001-12-27 17:51:58 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_soundKludge()
|
|
|
|
{
|
2001-12-04 10:44:33 +00:00
|
|
|
int16 list[16];
|
2002-04-11 17:19:16 +00:00
|
|
|
getStackList(list, sizeof(list) / sizeof(list[0]));
|
2002-05-25 19:40:42 +00:00
|
|
|
|
2002-08-14 20:43:56 +00:00
|
|
|
_sound->soundKludge(list);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_isAnyOf()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 list[100];
|
|
|
|
int num;
|
|
|
|
int16 val;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
num = getStackList(list, sizeof(list) / sizeof(list[0]));
|
2001-10-16 10:01:48 +00:00
|
|
|
val = pop();
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
while (--num >= 0) {
|
2001-10-16 10:01:48 +00:00
|
|
|
if (list[num] == val) {
|
|
|
|
push(1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
push(0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_quitPauseRestart()
|
|
|
|
{
|
|
|
|
switch (fetchScriptByte()) {
|
2001-10-16 10:01:48 +00:00
|
|
|
case 158:
|
2001-11-14 18:40:39 +00:00
|
|
|
pauseGame(false);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
case 160:
|
|
|
|
shutDown(0);
|
|
|
|
break;
|
|
|
|
default:
|
2001-10-23 19:51:50 +00:00
|
|
|
error("o6_quitPauseRestart: invalid case");
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_isActorInBox()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int box = pop();
|
2001-10-23 19:51:50 +00:00
|
|
|
Actor *a = derefActorSafe(pop(), "o6_isActorInBox");
|
2001-10-16 10:01:48 +00:00
|
|
|
push(checkXYInBoxBounds(box, a->x, a->y));
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_delay()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
uint32 delay = (uint16)pop();
|
|
|
|
vm.slot[_currentScript].delay = delay;
|
|
|
|
vm.slot[_currentScript].status = 1;
|
2001-10-23 19:51:50 +00:00
|
|
|
o6_breakHere();
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_delayLonger()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
uint32 delay = (uint16)pop() * 60;
|
|
|
|
vm.slot[_currentScript].delay = delay;
|
|
|
|
vm.slot[_currentScript].status = 1;
|
2001-10-23 19:51:50 +00:00
|
|
|
o6_breakHere();
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_delayVeryLong()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
uint32 delay = (uint16)pop() * 3600;
|
|
|
|
vm.slot[_currentScript].delay = delay;
|
|
|
|
vm.slot[_currentScript].status = 1;
|
2001-10-23 19:51:50 +00:00
|
|
|
o6_breakHere();
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_stopSentence()
|
|
|
|
{
|
2001-11-26 19:57:57 +00:00
|
|
|
_sentenceNum = 0;
|
2001-10-16 10:01:48 +00:00
|
|
|
stopScriptNr(_vars[VAR_SENTENCE_SCRIPT]);
|
|
|
|
clearClickedStatus();
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_print_0()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
_actorToPrintStrFor = 0xFF;
|
2002-04-11 17:19:16 +00:00
|
|
|
decodeParseString2(0, 0);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_print_1()
|
|
|
|
{
|
|
|
|
decodeParseString2(1, 0);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_print_2()
|
|
|
|
{
|
|
|
|
decodeParseString2(2, 0);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_print_3()
|
|
|
|
{
|
|
|
|
decodeParseString2(3, 0);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_printActor()
|
|
|
|
{
|
|
|
|
decodeParseString2(0, 1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_printEgo()
|
|
|
|
{
|
2001-10-26 17:34:50 +00:00
|
|
|
push(_vars[VAR_EGO]);
|
2002-04-11 17:19:16 +00:00
|
|
|
decodeParseString2(0, 1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_talkActor()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
_actorToPrintStrFor = pop();
|
2002-04-09 06:46:24 +00:00
|
|
|
_messagePtr = _scriptPointer;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-09-17 15:33:31 +00:00
|
|
|
if ((_gameId == GID_DIG) && (_messagePtr[0] == '/')) {
|
2002-10-06 06:09:32 +00:00
|
|
|
char pointer[20];
|
|
|
|
int i, j;
|
|
|
|
|
2002-11-06 14:19:50 +00:00
|
|
|
_scriptPointer += resStrLen((char*)_scriptPointer) + 1;
|
|
|
|
translateText(_messagePtr, _transText);
|
2002-10-06 06:09:32 +00:00
|
|
|
for (i = 0, j = 0; (_messagePtr[i] != '/' || j == 0) && j < 19; i++) {
|
|
|
|
if (_messagePtr[i] != '/')
|
|
|
|
pointer[j++] = _messagePtr[i];
|
|
|
|
}
|
|
|
|
pointer[j] = 0;
|
2002-10-20 05:37:03 +00:00
|
|
|
|
2002-10-20 16:25:43 +00:00
|
|
|
// Stop any talking that's still going on
|
|
|
|
if (_sound->_talkChannel > -1)
|
|
|
|
_mixer->stop(_sound->_talkChannel);
|
|
|
|
|
2002-10-18 11:45:57 +00:00
|
|
|
_sound->_talkChannel = _sound->playBundleSound(pointer);
|
2002-11-06 14:19:50 +00:00
|
|
|
_messagePtr = _transText;
|
2002-09-17 15:33:31 +00:00
|
|
|
setStringVars(0);
|
|
|
|
actorTalk();
|
|
|
|
} else {
|
|
|
|
setStringVars(0);
|
|
|
|
actorTalk();
|
|
|
|
_scriptPointer = _messagePtr;
|
2002-04-09 06:46:24 +00:00
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_talkEgo()
|
|
|
|
{
|
2002-02-24 17:25:03 +00:00
|
|
|
_actorToPrintStrFor = (unsigned char)_vars[VAR_EGO];
|
2001-10-16 10:01:48 +00:00
|
|
|
_messagePtr = _scriptPointer;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-09-17 15:33:31 +00:00
|
|
|
if ((_gameId == GID_DIG) && (_messagePtr[0] == '/')) {
|
2002-10-06 06:09:32 +00:00
|
|
|
char pointer[20];
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
_scriptPointer += resStrLen((char*)_scriptPointer) + 1;
|
2002-11-06 14:19:50 +00:00
|
|
|
translateText(_messagePtr, _transText);
|
2002-10-06 06:09:32 +00:00
|
|
|
for (i = 0, j = 0; (_messagePtr[i] != '/' || j == 0) && j < 19; i++) {
|
|
|
|
if (_messagePtr[i] != '/')
|
|
|
|
pointer[j++] = _messagePtr[i];
|
|
|
|
}
|
|
|
|
pointer[j] = 0;
|
2002-10-20 05:37:03 +00:00
|
|
|
|
2002-10-20 16:25:43 +00:00
|
|
|
// Stop any talking that's still going on
|
|
|
|
if (_sound->_talkChannel > -1)
|
|
|
|
_mixer->stop(_sound->_talkChannel);
|
|
|
|
|
2002-10-18 11:45:57 +00:00
|
|
|
_sound->_talkChannel = _sound->playBundleSound(pointer);
|
2002-11-06 14:19:50 +00:00
|
|
|
_messagePtr = _transText;
|
2002-09-17 15:33:31 +00:00
|
|
|
setStringVars(0);
|
|
|
|
actorTalk();
|
|
|
|
} else {
|
|
|
|
setStringVars(0);
|
|
|
|
actorTalk();
|
|
|
|
_scriptPointer = _messagePtr;
|
2002-04-09 06:46:24 +00:00
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_dim()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int data;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
switch (fetchScriptByte()) {
|
2001-10-16 10:01:48 +00:00
|
|
|
case 199:
|
|
|
|
data = 5;
|
|
|
|
break;
|
|
|
|
case 200:
|
|
|
|
data = 1;
|
|
|
|
break;
|
|
|
|
case 201:
|
|
|
|
data = 2;
|
|
|
|
break;
|
|
|
|
case 202:
|
|
|
|
data = 3;
|
|
|
|
break;
|
|
|
|
case 203:
|
|
|
|
data = 4;
|
|
|
|
break;
|
|
|
|
case 204:
|
|
|
|
nukeArray(fetchScriptWord());
|
|
|
|
return;
|
|
|
|
default:
|
2002-03-06 10:03:00 +00:00
|
|
|
error("o6_dim : default case");
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
defineArray(fetchScriptWord(), data, 0, pop());
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_runVerbCodeQuick()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 args[16];
|
2002-04-11 17:19:16 +00:00
|
|
|
int script, entryp;
|
|
|
|
getStackList(args, sizeof(args) / sizeof(args[0]));
|
2001-10-16 10:01:48 +00:00
|
|
|
entryp = pop();
|
|
|
|
script = pop();
|
|
|
|
runVerbCode(script, entryp, 0, 1, args);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_runScriptQuick()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 args[16];
|
|
|
|
int script;
|
2002-04-11 17:19:16 +00:00
|
|
|
getStackList(args, sizeof(args) / sizeof(args[0]));
|
2001-10-16 10:01:48 +00:00
|
|
|
script = pop();
|
|
|
|
runScript(script, 0, 1, args);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_dim2()
|
|
|
|
{
|
|
|
|
int a, b, data;
|
|
|
|
switch (fetchScriptByte()) {
|
2001-10-16 10:01:48 +00:00
|
|
|
case 199:
|
|
|
|
data = 5;
|
|
|
|
break;
|
|
|
|
case 200:
|
|
|
|
data = 1;
|
|
|
|
break;
|
|
|
|
case 201:
|
|
|
|
data = 2;
|
|
|
|
break;
|
|
|
|
case 202:
|
|
|
|
data = 3;
|
|
|
|
break;
|
|
|
|
case 203:
|
|
|
|
data = 4;
|
|
|
|
break;
|
|
|
|
default:
|
2001-10-23 19:51:50 +00:00
|
|
|
error("o6_dim2: default case");
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
defineArray(fetchScriptWord(), data, a, b);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_abs()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
push(abs(pop()));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_distObjectObject()
|
|
|
|
{
|
|
|
|
int a, b;
|
2001-10-16 10:01:48 +00:00
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
push(getDistanceBetween(true, a, 0, true, b, 0));
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_distObjectPt()
|
|
|
|
{
|
|
|
|
int a, b, c;
|
2001-10-16 10:01:48 +00:00
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
push(getDistanceBetween(true, a, 0, false, b, c));
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_distPtPt()
|
|
|
|
{
|
|
|
|
int a, b, c, d;
|
2001-10-16 10:01:48 +00:00
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
push(getDistanceBetween(false, a, b, false, c, d));
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_dummy_stacklist()
|
|
|
|
{
|
2001-10-23 19:51:50 +00:00
|
|
|
error("opcode o6_dummy_stacklist invalid");
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_drawBlastObject()
|
|
|
|
{
|
2001-12-27 17:51:58 +00:00
|
|
|
int16 args[16];
|
2002-04-11 17:19:16 +00:00
|
|
|
int a, b, c, d, e;
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
getStackList(args, sizeof(args) / sizeof(args[0]));
|
2001-12-27 17:51:58 +00:00
|
|
|
e = pop();
|
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
enqueueObject(a, b, c, d, e, 0xFF, 0xFF, 1, 0);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_miscOps()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 args[30];
|
|
|
|
int i;
|
2001-11-11 16:54:45 +00:00
|
|
|
Actor *a;
|
2002-04-23 18:11:36 +00:00
|
|
|
|
2002-07-07 13:14:34 +00:00
|
|
|
IMuse *se = _imuse; //yazoo: not very nice
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
getStackList(args, sizeof(args) / sizeof(args[0]));
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
if (_features & GF_AFTER_V7) {
|
|
|
|
switch (args[0]) {
|
2002-02-23 23:23:28 +00:00
|
|
|
case 4:
|
|
|
|
grabCursor(args[1], args[2], args[3], args[4]);
|
|
|
|
break;
|
2002-09-15 05:38:04 +00:00
|
|
|
case 6: {
|
2002-10-08 07:30:50 +00:00
|
|
|
// if (_imuseDigital) {
|
|
|
|
// _imuseDigital->stopAll();
|
|
|
|
// }
|
2002-09-15 05:38:04 +00:00
|
|
|
uint32 speed;
|
|
|
|
if (strcmp((char*)getStringAddressVar(VAR_VIDEONAME), "sq3.san") == 0)
|
|
|
|
speed = 71;
|
|
|
|
else
|
|
|
|
speed = 1000 / _insaneFlag;
|
2002-10-06 06:36:22 +00:00
|
|
|
|
|
|
|
debug(1, "INSANE Arg: %d", args[1]);
|
|
|
|
|
2002-10-01 18:28:26 +00:00
|
|
|
ScummRenderer * sr = new ScummRenderer(this, speed);
|
|
|
|
SmushPlayer * sp = new SmushPlayer(sr);
|
2002-10-06 06:36:22 +00:00
|
|
|
|
|
|
|
// INSANE mode 0: SMUSH movie playback
|
|
|
|
if (args[1] == 0) {
|
|
|
|
sp->play((char*)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
|
|
|
|
} else if (_gameId == GID_FT) {
|
2002-10-06 06:51:59 +00:00
|
|
|
int insaneMode = readArray(233,0,0);
|
|
|
|
debug(1, "FT_INSANE Mode: %d", insaneMode);
|
|
|
|
switch (insaneMode) {
|
2002-10-06 06:36:22 +00:00
|
|
|
case 0:
|
|
|
|
sp->play("minedriv.san", getGameDataPath());
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
sp->play("tovista2.san", getGameDataPath());
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
sp->play("tovista1.san", getGameDataPath());
|
|
|
|
break;
|
2002-11-01 17:26:51 +00:00
|
|
|
case 3: {
|
2002-11-02 11:51:44 +00:00
|
|
|
if (readArray(233,0,50) == 0) {
|
2002-11-21 14:55:33 +00:00
|
|
|
InfoDialog* dialog = new InfoDialog(_newgui, this,
|
|
|
|
"Set MineRoad - You can now jump the gorge.");
|
2002-11-02 11:51:44 +00:00
|
|
|
runDialog (dialog);
|
|
|
|
delete dialog;
|
|
|
|
|
|
|
|
writeArray(233, 0, 50, 1); // INSANE callback: Chain
|
|
|
|
writeArray(233, 0, 51, 1); // INSANE callback: Chainsaw
|
|
|
|
writeArray(233, 0, 52, 1); // INSANE callback: Mace
|
|
|
|
writeArray(233, 0, 53, 1); // INSANE callback: 2x4
|
|
|
|
writeArray(233, 0, 54, 1); // INSANE callback: Wrench
|
|
|
|
writeArray(233, 0, 55, 1); // INSANE callback: Dust
|
|
|
|
|
|
|
|
writeArray(233, 0, 8, 1); // INSANE callback: Give Googles
|
|
|
|
writeArray(233, 0, 7, 1); // INSANE callback: Give nitro fuel
|
|
|
|
|
|
|
|
putState(235, 1); // Cheat and activate Ramp
|
|
|
|
writeVar(142 | 0x8000, 1); // Cheat and activate auto-booster (fan)
|
|
|
|
}
|
2002-11-01 17:26:51 +00:00
|
|
|
// sp->play("minefite.san", getGameDataPath());
|
|
|
|
}
|
2002-10-06 06:36:22 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
sp->play("rottopen.san", getGameDataPath());
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
case 7:
|
|
|
|
case 8:
|
|
|
|
warning("FT_INSANE mode %d: Stub", args[1]);
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
sp->play("credits.san", getGameDataPath());
|
|
|
|
default:
|
|
|
|
// Other INSANE modes
|
|
|
|
warning("Unknown FT_INSANE mode for %d", args[1]);
|
|
|
|
sp->play((char*)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Other INSANE modes
|
|
|
|
warning("Unknown insane mode for %d", args[1]);
|
|
|
|
sp->play((char*)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
|
|
|
|
}
|
2002-10-01 18:28:26 +00:00
|
|
|
delete sp;
|
|
|
|
delete sr;
|
2002-08-24 15:31:37 +00:00
|
|
|
}
|
2002-09-15 05:38:04 +00:00
|
|
|
break;
|
2002-02-23 23:23:28 +00:00
|
|
|
case 7:
|
|
|
|
warning("o6_miscOps: stub7()");
|
|
|
|
break;
|
|
|
|
case 10:
|
2002-07-07 13:14:34 +00:00
|
|
|
warning("o6_miscOps: stub10(%d,%d,%d,%d)", args[1], args[2], args[3], args[4]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
warning("o6_miscOps: stub11(%d)", args[1]);
|
|
|
|
break;
|
|
|
|
case 12:
|
2002-04-11 17:19:16 +00:00
|
|
|
setCursorImg(args[1], (uint) - 1, args[2]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 13:
|
2002-08-19 17:23:48 +00:00
|
|
|
derefActorSafe(args[1], "o6_miscOps:14")->remapActorPalette(args[2], args[3], args[4], -1);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 14:
|
2002-08-19 17:23:48 +00:00
|
|
|
derefActorSafe(args[1], "o6_miscOps:14")->remapActorPalette(args[2], args[3], args[4], args[5]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 15:
|
2002-03-25 12:26:37 +00:00
|
|
|
_insaneFlag = args[1];
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
2002-04-08 13:55:03 +00:00
|
|
|
case 16:
|
2002-05-25 08:53:08 +00:00
|
|
|
if (_gameId == GID_DIG) {
|
2002-09-17 15:33:31 +00:00
|
|
|
byte buf[200];
|
|
|
|
_msgPtrToAdd = buf;
|
|
|
|
setStringVars(0);
|
2002-07-10 06:18:32 +00:00
|
|
|
addMessageToStack(getStringAddressVar(VAR_STRING2DRAW));
|
2002-11-06 14:19:50 +00:00
|
|
|
if (strncmp("/SYSTEM.007/ /", (char *)buf, 14) == 0) {
|
|
|
|
translateText(buf + 13, charset._buffer);
|
2002-10-16 12:23:03 +00:00
|
|
|
//description();
|
2002-11-06 14:19:50 +00:00
|
|
|
} else if (strncmp("/SYSTEM.007/ ", (char *)buf, 13) == 0) {
|
|
|
|
strcpy((char *)charset._buffer, (char *)buf + 13);
|
2002-10-16 12:23:03 +00:00
|
|
|
//description();
|
2002-05-25 08:53:08 +00:00
|
|
|
}
|
2002-10-06 06:09:32 +00:00
|
|
|
} else {
|
|
|
|
setStringVars(0);
|
|
|
|
|
2002-10-06 06:47:01 +00:00
|
|
|
_string[0].charset = (byte)args[1];
|
|
|
|
_string[0].color = (byte)args[2];
|
|
|
|
_string[0].xpos = args[3];
|
|
|
|
_string[0].ypos = args[4];
|
2002-10-06 07:23:08 +00:00
|
|
|
drawDescString(getStringAddressVar(VAR_STRING2DRAW));
|
2002-05-25 08:53:08 +00:00
|
|
|
}
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 17:
|
2002-07-07 13:14:34 +00:00
|
|
|
warning("o6_miscOps: stub17(%d,%d,%d,%d)", args[1], args[2], args[3], args[4]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 18:
|
|
|
|
warning("o6_miscOps: stub18(%d,%d)", args[1], args[2]);
|
|
|
|
break;
|
|
|
|
case 107:
|
|
|
|
a = derefActorSafe(args[1], "o6_miscops: 107");
|
2002-02-24 17:25:03 +00:00
|
|
|
a->scalex = (unsigned char)args[2];
|
2002-02-23 23:23:28 +00:00
|
|
|
a->needBgReset = true;
|
|
|
|
a->needRedraw = true;
|
|
|
|
break;
|
|
|
|
case 108:
|
2002-07-07 13:14:34 +00:00
|
|
|
setupShadowPalette(args[1], args[2], args[3], args[4], args[5], args[6]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 109:
|
2002-04-11 17:19:16 +00:00
|
|
|
setupShadowPalette(0, args[1], args[2], args[3], args[4], args[5]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 114:
|
|
|
|
warning("o6_miscOps: stub114()");
|
|
|
|
break;
|
|
|
|
case 117:
|
|
|
|
freezeScripts(2);
|
|
|
|
break;
|
|
|
|
case 118:
|
2002-07-07 13:14:34 +00:00
|
|
|
enqueueObject(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], 3);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 119:
|
2002-07-07 13:14:34 +00:00
|
|
|
enqueueObject(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], 0);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 120:
|
|
|
|
warning("o6_miscOps: stub120(%d,%d)", args[1], args[2]);
|
|
|
|
break;
|
|
|
|
case 124:
|
|
|
|
warning("o6_miscOps: stub124(%d)", args[1]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
2002-04-11 17:19:16 +00:00
|
|
|
switch (args[0]) {
|
2002-02-23 23:23:28 +00:00
|
|
|
case 3:
|
|
|
|
warning("o6_miscOps: nothing in 3");
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
grabCursor(args[1], args[2], args[3], args[4]);
|
|
|
|
break;
|
|
|
|
case 5:
|
2002-07-13 14:07:37 +00:00
|
|
|
fadeOut(args[1]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
_fullRedraw = 1;
|
|
|
|
redrawBGAreas();
|
2002-04-11 17:19:16 +00:00
|
|
|
for (i = 0; i < NUM_ACTORS; i++)
|
2002-02-23 23:23:28 +00:00
|
|
|
derefActor(i)->needRedraw = true;
|
|
|
|
processActors();
|
2002-07-13 14:07:37 +00:00
|
|
|
fadeIn(args[1]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
startManiac();
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
unkMiscOp9();
|
|
|
|
break;
|
2001-11-11 16:54:45 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
case 104: /* samnmax */
|
2002-02-23 23:23:28 +00:00
|
|
|
nukeFlObjects(args[2], args[3]);
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-02-23 23:23:28 +00:00
|
|
|
case 106:
|
|
|
|
error("stub o6_miscOps_106()");
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
|
|
|
case 107: /* set actor scale */
|
2002-02-23 23:23:28 +00:00
|
|
|
a = derefActorSafe(args[1], "o6_miscops: 107");
|
2002-02-24 17:25:03 +00:00
|
|
|
a->scalex = (unsigned char)args[2];
|
2002-02-23 23:23:28 +00:00
|
|
|
a->needBgReset = true;
|
|
|
|
a->needRedraw = true;
|
|
|
|
break;
|
2001-11-11 16:54:45 +00:00
|
|
|
|
2002-04-19 12:38:03 +00:00
|
|
|
case 108: /* create proc_special_palette */
|
2002-02-23 23:23:28 +00:00
|
|
|
case 109:
|
2002-04-20 04:09:02 +00:00
|
|
|
|
2002-07-07 13:14:34 +00:00
|
|
|
createSpecialPalette(args[1], args[2], args[3], args[4], args[5], 0, 256);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
2001-11-11 16:54:45 +00:00
|
|
|
|
2002-02-23 23:23:28 +00:00
|
|
|
case 110:
|
|
|
|
gdi.clearUpperMask();
|
|
|
|
break;
|
2001-11-11 16:54:45 +00:00
|
|
|
|
2002-02-23 23:23:28 +00:00
|
|
|
case 111:
|
|
|
|
a = derefActorSafe(args[1], "o6_miscops: 111");
|
|
|
|
a->shadow_mode = args[2] + args[3];
|
|
|
|
break;
|
2001-11-11 16:54:45 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
case 112: /* palette shift? */
|
2002-04-20 09:30:04 +00:00
|
|
|
createSpecialPalette(args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-07-26 17:03:03 +00:00
|
|
|
case 114:
|
|
|
|
// Sam & Max film noir mode
|
2002-07-28 01:40:24 +00:00
|
|
|
if (_gameId == GID_SAMNMAX) {
|
|
|
|
// At this point ScummVM will already have set
|
|
|
|
// variable 0x8000 to indicate that the game is
|
|
|
|
// in film noir mode. All we have to do here is
|
2002-10-19 22:35:22 +00:00
|
|
|
// to mark the palette as "dirty", because
|
|
|
|
// updatePalette() will desaturate the colors
|
|
|
|
// as they are uploaded to the backend.
|
2002-07-28 01:40:24 +00:00
|
|
|
//
|
2002-10-19 22:35:22 +00:00
|
|
|
// This actually works better than the original
|
|
|
|
// interpreter, where actors would sometimes
|
|
|
|
// still be drawn in color.
|
2002-07-28 01:40:24 +00:00
|
|
|
setDirtyColors(0, 255);
|
|
|
|
} else
|
2002-07-26 17:03:03 +00:00
|
|
|
warning("stub o6_miscOps_114()");
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-02-23 23:23:28 +00:00
|
|
|
case 117:
|
2002-03-06 12:24:56 +00:00
|
|
|
warning("stub o6_miscOps_117()");
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
2001-11-11 16:54:45 +00:00
|
|
|
|
2002-02-23 23:23:28 +00:00
|
|
|
case 118:
|
|
|
|
error("stub o6_miscOps_118(%d,%d,%d,%d,%d,%d,%d)",
|
2002-04-11 17:19:16 +00:00
|
|
|
args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-02-23 23:23:28 +00:00
|
|
|
case 119:
|
2002-07-07 13:14:34 +00:00
|
|
|
enqueueObject(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], 0);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
2001-11-11 16:54:45 +00:00
|
|
|
|
2002-02-23 23:23:28 +00:00
|
|
|
case 120:
|
2002-04-11 17:19:16 +00:00
|
|
|
swapPalColors(args[1], args[2]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
2001-11-11 16:54:45 +00:00
|
|
|
|
2002-02-23 23:23:28 +00:00
|
|
|
case 121:
|
|
|
|
error("stub o6_miscOps_121(%d)", args[1]);
|
2002-04-11 17:19:16 +00:00
|
|
|
break;
|
2001-11-11 16:54:45 +00:00
|
|
|
|
2002-02-23 23:23:28 +00:00
|
|
|
case 122:
|
2002-04-23 18:11:36 +00:00
|
|
|
|
2002-07-07 13:14:34 +00:00
|
|
|
_vars[VAR_SOUNDRESULT] =
|
|
|
|
(short)se->do_command(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]
|
|
|
|
);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
2001-11-11 16:54:45 +00:00
|
|
|
|
2002-02-23 23:23:28 +00:00
|
|
|
case 123:
|
2002-09-23 15:43:29 +00:00
|
|
|
copyPalColor(args[2], args[1]);
|
2002-03-07 04:29:24 +00:00
|
|
|
break;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
case 124: /* samnmax */
|
2002-03-07 04:29:24 +00:00
|
|
|
warning("o6_miscOps: _saveSound=%d", args[1]);
|
|
|
|
_saveSound = args[1];
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
2001-11-11 16:54:45 +00:00
|
|
|
|
2002-02-23 23:23:28 +00:00
|
|
|
default:
|
|
|
|
error("o6_miscOps: default case %d", args[0]);
|
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_kernelFunction()
|
|
|
|
{
|
2001-11-26 19:57:57 +00:00
|
|
|
int16 args[30];
|
|
|
|
int i;
|
|
|
|
Actor *a;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
getStackList(args, sizeof(args) / sizeof(args[0]));
|
2002-11-20 00:52:07 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
switch (args[0]) {
|
2002-03-07 04:29:24 +00:00
|
|
|
case 113:
|
2002-09-23 15:43:29 +00:00
|
|
|
// This is used for the Sam & Max paint-by-numbers mini-game
|
|
|
|
// to find out what color to change. I think that what we have
|
|
|
|
// the virtual mouse coordinates, because that's what used
|
|
|
|
// everywhere else in the script.
|
|
|
|
|
|
|
|
if (args[1] != -1 && args[2] != -1) {
|
|
|
|
VirtScreen *vs = &virtscr[0];
|
|
|
|
push(vs->screenPtr[args[1] + args[2] * vs->width]);
|
|
|
|
} else
|
|
|
|
push(0);
|
2002-03-07 04:29:24 +00:00
|
|
|
break;
|
2001-11-26 19:57:57 +00:00
|
|
|
case 115:
|
2002-04-25 08:53:10 +00:00
|
|
|
push(getSpecialBox(args[1], args[2]));
|
2001-11-26 19:57:57 +00:00
|
|
|
break;
|
|
|
|
case 116:
|
|
|
|
push(checkXYInBoxBounds(args[3], args[1], args[2]));
|
|
|
|
break;
|
|
|
|
case 206:
|
2002-04-11 17:19:16 +00:00
|
|
|
push(remapPaletteColor(args[1], args[2], args[3], (uint) - 1));
|
2001-11-26 19:57:57 +00:00
|
|
|
break;
|
|
|
|
case 207:
|
2002-11-02 12:39:42 +00:00
|
|
|
i = getObjectIndex(args[1]);
|
2001-11-26 19:57:57 +00:00
|
|
|
push(_objs[i].x_pos);
|
|
|
|
break;
|
|
|
|
case 208:
|
2002-11-02 12:39:42 +00:00
|
|
|
i = getObjectIndex(args[1]);
|
2001-11-26 19:57:57 +00:00
|
|
|
push(_objs[i].y_pos);
|
|
|
|
break;
|
|
|
|
case 209:
|
2002-11-02 12:39:42 +00:00
|
|
|
i = getObjectIndex(args[1]);
|
2001-11-26 19:57:57 +00:00
|
|
|
push(_objs[i].width);
|
|
|
|
break;
|
|
|
|
case 210:
|
2002-11-02 12:39:42 +00:00
|
|
|
i = getObjectIndex(args[1]);
|
2001-11-26 19:57:57 +00:00
|
|
|
push(_objs[i].height);
|
|
|
|
break;
|
|
|
|
case 211:
|
2002-04-25 08:53:10 +00:00
|
|
|
/*
|
2002-07-07 13:14:34 +00:00
|
|
|
13 = thrust
|
|
|
|
336 = thrust
|
|
|
|
328 = thrust
|
|
|
|
27 = abord
|
|
|
|
97 = left
|
|
|
|
331 = left
|
|
|
|
115 = right
|
|
|
|
333 = tight
|
|
|
|
*/
|
2002-09-21 17:51:52 +00:00
|
|
|
|
|
|
|
//FIXME: this is hack to allow turn on light bridge,
|
|
|
|
//How to check is left button pressed ?
|
|
|
|
if ((_gameId == GID_DIG) && (args[1] == 13)) {
|
|
|
|
push(1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-11-02 12:39:42 +00:00
|
|
|
warning("o6_kernelFunction: getInput(%d) against %d", args[1], _lastKeyHit);
|
2001-11-26 19:57:57 +00:00
|
|
|
push(0);
|
|
|
|
break;
|
|
|
|
case 212:
|
|
|
|
a = derefActorSafe(args[1], "o6_kernelFunction:212");
|
2002-10-23 00:22:55 +00:00
|
|
|
// FIXME - frame is never set and thus always 0! See actor.h comment
|
2001-11-26 19:57:57 +00:00
|
|
|
push(a->frame);
|
|
|
|
break;
|
2002-03-06 09:40:21 +00:00
|
|
|
case 215:
|
2002-09-07 19:55:16 +00:00
|
|
|
if ((_extraBoxFlags[args[1]] & 0x00FF) == 0x00C0) {
|
2002-03-06 09:40:21 +00:00
|
|
|
push(_extraBoxFlags[args[1]]);
|
2002-04-11 17:19:16 +00:00
|
|
|
} else {
|
|
|
|
byte *temp = (byte *)getBoxBaseAddr(args[1]);
|
|
|
|
push((byte)(*(temp + 17)));
|
2002-03-06 09:40:21 +00:00
|
|
|
}
|
|
|
|
break;
|
2001-11-26 19:57:57 +00:00
|
|
|
default:
|
|
|
|
error("o6_kernelFunction: default case %d", args[0]);
|
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2002-08-25 11:35:13 +00:00
|
|
|
void Scumm::o6_delayFrames()
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
ScriptSlot *ss = &vm.slot[_currentScript];
|
2002-08-25 11:35:13 +00:00
|
|
|
if (ss->delayFrameCount== 0) {
|
|
|
|
ss->delayFrameCount = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
} else {
|
2002-08-25 11:35:13 +00:00
|
|
|
ss->delayFrameCount--;
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
2002-08-25 11:35:13 +00:00
|
|
|
if (ss->delayFrameCount) {
|
2001-10-16 10:01:48 +00:00
|
|
|
_scriptPointer--;
|
2001-10-23 19:51:50 +00:00
|
|
|
o6_breakHere();
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_pickOneOf()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 args[100];
|
2002-04-11 17:19:16 +00:00
|
|
|
int i, num;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
num = getStackList(args, sizeof(args) / sizeof(args[0]));
|
2001-10-16 10:01:48 +00:00
|
|
|
i = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
if (i < 0 || i >= num)
|
2001-10-23 19:51:50 +00:00
|
|
|
error("o6_pickOneOf: out of range");
|
2001-10-16 10:01:48 +00:00
|
|
|
push(args[i]);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::o6_pickOneOfDefault()
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 args[100];
|
2002-04-11 17:19:16 +00:00
|
|
|
int i, num, def;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
|
|
|
def = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
num = getStackList(args, sizeof(args) / sizeof(args[0]));
|
2001-10-16 10:01:48 +00:00
|
|
|
i = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
if (i < 0 || i >= num)
|
2001-10-16 10:01:48 +00:00
|
|
|
i = def;
|
|
|
|
else
|
|
|
|
i = args[i];
|
|
|
|
push(i);
|
|
|
|
}
|
|
|
|
|
2002-05-20 14:28:02 +00:00
|
|
|
void Scumm::o6_getActorPriority()
|
|
|
|
{
|
|
|
|
Actor *a;
|
|
|
|
|
|
|
|
a = derefActorSafe(pop(), "getActorPriority");
|
|
|
|
|
|
|
|
push(a->layer);
|
|
|
|
}
|
|
|
|
|
2002-10-16 10:59:29 +00:00
|
|
|
void Scumm::o6_unknownCD() {
|
2002-10-16 11:00:48 +00:00
|
|
|
// Full Throttle: FIXME
|
|
|
|
// Opcode is used when placing the bunny into the
|
|
|
|
// mine field. Some kind of drawBlastObject() wrapper
|
2002-10-16 10:59:29 +00:00
|
|
|
int a, b, c, d;
|
|
|
|
a = pop();
|
|
|
|
b = pop();
|
|
|
|
c = pop();
|
|
|
|
d = pop();
|
|
|
|
warning("o6_unknownCD: stub(%d, %d, %d, %d)", a, b, c, d);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::decodeParseString2(int m, int n)
|
|
|
|
{
|
2001-10-16 10:01:48 +00:00
|
|
|
byte b;
|
|
|
|
|
|
|
|
b = fetchScriptByte();
|
2002-04-11 17:19:16 +00:00
|
|
|
|
|
|
|
switch (b) {
|
2001-10-16 10:01:48 +00:00
|
|
|
case 65:
|
2002-09-22 01:17:53 +00:00
|
|
|
_string[m].ypos = pop();
|
|
|
|
_string[m].xpos = pop();
|
|
|
|
_string[m].overhead = false;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
case 66:
|
2002-09-22 01:17:53 +00:00
|
|
|
_string[m].color = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
case 67:
|
2002-09-22 01:17:53 +00:00
|
|
|
_string[m].right = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
case 69:
|
2002-09-22 01:17:53 +00:00
|
|
|
_string[m].center = true;
|
|
|
|
_string[m].overhead = false;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
case 71:
|
2002-09-22 01:17:53 +00:00
|
|
|
_string[m].center = false;
|
|
|
|
_string[m].overhead = false;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
case 72:
|
2002-09-22 01:17:53 +00:00
|
|
|
_string[m].overhead = true;
|
|
|
|
_string[m].no_talk_anim = false;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
case 73:
|
|
|
|
error("decodeParseString2: case 73");
|
|
|
|
break;
|
|
|
|
case 74:
|
2002-09-22 01:17:53 +00:00
|
|
|
_string[m].no_talk_anim = true;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 75:{
|
|
|
|
_messagePtr = _scriptPointer;
|
|
|
|
|
2002-09-17 15:33:31 +00:00
|
|
|
if ((_messagePtr[0] == '/') && (_gameId == GID_DIG)) {
|
2002-10-20 05:37:03 +00:00
|
|
|
char pointer[20];
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
_scriptPointer += resStrLen((char*)_scriptPointer)+ 1;
|
2002-11-06 14:19:50 +00:00
|
|
|
translateText(_messagePtr, _transText);
|
2002-10-20 05:37:03 +00:00
|
|
|
for (i = 0, j = 0; (_messagePtr[i] != '/' || j == 0) && j < 19; i++) {
|
|
|
|
if (_messagePtr[i] != '/')
|
|
|
|
pointer[j++] = _messagePtr[i];
|
|
|
|
}
|
|
|
|
pointer[j] = 0;
|
|
|
|
|
2002-10-20 16:25:43 +00:00
|
|
|
// Stop any talking that's still going on
|
|
|
|
if (_sound->_talkChannel > -1)
|
|
|
|
_mixer->stop(_sound->_talkChannel);
|
|
|
|
|
2002-10-20 05:41:30 +00:00
|
|
|
_sound->_talkChannel = _sound->playBundleSound(pointer);
|
2002-11-06 14:19:50 +00:00
|
|
|
_messagePtr = _transText;
|
2002-10-20 05:37:03 +00:00
|
|
|
|
2002-09-17 15:33:31 +00:00
|
|
|
switch (m) {
|
|
|
|
case 0:
|
|
|
|
actorTalk();
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
drawString(1);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
unkMessage1();
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
unkMessage2();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
switch (m) {
|
|
|
|
case 0:
|
|
|
|
actorTalk();
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
drawString(1);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
unkMessage1();
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
unkMessage2();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
_scriptPointer = _messagePtr;
|
|
|
|
return;
|
2002-04-11 17:19:16 +00:00
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
case 0xFE:
|
|
|
|
setStringVars(m);
|
|
|
|
if (n)
|
|
|
|
_actorToPrintStrFor = pop();
|
|
|
|
return;
|
|
|
|
case 0xFF:
|
2002-09-22 01:17:53 +00:00
|
|
|
_string[m].t_xpos = _string[m].xpos;
|
|
|
|
_string[m].t_ypos = _string[m].ypos;
|
|
|
|
_string[m].t_center = _string[m].center;
|
|
|
|
_string[m].t_overhead = _string[m].overhead;
|
|
|
|
_string[m].t_no_talk_anim = _string[m].no_talk_anim;
|
|
|
|
_string[m].t_right = _string[m].right;
|
|
|
|
_string[m].t_color = _string[m].color;
|
|
|
|
_string[m].t_charset = _string[m].charset;
|
2001-10-16 10:01:48 +00:00
|
|
|
return;
|
|
|
|
default:
|
|
|
|
error("decodeParseString: default case");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-07 13:14:34 +00:00
|
|
|
void Scumm::setupShadowPalette(int slot, int rfact, int gfact, int bfact, int from, int to)
|
2002-03-22 10:56:03 +00:00
|
|
|
{
|
2002-05-20 14:28:02 +00:00
|
|
|
byte *table;
|
|
|
|
int i, num;
|
|
|
|
byte *curpal;
|
|
|
|
|
|
|
|
if (slot < 0 || slot > 7)
|
|
|
|
error("setupShadowPalette: invalid slot %d", slot);
|
|
|
|
|
|
|
|
if (from < 0 || from > 255 || to < 0 || from > 255 || to < from)
|
|
|
|
error("setupShadowPalette: invalid range from %d to %d", from, to);
|
|
|
|
|
|
|
|
table = _shadowPalette + slot * 256;
|
|
|
|
for (i = 0; i < 256; i++)
|
|
|
|
table[i] = i;
|
|
|
|
|
|
|
|
table += from;
|
|
|
|
curpal = _currentPalette + from * 3;
|
|
|
|
num = to - from + 1;
|
|
|
|
do {
|
|
|
|
*table++ = remapPaletteColor((curpal[0] * rfact) >> 8,
|
2002-07-07 13:14:34 +00:00
|
|
|
curpal[1] * gfact >> 8, curpal[2] * bfact >> 8, (uint) - 1);
|
2002-05-20 14:28:02 +00:00
|
|
|
curpal += 3;
|
|
|
|
} while (--num);
|
2002-03-22 10:56:03 +00:00
|
|
|
}
|