2003-04-20 16:04:50 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
|
|
|
* Copyright (C) 2001-2003 The ScummVM project
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "scumm.h"
|
|
|
|
#include "actor.h"
|
|
|
|
#include "charset.h"
|
|
|
|
#include "intern.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "verbs.h"
|
|
|
|
|
|
|
|
#define OPCODE(x) { &Scumm_v2::x, #x }
|
|
|
|
|
|
|
|
void Scumm_v2::setupOpcodes() {
|
|
|
|
static const OpcodeEntryV2 opcodes[256] = {
|
|
|
|
/* 00 */
|
|
|
|
OPCODE(o5_stopObjectCode),
|
2003-04-21 15:42:55 +00:00
|
|
|
OPCODE(o2_putActor),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_startMusic),
|
|
|
|
OPCODE(o2_getActorRoom),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 04 */
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_isGreaterEqual),
|
2003-04-21 12:31:08 +00:00
|
|
|
OPCODE(o2_drawObject),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_getActorElevation),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_setState08),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 08 */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_isNotEqual),
|
|
|
|
OPCODE(o2_faceActor),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_assignVarWordDirect),
|
|
|
|
OPCODE(o2_setObjY),
|
|
|
|
/* 0C */
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_resourceRoutines),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_walkActorToActor),
|
|
|
|
OPCODE(o2_putActorAtObject),
|
2003-04-21 15:25:29 +00:00
|
|
|
OPCODE(o2_ifNotState08),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 10 */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_getObjectOwner),
|
|
|
|
OPCODE(o2_animateActor),
|
|
|
|
OPCODE(o2_panCameraTo),
|
2003-04-20 16:59:52 +00:00
|
|
|
OPCODE(o2_actorSet),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 14 */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_print),
|
|
|
|
OPCODE(o2_actorFromPos),
|
|
|
|
OPCODE(o2_getRandomNr),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_setState04),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 18 */
|
|
|
|
OPCODE(o5_jumpRelative),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_doSentence),
|
|
|
|
OPCODE(o2_move),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_setBitVar),
|
|
|
|
/* 1C */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_startSound),
|
2003-04-21 15:25:29 +00:00
|
|
|
OPCODE(o2_ifClassOfIs),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_walkActorTo),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_ifState02),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 20 */
|
|
|
|
OPCODE(o5_stopMusic),
|
2003-04-21 15:42:55 +00:00
|
|
|
OPCODE(o2_putActor),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_saveLoadGame),
|
|
|
|
OPCODE(o2_getActorY),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 24 */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_loadRoomWithEgo),
|
|
|
|
OPCODE(o2_drawObject),
|
|
|
|
OPCODE(o2_setVarRange),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_ifNotState04),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 28 */
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_equalZero),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_setOwnerOf),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_addDirect),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_delayVariable),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 2C */
|
|
|
|
OPCODE(o2_assignVarByte),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_putActorInRoom),
|
|
|
|
OPCODE(o5_delay),
|
|
|
|
OPCODE(o2_ifNotState04),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 30 */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_matrixOps),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_getBitVar),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_setCameraAt),
|
|
|
|
OPCODE(o2_roomOps),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 34 */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_getDist),
|
|
|
|
OPCODE(o2_findObject),
|
|
|
|
OPCODE(o2_walkActorToObject),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_setState01),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 38 */
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_lessOrEqual),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_doSentence),
|
|
|
|
OPCODE(o2_subtract),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_waitForActor),
|
|
|
|
/* 3C */
|
|
|
|
OPCODE(o5_stopSound),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_getActorElevation),
|
2003-04-21 15:42:55 +00:00
|
|
|
OPCODE(o2_walkActorTo),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_ifNotState01),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 40 */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_cutscene),
|
2003-04-21 15:42:55 +00:00
|
|
|
OPCODE(o2_putActor),
|
2003-04-23 05:13:26 +00:00
|
|
|
OPCODE(o2_startScript),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_getActorX),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 44 */
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_isLess),
|
2003-04-21 12:31:08 +00:00
|
|
|
OPCODE(o2_drawObject),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_increment),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_setState08),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 48 */
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_isEqual),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_faceActor),
|
|
|
|
OPCODE(o2_chainScript),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_setObjY),
|
|
|
|
/* 4C */
|
|
|
|
OPCODE(o2_waitForSentence),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_walkActorToActor),
|
|
|
|
OPCODE(o2_putActorAtObject),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_ifState08),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 50 */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_pickupObject),
|
|
|
|
OPCODE(o2_animateActor),
|
|
|
|
OPCODE(o2_actorFollowCamera),
|
2003-04-20 17:07:25 +00:00
|
|
|
OPCODE(o2_actorSet),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 54 */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_setObjectName),
|
|
|
|
OPCODE(o2_actorFromPos),
|
|
|
|
OPCODE(o2_getActorMoving),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_setState02),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 58 */
|
2003-04-23 05:13:26 +00:00
|
|
|
OPCODE(beginOverride),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_doSentence),
|
|
|
|
OPCODE(o2_add),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_setBitVar),
|
|
|
|
/* 5C */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o5_dummy),
|
2003-04-21 15:25:29 +00:00
|
|
|
OPCODE(o2_ifClassOfIs),
|
2003-04-21 15:42:55 +00:00
|
|
|
OPCODE(o2_walkActorTo),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_ifNotState02),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 60 */
|
|
|
|
OPCODE(o5_cursorCommand),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_putActor),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o5_stopScript),
|
|
|
|
OPCODE(o5_getActorFacing),
|
|
|
|
/* 64 */
|
|
|
|
OPCODE(o5_loadRoomWithEgo),
|
|
|
|
OPCODE(o5_pickupObject),
|
|
|
|
OPCODE(o5_getClosestObjActor),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_clearState04),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 68 */
|
|
|
|
OPCODE(o5_isScriptRunning),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_setOwnerOf),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_subDirect),
|
|
|
|
OPCODE(o5_dummy),
|
|
|
|
/* 6C */
|
|
|
|
OPCODE(o2_getObjY),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_putActorInRoom),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o5_dummy),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_ifState04),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 70 */
|
|
|
|
OPCODE(o5_lights),
|
|
|
|
OPCODE(o5_getActorCostume),
|
|
|
|
OPCODE(o5_loadRoom),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_roomOps),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 74 */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_getDist),
|
|
|
|
OPCODE(o2_findObject),
|
|
|
|
OPCODE(o2_walkActorToObject),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_clearState01),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 78 */
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_isGreater),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_doSentence),
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_verbOps),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o5_getActorWalkBox),
|
|
|
|
/* 7C */
|
|
|
|
OPCODE(o5_isSoundRunning),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_getActorElevation),
|
2003-04-21 15:42:55 +00:00
|
|
|
OPCODE(o2_walkActorTo),
|
2003-04-23 05:13:26 +00:00
|
|
|
OPCODE(o2_ifNotState01),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 80 */
|
|
|
|
OPCODE(o5_breakHere),
|
2003-04-21 15:42:55 +00:00
|
|
|
OPCODE(o2_putActor),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_startMusic),
|
|
|
|
OPCODE(o2_getActorRoom),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 84 */
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_isGreaterEqual),
|
2003-04-21 12:31:08 +00:00
|
|
|
OPCODE(o2_drawObject),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_getActorElevation),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_setState08),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 88 */
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_isNotEqual),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_faceActor),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_assignVarWordDirect),
|
|
|
|
OPCODE(o2_setObjY),
|
|
|
|
/* 8C */
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_resourceRoutines),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_walkActorToActor),
|
|
|
|
OPCODE(o2_putActorAtObject),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_ifNotState08),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 90 */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_getObjectOwner),
|
|
|
|
OPCODE(o2_animateActor),
|
|
|
|
OPCODE(o2_panCameraTo),
|
2003-04-20 17:07:25 +00:00
|
|
|
OPCODE(o2_actorSet),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 94 */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_print),
|
|
|
|
OPCODE(o2_actorFromPos),
|
|
|
|
OPCODE(o2_getRandomNr),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_setState02),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 98 */
|
|
|
|
OPCODE(o2_restart),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_doSentence),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_assignVarWord),
|
|
|
|
OPCODE(o2_setBitVar),
|
|
|
|
/* 9C */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_startSound),
|
2003-04-21 15:25:29 +00:00
|
|
|
OPCODE(o2_ifClassOfIs),
|
2003-04-21 15:42:55 +00:00
|
|
|
OPCODE(o2_walkActorTo),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_ifState02),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* A0 */
|
|
|
|
OPCODE(o5_stopObjectCode),
|
2003-04-21 15:42:55 +00:00
|
|
|
OPCODE(o2_putActor),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o5_getAnimCounter),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_getActorY),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* A4 */
|
|
|
|
OPCODE(o5_loadRoomWithEgo),
|
|
|
|
OPCODE(o5_pickupObject),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_setVarRange),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_setState04),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* A8 */
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_notEqualZero),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_setOwnerOf),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_addDirect),
|
|
|
|
OPCODE(o5_dummy),
|
|
|
|
/* AC */
|
2003-04-20 16:32:44 +00:00
|
|
|
OPCODE(o5_delay),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_putActorInRoom),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_waitForSentence),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_ifNotState04),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* B0 */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_matrixOps),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_getBitVar),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_setCameraAt),
|
|
|
|
OPCODE(o2_roomOps),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* B4 */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_getDist),
|
|
|
|
OPCODE(o2_findObject),
|
|
|
|
OPCODE(o2_walkActorToObject),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_setState02),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* B8 */
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_lessOrEqual),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_doSentence),
|
|
|
|
OPCODE(o2_subtract),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_waitForActor),
|
|
|
|
/* BC */
|
|
|
|
OPCODE(o5_stopSound),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_getActorElevation),
|
2003-04-21 15:42:55 +00:00
|
|
|
OPCODE(o2_walkActorTo),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_ifNotState01),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* C0 */
|
|
|
|
OPCODE(o5_endCutscene),
|
2003-04-21 15:42:55 +00:00
|
|
|
OPCODE(o2_putActor),
|
2003-04-23 05:13:26 +00:00
|
|
|
OPCODE(o2_startScript),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_getActorX),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* C4 */
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_isLess),
|
2003-04-21 12:31:08 +00:00
|
|
|
OPCODE(o2_drawObject),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o5_decrement),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_clearState08),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* C8 */
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_isEqual),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_faceActor),
|
|
|
|
OPCODE(o2_chainScript),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_setObjY),
|
|
|
|
/* CC */
|
|
|
|
OPCODE(o5_pseudoRoom),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_walkActorToActor),
|
|
|
|
OPCODE(o2_putActorAtObject),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_ifState08),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* D0 */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_pickupObject),
|
|
|
|
OPCODE(o2_animateActor),
|
|
|
|
OPCODE(o2_actorFollowCamera),
|
2003-04-20 17:07:25 +00:00
|
|
|
OPCODE(o2_actorSet),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* D4 */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_setObjectName),
|
|
|
|
OPCODE(o2_actorFromPos),
|
|
|
|
OPCODE(o2_getActorMoving),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_setState02),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* D8 */
|
2003-04-21 14:50:48 +00:00
|
|
|
OPCODE(o2_printEgo),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_doSentence),
|
|
|
|
OPCODE(o2_add),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o5_divide),
|
|
|
|
/* DC */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o5_dummy),
|
2003-04-21 15:25:29 +00:00
|
|
|
OPCODE(o2_ifClassOfIs),
|
2003-04-21 15:42:55 +00:00
|
|
|
OPCODE(o2_walkActorTo),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_ifNotState02),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* E0 */
|
|
|
|
OPCODE(o5_cursorCommand),
|
2003-04-21 15:42:55 +00:00
|
|
|
OPCODE(o2_putActor),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o5_stopScript),
|
|
|
|
OPCODE(o5_getActorFacing),
|
|
|
|
/* E4 */
|
|
|
|
OPCODE(o5_loadRoomWithEgo),
|
|
|
|
OPCODE(o5_pickupObject),
|
|
|
|
OPCODE(o5_getClosestObjActor),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_clearState04),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* E8 */
|
|
|
|
OPCODE(o5_isScriptRunning),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_setOwnerOf),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_subDirect),
|
|
|
|
OPCODE(o5_dummy),
|
|
|
|
/* EC */
|
|
|
|
OPCODE(o2_getObjY),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_putActorInRoom),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o5_dummy),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_ifState04),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* F0 */
|
|
|
|
OPCODE(o5_lights),
|
|
|
|
OPCODE(o5_getActorCostume),
|
|
|
|
OPCODE(o5_loadRoom),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_roomOps),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* F4 */
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_getDist),
|
|
|
|
OPCODE(o2_findObject),
|
|
|
|
OPCODE(o2_walkActorToObject),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_clearState01),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* F8 */
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_isGreater),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_doSentence),
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_verbOps),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o5_getActorWalkBox),
|
|
|
|
/* FC */
|
|
|
|
OPCODE(o5_isSoundRunning),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_getActorElevation),
|
2003-04-21 15:42:55 +00:00
|
|
|
OPCODE(o2_walkActorTo),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_ifState01)
|
2003-04-20 16:04:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_opcodesV2 = opcodes;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::executeOpcode(int i) {
|
|
|
|
OpcodeProcV2 op = _opcodesV2[i].proc;
|
|
|
|
(this->*op) ();
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *Scumm_v2::getOpcodeDesc(int i) {
|
|
|
|
return _opcodesV2[i].desc;
|
|
|
|
}
|
|
|
|
|
2003-04-21 10:20:12 +00:00
|
|
|
int Scumm_v2::getVar() {
|
|
|
|
int var_id = fetchScriptByte();
|
|
|
|
if ((var_id >= 14) && (var_id <= 16))
|
|
|
|
return _vars[_vars[var_id]];
|
|
|
|
return _vars[var_id];
|
|
|
|
}
|
|
|
|
|
|
|
|
int Scumm_v2::getVarOrDirectByte(byte mask) {
|
|
|
|
if (_opcode & mask)
|
|
|
|
return getVar();
|
|
|
|
return fetchScriptByte();
|
|
|
|
}
|
|
|
|
|
|
|
|
int Scumm_v2::getVarOrDirectWord(byte mask) {
|
|
|
|
if (_opcode & mask)
|
|
|
|
return getVar();
|
|
|
|
return fetchScriptWord();
|
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::setStateCommon(byte type) {
|
2003-04-20 16:04:50 +00:00
|
|
|
int obj = getVarOrDirectWord(0x80);
|
2003-04-21 08:50:16 +00:00
|
|
|
putState(obj, getState(obj) | type);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::clearStateCommon(byte type) {
|
|
|
|
int obj = getVarOrDirectWord(0x80);
|
2003-04-21 12:31:08 +00:00
|
|
|
putState(obj, getState(obj) & ~type);
|
2003-04-21 08:50:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_setState08() {
|
|
|
|
int obj = getVarOrDirectWord(0x80);
|
|
|
|
putState(obj, getState(obj) | 0x08);
|
2003-04-20 16:04:50 +00:00
|
|
|
removeObjectFromRoom(obj);
|
|
|
|
clearDrawObjectQueue();
|
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::o2_clearState08() {
|
2003-04-20 16:04:50 +00:00
|
|
|
int obj = getVarOrDirectWord(0x80);
|
2003-04-21 12:31:08 +00:00
|
|
|
putState(obj, getState(obj) & 0xF7);
|
2003-04-20 16:04:50 +00:00
|
|
|
removeObjectFromRoom(obj);
|
|
|
|
clearDrawObjectQueue();
|
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::o2_setState04() {
|
|
|
|
setStateCommon(0x04);
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::o2_clearState04() {
|
|
|
|
clearStateCommon(0x04);
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::o2_setState02() {
|
|
|
|
setStateCommon(0x02);
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::o2_clearState02() {
|
|
|
|
clearStateCommon(0x02);
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::o2_setState01() {
|
|
|
|
setStateCommon(0x01);
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::o2_clearState01() {
|
|
|
|
clearStateCommon(0x01);
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::getResultPos() {
|
|
|
|
_resultVarNumber = fetchScriptByte();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::getResultPosDirect() {
|
|
|
|
_resultVarNumber = _vars[fetchScriptByte()];
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_assignVarWordDirect() {
|
|
|
|
getResultPosDirect();
|
|
|
|
_vars[_resultVarNumber] = fetchScriptWord();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_assignVarByteDirect() {
|
|
|
|
getResultPosDirect();
|
|
|
|
_vars[_resultVarNumber] = fetchScriptByte();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_assignVarByte() {
|
|
|
|
getResultPos();
|
|
|
|
_vars[_resultVarNumber] = fetchScriptByte();
|
|
|
|
}
|
|
|
|
|
2003-04-20 16:17:41 +00:00
|
|
|
void Scumm_v2::o2_assignVarWord() {
|
|
|
|
getResultPos();
|
|
|
|
_vars[_resultVarNumber] = fetchScriptWord();
|
|
|
|
}
|
|
|
|
|
2003-04-20 16:04:50 +00:00
|
|
|
void Scumm_v2::o2_setObjY() {
|
|
|
|
int obj = getVarOrDirectWord(0x80);
|
|
|
|
int y = fetchScriptByte();
|
|
|
|
|
|
|
|
if (whereIsObject(obj) != WIO_NOT_FOUND) {
|
|
|
|
ObjectData *od = &_objs[getObjectIndex(obj)];
|
2003-04-21 12:59:57 +00:00
|
|
|
od->walk_y = (y << 5) | (od->walk_y & 0x1F);
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_getObjY() {
|
|
|
|
int obj = getVarOrDirectWord(0x80);
|
2003-04-21 12:59:57 +00:00
|
|
|
getResultPos();
|
2003-04-20 16:04:50 +00:00
|
|
|
|
|
|
|
if (whereIsObject(obj) != WIO_NOT_FOUND) {
|
|
|
|
ObjectData *od = &_objs[getObjectIndex(obj)];
|
2003-04-21 12:59:57 +00:00
|
|
|
_vars[_resultVarNumber] = od->walk_y >> 5;
|
2003-04-20 16:04:50 +00:00
|
|
|
} else {
|
|
|
|
_vars[_resultVarNumber] = 0xFF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_setBitVar() {
|
|
|
|
byte hi = fetchScriptByte();
|
|
|
|
byte lo = fetchScriptByte();
|
|
|
|
byte a = getVarOrDirectByte(0x80);
|
|
|
|
|
|
|
|
int bit_var = (hi << 8) + lo + a;
|
|
|
|
int bit_offset = bit_var & 0x0f;
|
|
|
|
bit_var >>= 4;
|
|
|
|
|
|
|
|
if (getVarOrDirectByte(0x80))
|
2003-04-21 10:20:12 +00:00
|
|
|
_vars[bit_var] |= (1 << bit_offset);
|
2003-04-20 16:04:50 +00:00
|
|
|
else
|
2003-04-21 10:20:12 +00:00
|
|
|
_vars[bit_var] &= ~(1 << bit_offset);
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_getBitVar() {
|
|
|
|
getResultPos();
|
|
|
|
byte hi = fetchScriptByte();
|
|
|
|
byte lo = fetchScriptByte();
|
|
|
|
byte a = getVarOrDirectByte(0x80);
|
|
|
|
|
|
|
|
int bit_var = (hi << 8) + lo + a;
|
|
|
|
int bit_offset = bit_var & 0x0f;
|
|
|
|
bit_var >>= 4;
|
|
|
|
|
2003-04-21 10:20:12 +00:00
|
|
|
_vars[_resultVarNumber] = (_vars[bit_var] & (1 << bit_offset)) ? 1 : 0;
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::ifStateCommon(byte type) {
|
2003-04-20 16:04:50 +00:00
|
|
|
int obj = getVarOrDirectWord(0x80);
|
|
|
|
|
|
|
|
if ((getState(obj) & type) == 0)
|
|
|
|
o5_jumpRelative();
|
|
|
|
else
|
|
|
|
ignoreScriptWord();
|
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::ifNotStateCommon(byte type) {
|
2003-04-20 16:04:50 +00:00
|
|
|
int obj = getVarOrDirectWord(0x80);
|
|
|
|
|
|
|
|
if ((getState(obj) & type) != 0)
|
|
|
|
o5_jumpRelative();
|
|
|
|
else
|
|
|
|
ignoreScriptWord();
|
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::o2_ifState08() {
|
|
|
|
ifStateCommon(0x08);
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::o2_ifNotState08() {
|
|
|
|
ifNotStateCommon(0x08);
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::o2_ifState04() {
|
|
|
|
ifStateCommon(0x04);
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::o2_ifNotState04() {
|
|
|
|
ifNotStateCommon(0x04);
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::o2_ifState02() {
|
|
|
|
ifStateCommon(0x02);
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::o2_ifNotState02() {
|
|
|
|
ifNotStateCommon(0x02);
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::o2_ifState01() {
|
|
|
|
ifStateCommon(0x01);
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 08:50:16 +00:00
|
|
|
void Scumm_v2::o2_ifNotState01() {
|
|
|
|
ifNotStateCommon(0x01);
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_addDirect() {
|
|
|
|
int a;
|
|
|
|
getResultPosDirect();
|
|
|
|
a = getVarOrDirectWord(0x80);
|
2003-04-21 12:59:57 +00:00
|
|
|
_vars[_resultVarNumber] += a;
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_subDirect() {
|
|
|
|
int a;
|
|
|
|
getResultPosDirect();
|
|
|
|
a = getVarOrDirectWord(0x80);
|
2003-04-21 12:59:57 +00:00
|
|
|
_vars[_resultVarNumber] -= a;
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_waitForActor() {
|
2003-04-21 12:59:57 +00:00
|
|
|
if (derefActorSafe(getVarOrDirectByte(0x80), "o2_waitForActor")->moving) {
|
|
|
|
_scriptPointer -= 2;
|
2003-04-20 16:04:50 +00:00
|
|
|
o5_breakHere();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-20 16:59:52 +00:00
|
|
|
void Scumm_v2::o2_actorSet() {
|
2003-04-20 17:07:25 +00:00
|
|
|
int act = getVarOrDirectByte(0x80);
|
|
|
|
int arg = getVarOrDirectByte(0x40);
|
|
|
|
Actor *a = derefActorSafe(act, "actorSet");
|
2003-04-21 09:03:17 +00:00
|
|
|
int i;
|
2003-04-20 17:07:25 +00:00
|
|
|
|
|
|
|
if (!a)
|
|
|
|
return;
|
2003-04-20 16:59:52 +00:00
|
|
|
|
|
|
|
switch (fetchScriptByte()) {
|
2003-04-20 17:07:25 +00:00
|
|
|
case 1: // Actor Sound
|
|
|
|
a->sound[0] = arg;
|
2003-04-20 16:59:52 +00:00
|
|
|
break;
|
|
|
|
|
2003-04-21 09:03:17 +00:00
|
|
|
case 2: // Actor Set Color
|
|
|
|
i = fetchScriptByte();
|
|
|
|
a->palette[i] = arg;
|
|
|
|
a->needRedraw = true;
|
2003-04-20 16:59:52 +00:00
|
|
|
break;
|
|
|
|
|
2003-04-20 17:07:25 +00:00
|
|
|
case 3: // Actor Name
|
|
|
|
loadPtrToResource(rtActorName, a->number, NULL);
|
2003-04-20 16:59:52 +00:00
|
|
|
break;
|
|
|
|
|
2003-04-20 17:07:25 +00:00
|
|
|
case 4: // Actor Costume
|
|
|
|
a->setActorCostume(arg);
|
2003-04-20 16:59:52 +00:00
|
|
|
break;
|
|
|
|
|
2003-04-20 17:07:25 +00:00
|
|
|
case 5: // Talk Color
|
|
|
|
a->talkColor = arg;
|
2003-04-20 16:59:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-20 16:04:50 +00:00
|
|
|
void Scumm_v2::o2_waitForSentence() {
|
2003-04-21 12:59:57 +00:00
|
|
|
if (_sentenceNum)
|
|
|
|
if (!isScriptInUse(2))
|
2003-04-20 16:04:50 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
_scriptPointer--;
|
|
|
|
o5_breakHere();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_restart() {
|
|
|
|
}
|
2003-04-20 16:59:52 +00:00
|
|
|
|
2003-04-21 12:31:08 +00:00
|
|
|
void Scumm_v2::o2_drawObject() {
|
|
|
|
int obj, idx, i;
|
|
|
|
ObjectData *od;
|
|
|
|
uint16 x, y, w, h;
|
|
|
|
int xpos, ypos;
|
2003-04-20 16:59:52 +00:00
|
|
|
|
2003-04-21 12:31:08 +00:00
|
|
|
obj = getVarOrDirectWord(0x80);
|
|
|
|
xpos = getVarOrDirectWord(0x40);
|
|
|
|
ypos = getVarOrDirectWord(0x20);
|
|
|
|
|
|
|
|
idx = getObjectIndex(obj);
|
|
|
|
if (idx == -1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
od = &_objs[idx];
|
|
|
|
if (xpos != 0xFF) {
|
|
|
|
od->walk_x += (xpos << 3) - od->x_pos;
|
|
|
|
od->x_pos = xpos << 3;
|
|
|
|
od->walk_y += (ypos << 3) - od->y_pos;
|
|
|
|
od->y_pos = ypos << 3;
|
|
|
|
}
|
|
|
|
addObjectToDrawQue(idx);
|
|
|
|
|
|
|
|
x = od->x_pos;
|
|
|
|
y = od->y_pos;
|
|
|
|
w = od->width;
|
|
|
|
h = od->height;
|
|
|
|
|
|
|
|
i = _numLocalObjects;
|
|
|
|
do {
|
|
|
|
if (_objs[i].obj_nr && _objs[i].x_pos == x && _objs[i].y_pos == y && _objs[i].width == w && _objs[i].height == h)
|
|
|
|
putState(_objs[i].obj_nr, getState(_objs[i].obj_nr) & 0xF7);
|
|
|
|
} while (--i);
|
|
|
|
|
|
|
|
putState(obj, getState(_objs[obj].obj_nr) | 0x08);
|
|
|
|
}
|
2003-04-21 14:09:16 +00:00
|
|
|
|
|
|
|
void Scumm_v2::o2_resourceRoutines() {
|
2003-04-21 14:20:18 +00:00
|
|
|
int resid = getVarOrDirectByte(0x80);
|
|
|
|
int opcode = fetchScriptByte();
|
2003-04-21 14:09:16 +00:00
|
|
|
|
2003-04-21 14:20:18 +00:00
|
|
|
if (((opcode & 0x0f) == 0) || ((opcode & 0x0f) == 1)) {
|
|
|
|
switch (opcode & 0xf1) {
|
|
|
|
case 96:
|
|
|
|
lock(rtSound, resid);
|
|
|
|
return;
|
|
|
|
case 97:
|
|
|
|
unlock(rtSound, resid);
|
|
|
|
return;
|
|
|
|
case 80:
|
|
|
|
lock(rtScript, resid);
|
|
|
|
return;
|
|
|
|
case 81:
|
|
|
|
unlock(rtScript, resid);
|
|
|
|
return;
|
|
|
|
case 32:
|
|
|
|
lock(rtCostume, resid);
|
|
|
|
return;
|
|
|
|
case 33:
|
|
|
|
unlock(rtCostume, resid);
|
|
|
|
return;
|
|
|
|
case 48:
|
|
|
|
lock(rtRoom, resid);
|
|
|
|
return;
|
|
|
|
case 49:
|
|
|
|
unlock(rtRoom, resid);
|
|
|
|
return;
|
|
|
|
default:
|
|
|
|
error("o2_resourceRoutines: unknown lock/unlock opcode");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (opcode & 0xf1) {
|
|
|
|
case 96:
|
|
|
|
case 80:
|
|
|
|
case 32:
|
|
|
|
case 48:
|
|
|
|
return;
|
|
|
|
case 97:
|
|
|
|
ensureResourceLoaded(rtSound, resid);
|
|
|
|
return;
|
|
|
|
case 81:
|
|
|
|
ensureResourceLoaded(rtScript, resid);
|
|
|
|
return;
|
|
|
|
case 33:
|
|
|
|
ensureResourceLoaded(rtCostume, resid);
|
|
|
|
return;
|
|
|
|
case 49:
|
|
|
|
ensureResourceLoaded(rtRoom, resid);
|
|
|
|
default:
|
|
|
|
error("o2_resourceRoutines: unknown load/nuke opcode");
|
|
|
|
}
|
|
|
|
}
|
2003-04-21 14:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_verbOps() {
|
|
|
|
int opcode = fetchScriptByte(), slot, state;
|
|
|
|
|
|
|
|
switch (opcode) {
|
|
|
|
case 0: // Delete Verb
|
|
|
|
slot = getVarOrDirectByte(0x80);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0xFF: // Verb On/Off
|
|
|
|
slot = fetchScriptByte();
|
|
|
|
state = fetchScriptByte();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: { // New Verb
|
|
|
|
fetchScriptByte(); // X
|
|
|
|
fetchScriptByte(); // Y
|
|
|
|
getVarOrDirectByte(0x80); // Slot
|
|
|
|
fetchScriptByte(); // ?
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_isEqual() {
|
2003-04-26 16:37:35 +00:00
|
|
|
int a = getVar();
|
2003-04-21 14:09:16 +00:00
|
|
|
int b = getVarOrDirectWord(0x80);
|
|
|
|
|
|
|
|
if (b == a)
|
|
|
|
ignoreScriptWord();
|
|
|
|
else
|
|
|
|
o5_jumpRelative();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_isGreater() {
|
2003-04-26 16:37:35 +00:00
|
|
|
int16 a = getVar();
|
2003-04-21 14:09:16 +00:00
|
|
|
int16 b = getVarOrDirectWord(0x80);
|
|
|
|
|
|
|
|
if (b > a)
|
|
|
|
ignoreScriptWord();
|
|
|
|
else
|
|
|
|
o5_jumpRelative();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_isGreaterEqual() {
|
2003-04-26 16:37:35 +00:00
|
|
|
int16 a = getVar();
|
2003-04-21 14:09:16 +00:00
|
|
|
int16 b = getVarOrDirectWord(0x80);
|
|
|
|
|
|
|
|
if (b >= a)
|
|
|
|
ignoreScriptWord();
|
|
|
|
else
|
|
|
|
o5_jumpRelative();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_isLess() {
|
2003-04-26 16:37:35 +00:00
|
|
|
int16 a = getVar();
|
2003-04-21 14:09:16 +00:00
|
|
|
int16 b = getVarOrDirectWord(0x80);
|
|
|
|
|
|
|
|
if (b < a)
|
|
|
|
ignoreScriptWord();
|
|
|
|
else
|
|
|
|
o5_jumpRelative();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_lessOrEqual() {
|
2003-04-26 16:37:35 +00:00
|
|
|
int16 a = getVar();
|
2003-04-21 14:09:16 +00:00
|
|
|
int16 b = getVarOrDirectWord(0x80);
|
|
|
|
|
|
|
|
if (b <= a)
|
|
|
|
ignoreScriptWord();
|
|
|
|
else
|
|
|
|
o5_jumpRelative();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_isNotEqual() {
|
2003-04-26 16:37:35 +00:00
|
|
|
int16 a = getVar();
|
2003-04-21 14:09:16 +00:00
|
|
|
int16 b = getVarOrDirectWord(0x80);
|
|
|
|
|
|
|
|
if (b != a)
|
|
|
|
ignoreScriptWord();
|
|
|
|
else
|
|
|
|
o5_jumpRelative();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_notEqualZero() {
|
2003-04-26 16:37:35 +00:00
|
|
|
int a = getVar();
|
2003-04-21 14:09:16 +00:00
|
|
|
|
|
|
|
if (a != 0)
|
|
|
|
ignoreScriptWord();
|
|
|
|
else
|
|
|
|
o5_jumpRelative();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_equalZero() {
|
2003-04-26 16:37:35 +00:00
|
|
|
int a = getVar();
|
2003-04-21 14:09:16 +00:00
|
|
|
|
|
|
|
if (a == 0)
|
|
|
|
ignoreScriptWord();
|
|
|
|
else
|
|
|
|
o5_jumpRelative();
|
|
|
|
}
|
2003-04-21 14:50:48 +00:00
|
|
|
|
2003-04-21 14:59:19 +00:00
|
|
|
void Scumm_v2::o2_doSentence() {
|
|
|
|
int a;
|
|
|
|
SentenceTab *st;
|
|
|
|
|
|
|
|
a = getVarOrDirectByte(0x80);
|
|
|
|
if (a == 0xFB) {
|
|
|
|
_sentenceNum = 0;
|
|
|
|
stopScriptNr(2);
|
|
|
|
clearClickedStatus();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (a == 0xFC) {
|
|
|
|
_sentenceNum--;
|
|
|
|
clearClickedStatus();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
st = &_sentence[_sentenceNum++];
|
|
|
|
|
|
|
|
st->unk5 = a;
|
|
|
|
st->unk4 = getVarOrDirectWord(0x40);
|
|
|
|
st->unk3 = getVarOrDirectWord(0x20);
|
|
|
|
st->freezeCount = 0;
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
switch(fetchScriptByte()) {
|
|
|
|
case 1:
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-21 14:50:48 +00:00
|
|
|
void Scumm_v2::o2_printEgo() {
|
|
|
|
//_actorToPrintStrFor = (unsigned char)_vars[VAR_EGO];
|
|
|
|
//_messagePtr = _scriptPointer;
|
|
|
|
|
|
|
|
printf("o2_printEgo(%s)\n", _scriptPointer);
|
|
|
|
_scriptPointer += resStrLen(_scriptPointer) + 1;
|
|
|
|
//_messagePtr = addMessageToStack(_messagePtr);
|
|
|
|
//_scriptPointer = _messagePtr;
|
|
|
|
}
|
|
|
|
|
2003-04-21 15:25:29 +00:00
|
|
|
void Scumm_v2::o2_ifClassOfIs() {
|
|
|
|
int act = getVarOrDirectWord(0x80);
|
|
|
|
int clsop = getVarOrDirectByte(0x40);
|
|
|
|
|
2003-04-21 15:28:18 +00:00
|
|
|
if (getObjectIndex(act) == -1) {
|
2003-04-21 15:25:29 +00:00
|
|
|
o5_jumpRelative();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjectData *od = &_objs[getObjectIndex(act)];
|
|
|
|
byte cls = *(getResourceAddress(rtRoom, _currentRoom) + od->OBCDoffset + 10);
|
|
|
|
if ((cls & clsop) != clsop) {
|
|
|
|
o5_jumpRelative();
|
|
|
|
}
|
|
|
|
}
|
2003-04-21 15:42:55 +00:00
|
|
|
|
|
|
|
void Scumm_v2::o2_walkActorTo() {
|
|
|
|
int x, y;
|
|
|
|
Actor *a;
|
|
|
|
a = derefActorSafe(getVarOrDirectByte(0x80), "o2_walkActorTo");
|
|
|
|
x = getVarOrDirectByte(0x40);
|
|
|
|
y = getVarOrDirectByte(0x20);
|
|
|
|
a->startWalkActor(x, y, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_putActor() {
|
|
|
|
int x, y;
|
|
|
|
Actor *a;
|
|
|
|
|
|
|
|
a = derefActorSafe(getVarOrDirectByte(0x80), "o2_putActor");
|
|
|
|
if (!a)
|
|
|
|
return;
|
|
|
|
x = getVarOrDirectByte(0x40);
|
|
|
|
y = getVarOrDirectByte(0x20);
|
|
|
|
|
|
|
|
a->putActor(x, y, a->room);
|
|
|
|
}
|
2003-04-23 05:13:26 +00:00
|
|
|
|
|
|
|
void Scumm_v2::o2_startScript() {
|
|
|
|
int script = getVarOrDirectByte(0x80);
|
2003-04-26 16:37:35 +00:00
|
|
|
runScript(script, 0, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_panCameraTo() {
|
|
|
|
panCameraTo(getVarOrDirectByte(0x80), 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_move() {
|
|
|
|
getResultPos();
|
|
|
|
_vars[_resultVarNumber] = getVarOrDirectWord(0x80);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_startMusic() {
|
|
|
|
_sound->addSoundToQueue(getVarOrDirectByte(0x80));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_getActorRoom() {
|
|
|
|
int act;
|
|
|
|
Actor *a;
|
|
|
|
getResultPos();
|
|
|
|
act = getVarOrDirectByte(0x80);
|
|
|
|
|
|
|
|
a = derefActorSafe(act, "o2_getActorRoom");
|
|
|
|
if (!a) {
|
|
|
|
warning("Invalid actor %d in o2_getActorRoom", act);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_vars[_resultVarNumber] = a->room;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_getActorElevation() {
|
|
|
|
int act;
|
|
|
|
Actor *a;
|
|
|
|
getResultPos();
|
|
|
|
act = getVarOrDirectByte(0x80);
|
|
|
|
|
|
|
|
a = derefActorSafe(act, "o2_getActorElevation");
|
|
|
|
if (!a) {
|
|
|
|
warning("Invalid actor %d in o2_getActorElevation", act);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_vars[_resultVarNumber] = a->elevation;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_walkActorToActor() {
|
|
|
|
int b, x, y;
|
|
|
|
Actor *a, *a2;
|
|
|
|
int nr;
|
|
|
|
int nr2 = getVarOrDirectByte(0x80);
|
|
|
|
a = derefActorSafe(nr2, "o2_walkActorToActor");
|
|
|
|
if (!a)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!a->isInCurrentRoom()) {
|
|
|
|
getVarOrDirectByte(0x40);
|
|
|
|
fetchScriptByte();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nr = getVarOrDirectByte(0x40);
|
|
|
|
a2 = derefActorSafe(nr, "o2_walkActorToActor(2)");
|
|
|
|
if (!a2)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!a2->isInCurrentRoom()) {
|
|
|
|
fetchScriptByte();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
b = fetchScriptByte(); /* distance from actor */
|
|
|
|
if (b == 0xFF) {
|
|
|
|
b = a2->scalex * a->width / 0xFF;
|
|
|
|
b = b + b / 2;
|
|
|
|
}
|
|
|
|
x = a2->x;
|
|
|
|
y = a2->y;
|
|
|
|
if (x < a->x)
|
|
|
|
x += b;
|
|
|
|
else
|
|
|
|
x -= b;
|
|
|
|
|
|
|
|
a->startWalkActor(x, y, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_walkActorToObject() {
|
|
|
|
int obj;
|
|
|
|
Actor *a;
|
|
|
|
|
|
|
|
a = derefActorSafe(getVarOrDirectByte(0x80), "o2_walkActorToObject");
|
|
|
|
obj = getVarOrDirectWord(0x40);
|
|
|
|
if (whereIsObject(obj) != WIO_NOT_FOUND) {
|
|
|
|
int x, y, dir;
|
|
|
|
getObjectXYPos(obj, x, y, dir);
|
|
|
|
a->startWalkActor(x, y, dir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_faceActor() {
|
|
|
|
int act, obj;
|
|
|
|
Actor *a;
|
|
|
|
act = getVarOrDirectByte(0x80);
|
|
|
|
obj = getVarOrDirectWord(0x40);
|
|
|
|
|
|
|
|
a = derefActorSafe(act, "o2_faceActor");
|
|
|
|
assert(a);
|
|
|
|
|
|
|
|
a->faceToObject(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_putActorAtObject() {
|
|
|
|
int obj, x, y;
|
|
|
|
Actor *a;
|
|
|
|
|
|
|
|
a = derefActorSafe(getVarOrDirectByte(0x80), "o2_putActorAtObject");
|
|
|
|
obj = getVarOrDirectWord(0x40);
|
|
|
|
if (whereIsObject(obj) != WIO_NOT_FOUND)
|
|
|
|
getObjectXYPos(obj, x, y);
|
|
|
|
else {
|
|
|
|
x = 240;
|
|
|
|
y = 120;
|
|
|
|
}
|
|
|
|
a->putActor(x, y, a->room);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_getObjectOwner() {
|
|
|
|
getResultPos();
|
|
|
|
_vars[_resultVarNumber] = getOwner(getVarOrDirectWord(0x80));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_animateActor() {
|
|
|
|
int act = getVarOrDirectByte(0x80);
|
|
|
|
int anim = getVarOrDirectByte(0x40);
|
|
|
|
|
|
|
|
Actor *a = derefActorSafe(act, "o2_animateActor");
|
|
|
|
if (!a)
|
|
|
|
return;
|
|
|
|
|
|
|
|
a->animateActor(anim);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_print() {
|
|
|
|
_actorToPrintStrFor = getVarOrDirectByte(0x80);
|
|
|
|
decodeParseString();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_actorFromPos() {
|
|
|
|
int x, y;
|
|
|
|
getResultPos();
|
|
|
|
x = getVarOrDirectByte(0x80);
|
|
|
|
y = getVarOrDirectByte(0x40);
|
|
|
|
_vars[_resultVarNumber] = getActorFromPos(x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_getRandomNr() {
|
|
|
|
getResultPos();
|
|
|
|
_vars[_resultVarNumber] = _rnd.getRandomNumber(getVarOrDirectByte(0x80));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_isScriptRunning() {
|
|
|
|
getResultPos();
|
|
|
|
_vars[_resultVarNumber] = isScriptRunning(getVarOrDirectByte(0x80));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_getVerbEntrypoint() {
|
|
|
|
int a, b;
|
|
|
|
getResultPos();
|
|
|
|
a = getVarOrDirectWord(0x80);
|
|
|
|
b = getVarOrDirectWord(0x40);
|
|
|
|
|
|
|
|
_vars[_resultVarNumber] = getVerbEntrypoint(a, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_startSound() {
|
|
|
|
_vars[VAR_MUSIC_FLAG] = 0;
|
|
|
|
_sound->addSoundToQueue(getVarOrDirectByte(0x80));
|
2003-04-23 05:13:26 +00:00
|
|
|
}
|
2003-04-26 16:37:35 +00:00
|
|
|
|
|
|
|
void Scumm_v2::o2_saveLoadGame() {
|
|
|
|
getResultPos();
|
|
|
|
byte a = getVarOrDirectByte(0x80);
|
|
|
|
|
2003-04-26 16:43:18 +00:00
|
|
|
error("TODO: o2_saveLoadGame(%d)", a);
|
2003-04-26 16:37:35 +00:00
|
|
|
_vars[_resultVarNumber] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_getActorX() {
|
|
|
|
int a;
|
|
|
|
getResultPos();
|
|
|
|
|
|
|
|
a = getVarOrDirectByte(0x80);
|
|
|
|
_vars[_resultVarNumber] = getObjX(a);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_getActorY() {
|
|
|
|
int a;
|
|
|
|
getResultPos();
|
|
|
|
|
|
|
|
a = getVarOrDirectByte(0x80);
|
|
|
|
_vars[_resultVarNumber] = getObjY(a);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_loadRoomWithEgo() {
|
|
|
|
Actor *a;
|
|
|
|
int obj, room, x, y;
|
|
|
|
|
|
|
|
obj = getVarOrDirectWord(0x80);
|
|
|
|
room = getVarOrDirectByte(0x40);
|
|
|
|
|
|
|
|
a = derefActorSafe(_vars[VAR_EGO], "o2_loadRoomWithEgo");
|
|
|
|
|
|
|
|
a->putActor(0, 0, room);
|
|
|
|
_egoPositioned = false;
|
|
|
|
|
|
|
|
x = (int16)fetchScriptByte();
|
|
|
|
y = (int16)fetchScriptByte();
|
|
|
|
|
|
|
|
startScene(a->room, a, obj);
|
|
|
|
|
|
|
|
camera._dest.x = camera._cur.x = a->x;
|
|
|
|
setCameraAt(a->x, a->y);
|
|
|
|
setCameraFollows(a);
|
|
|
|
|
|
|
|
_fullRedraw = 1;
|
|
|
|
|
|
|
|
if (x != -1) {
|
|
|
|
a->startWalkActor(x, y, -1);
|
|
|
|
}
|
|
|
|
runScript(5, 0, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_setVarRange() {
|
|
|
|
int a, b;
|
|
|
|
|
|
|
|
getResultPos();
|
|
|
|
a = fetchScriptByte();
|
|
|
|
do {
|
|
|
|
if (_opcode & 0x80)
|
|
|
|
b = fetchScriptWord();
|
|
|
|
else
|
|
|
|
b = fetchScriptByte();
|
|
|
|
|
|
|
|
_vars[_resultVarNumber++] = b;
|
|
|
|
} while (--a);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_setOwnerOf() {
|
|
|
|
int obj, owner;
|
|
|
|
|
|
|
|
obj = getVarOrDirectWord(0x80);
|
|
|
|
owner = getVarOrDirectByte(0x40);
|
|
|
|
|
|
|
|
setOwnerOf(obj, owner);
|
|
|
|
runHook(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_delayVariable() {
|
|
|
|
vm.slot[_currentScript].delay = getVar();
|
|
|
|
vm.slot[_currentScript].status = 1;
|
|
|
|
o5_breakHere();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_putActorInRoom() {
|
|
|
|
int room;
|
|
|
|
Actor *a;
|
|
|
|
|
|
|
|
a = derefActorSafe(getVarOrDirectByte(0x80), "o2_putActorInRoom");
|
|
|
|
room = getVarOrDirectByte(0x40);
|
|
|
|
|
|
|
|
if (a == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
a->room = room;
|
|
|
|
if (!room)
|
|
|
|
a->putActor(0, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_matrixOps() {
|
|
|
|
int a, b;
|
|
|
|
|
|
|
|
a = getVarOrDirectByte(0x80);
|
|
|
|
b = fetchScriptByte();
|
|
|
|
setBoxFlags(a, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_setCameraAt() {
|
|
|
|
setCameraAtEx(getVarOrDirectByte(0x80));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_roomOps() {
|
|
|
|
int a = getVarOrDirectByte(0x80);
|
|
|
|
int b = getVarOrDirectByte(0x40);
|
|
|
|
|
|
|
|
_opcode = fetchScriptByte();
|
|
|
|
switch (_opcode & 0x1F) {
|
|
|
|
case 1: /* room scroll */
|
|
|
|
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);
|
|
|
|
_vars[VAR_CAMERA_MIN_X] = a;
|
|
|
|
_vars[VAR_CAMERA_MAX_X] = b;
|
|
|
|
break;
|
|
|
|
case 2: /* room color */
|
|
|
|
_shadowPalette[b] = a;
|
|
|
|
_fullRedraw = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_getDist() {
|
|
|
|
getResultPos();
|
|
|
|
int o1 = getVarOrDirectWord(0x80);
|
|
|
|
int o2 = getVarOrDirectWord(0x40);
|
|
|
|
_vars[_resultVarNumber] = getObjActToObjActDist(o1, o2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_findObject() {
|
|
|
|
getResultPos();
|
|
|
|
int x = getVarOrDirectWord(0x80);
|
|
|
|
int y = getVarOrDirectWord(0x40);
|
|
|
|
_vars[_resultVarNumber] = findObject(x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_subtract() {
|
|
|
|
int a;
|
|
|
|
getResultPos();
|
|
|
|
a = getVarOrDirectWord(0x80);
|
|
|
|
_vars[_resultVarNumber] -= a;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_cutscene() {
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_increment() {
|
|
|
|
getResultPos();
|
|
|
|
_vars[_resultVarNumber]++;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_chainScript() {
|
|
|
|
int data = getVarOrDirectByte(0x80);
|
|
|
|
int cur = _currentScript;
|
|
|
|
|
|
|
|
vm.slot[cur].number = 0;
|
|
|
|
vm.slot[cur].status = 0;
|
|
|
|
_currentScript = 0xFF;
|
|
|
|
|
|
|
|
runScript(data, 0, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_pickupObject() {
|
|
|
|
int obj = getVarOrDirectWord(0x80);
|
|
|
|
|
|
|
|
if (obj < 1) {
|
|
|
|
error("pickupObject received invalid index %d (script %d)", obj, vm.slot[_currentScript].number);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (getObjectIndex(obj) == -1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (whereIsObject(obj) == WIO_INVENTORY) /* Don't take an */
|
|
|
|
return; /* object twice */
|
|
|
|
|
|
|
|
addObjectToInventory(obj, _roomResource);
|
|
|
|
removeObjectFromRoom(obj);
|
|
|
|
putOwner(obj, _vars[VAR_EGO]);
|
|
|
|
putClass(obj, 32, 1);
|
|
|
|
putState(obj, 1);
|
|
|
|
clearDrawObjectQueue();
|
|
|
|
runHook(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_actorFollowCamera() {
|
|
|
|
actorFollowCamera(getVarOrDirectByte(0x80));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_setObjectName() {
|
|
|
|
int obj = getVarOrDirectWord(0x80);
|
|
|
|
int size;
|
|
|
|
int a;
|
|
|
|
int i = 0;
|
|
|
|
byte *name = NULL;
|
|
|
|
byte work[256];
|
|
|
|
|
|
|
|
// Read in new name
|
|
|
|
do {
|
|
|
|
a = fetchScriptByte();
|
|
|
|
work[i++] = a;
|
|
|
|
} while (a);
|
|
|
|
work[i] = 0;
|
|
|
|
|
|
|
|
if (obj < NUM_ACTORS)
|
|
|
|
error("Can't set actor %d name with new-name-of", obj);
|
|
|
|
|
|
|
|
name = getObjOrActorName(obj);
|
|
|
|
|
|
|
|
byte *objptr;
|
|
|
|
byte offset = 0;
|
|
|
|
|
|
|
|
objptr = getOBCDFromObject(obj);
|
|
|
|
offset = *(objptr + 18);
|
|
|
|
size = READ_LE_UINT16(objptr) - offset;
|
|
|
|
|
|
|
|
if (i >= size) {
|
|
|
|
warning("New name of object %d too long (old *%s* new *%s*)", obj, name, work);
|
|
|
|
i = size - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(name, work, i + 1);
|
|
|
|
runHook(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_getActorMoving() {
|
|
|
|
int act;
|
|
|
|
Actor *a;
|
|
|
|
getResultPos();
|
|
|
|
act = getVarOrDirectByte(0x80);
|
|
|
|
|
|
|
|
a = derefActorSafe(act, "o2_getActorMoving");
|
|
|
|
if (!a) {
|
|
|
|
warning("Invalid actor %d in o2_getActorMoving", act);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_vars[_resultVarNumber] = a->moving;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_add() {
|
|
|
|
int a;
|
|
|
|
getResultPos();
|
|
|
|
a = getVarOrDirectWord(0x80);
|
|
|
|
_vars[_resultVarNumber] += a;
|
|
|
|
}
|
|
|
|
|