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-27 09:39:52 +00:00
|
|
|
OPCODE(o5_startMusic),
|
|
|
|
OPCODE(o5_getActorRoom),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 04 */
|
2003-07-14 19:57:44 +00:00
|
|
|
OPCODE(o2_isGreaterEqual),
|
2003-04-21 12:31:08 +00:00
|
|
|
OPCODE(o2_drawObject),
|
2003-07-01 04:20:41 +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-05-05 09:19:15 +00:00
|
|
|
OPCODE(o5_isNotEqual),
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_faceActor),
|
2003-05-04 02:27:22 +00:00
|
|
|
OPCODE(o2_assignVarWordIndirect),
|
2003-05-22 14:10:20 +00:00
|
|
|
OPCODE(o2_setObjPreposition),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 0C */
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_resourceRoutines),
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_walkActorToActor),
|
2003-04-26 16:37:35 +00:00
|
|
|
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-27 09:39:52 +00:00
|
|
|
OPCODE(o5_getObjectOwner),
|
2003-04-26 16:37:35 +00:00
|
|
|
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-27 10:05:36 +00:00
|
|
|
OPCODE(o5_print),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_actorFromPos),
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_getRandomNr),
|
2003-05-22 23:45:34 +00:00
|
|
|
OPCODE(o2_clearState02),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 18 */
|
|
|
|
OPCODE(o5_jumpRelative),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_doSentence),
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_move),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_setBitVar),
|
|
|
|
/* 1C */
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_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),
|
2003-04-27 10:05:36 +00:00
|
|
|
OPCODE(o5_setVarRange),
|
2003-05-22 23:01:25 +00:00
|
|
|
OPCODE(o2_setState04),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 28 */
|
2003-05-05 09:19:15 +00:00
|
|
|
OPCODE(o5_equalZero),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_setOwnerOf),
|
2003-05-04 02:27:22 +00:00
|
|
|
OPCODE(o2_addIndirect),
|
2003-05-05 09:19:15 +00:00
|
|
|
OPCODE(o5_delayVariable),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 2C */
|
|
|
|
OPCODE(o2_assignVarByte),
|
2003-04-27 10:05:36 +00:00
|
|
|
OPCODE(o5_putActorInRoom),
|
2003-05-03 15:08:10 +00:00
|
|
|
OPCODE(o2_delay),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_ifNotState04),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 30 */
|
2003-05-20 16:13:34 +00:00
|
|
|
OPCODE(o2_setBoxFlags),
|
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-27 10:05:36 +00:00
|
|
|
OPCODE(o5_getDist),
|
2003-05-11 00:03:03 +00:00
|
|
|
OPCODE(o2_findObject),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_walkActorToObject),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_setState01),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 38 */
|
2003-07-14 19:57:44 +00:00
|
|
|
OPCODE(o2_isLessEqual),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_doSentence),
|
2003-05-22 22:42:44 +00:00
|
|
|
OPCODE(o2_subtract),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_waitForActor),
|
|
|
|
/* 3C */
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_stopSound),
|
2003-04-27 11:38:38 +00:00
|
|
|
OPCODE(o2_setActorElevation),
|
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-07-14 19:57:44 +00:00
|
|
|
OPCODE(o2_isLess),
|
2003-04-21 12:31:08 +00:00
|
|
|
OPCODE(o2_drawObject),
|
2003-04-27 07:52:26 +00:00
|
|
|
OPCODE(o5_increment),
|
2003-05-18 12:02:17 +00:00
|
|
|
OPCODE(o2_clearState08),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 48 */
|
2003-05-05 09:25:07 +00:00
|
|
|
OPCODE(o5_isEqual),
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_faceActor),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_chainScript),
|
2003-05-22 14:10:20 +00:00
|
|
|
OPCODE(o2_setObjPreposition),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 4C */
|
|
|
|
OPCODE(o2_waitForSentence),
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_walkActorToActor),
|
2003-04-26 16:37:35 +00:00
|
|
|
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),
|
2003-04-27 10:05:36 +00:00
|
|
|
OPCODE(o5_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),
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_getActorMoving),
|
2003-05-22 23:45:34 +00:00
|
|
|
OPCODE(o2_setState02),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 58 */
|
2003-05-21 14:00:19 +00:00
|
|
|
OPCODE(o2_beginOverride),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_doSentence),
|
2003-05-22 22:42:44 +00:00
|
|
|
OPCODE(o2_add),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_setBitVar),
|
|
|
|
/* 5C */
|
2003-05-04 00:29:52 +00:00
|
|
|
OPCODE(o2_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 */
|
2003-04-26 20:03:38 +00:00
|
|
|
OPCODE(o2_cursorCommand),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_putActor),
|
2003-04-27 10:05:36 +00:00
|
|
|
OPCODE(o5_stopScript),
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_getActorFacing),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 64 */
|
2003-04-26 20:03:38 +00:00
|
|
|
OPCODE(o2_loadRoomWithEgo),
|
|
|
|
OPCODE(o2_drawObject),
|
2003-04-30 11:15:11 +00:00
|
|
|
OPCODE(o5_getClosestObjActor),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_clearState04),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 68 */
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_isScriptRunning),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_setOwnerOf),
|
2003-05-04 02:27:22 +00:00
|
|
|
OPCODE(o2_subIndirect),
|
2003-05-04 00:29:52 +00:00
|
|
|
OPCODE(o2_dummy),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 6C */
|
2003-05-22 14:10:20 +00:00
|
|
|
OPCODE(o2_getObjPreposition),
|
2003-04-27 10:05:36 +00:00
|
|
|
OPCODE(o5_putActorInRoom),
|
2003-05-04 00:29:52 +00:00
|
|
|
OPCODE(o2_dummy),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_ifState04),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 70 */
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_lights),
|
|
|
|
OPCODE(o5_getActorCostume),
|
2003-04-27 10:05:36 +00:00
|
|
|
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-27 10:05:36 +00:00
|
|
|
OPCODE(o5_getDist),
|
2003-05-11 00:03:03 +00:00
|
|
|
OPCODE(o2_findObject),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_walkActorToObject),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_clearState01),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 78 */
|
2003-07-14 19:57:44 +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-26 20:03:38 +00:00
|
|
|
OPCODE(o2_getActorWalkBox),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 7C */
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_isSoundRunning),
|
2003-04-27 11:38:38 +00:00
|
|
|
OPCODE(o2_setActorElevation),
|
2003-04-21 15:42:55 +00:00
|
|
|
OPCODE(o2_walkActorTo),
|
2003-05-22 23:01:25 +00:00
|
|
|
OPCODE(o2_ifState01),
|
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-27 09:39:52 +00:00
|
|
|
OPCODE(o5_startMusic),
|
|
|
|
OPCODE(o5_getActorRoom),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 84 */
|
2003-07-14 19:57:44 +00:00
|
|
|
OPCODE(o2_isGreaterEqual),
|
2003-04-21 12:31:08 +00:00
|
|
|
OPCODE(o2_drawObject),
|
2003-07-01 04:20:41 +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-05-05 09:19:15 +00:00
|
|
|
OPCODE(o5_isNotEqual),
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_faceActor),
|
2003-05-04 02:27:22 +00:00
|
|
|
OPCODE(o2_assignVarWordIndirect),
|
2003-05-22 14:10:20 +00:00
|
|
|
OPCODE(o2_setObjPreposition),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 8C */
|
2003-04-21 14:09:16 +00:00
|
|
|
OPCODE(o2_resourceRoutines),
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_walkActorToActor),
|
2003-04-26 16:37:35 +00:00
|
|
|
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-27 09:39:52 +00:00
|
|
|
OPCODE(o5_getObjectOwner),
|
2003-04-26 16:37:35 +00:00
|
|
|
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-27 10:05:36 +00:00
|
|
|
OPCODE(o5_print),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_actorFromPos),
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_getRandomNr),
|
2003-05-22 23:45:34 +00:00
|
|
|
OPCODE(o2_clearState02),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* 98 */
|
|
|
|
OPCODE(o2_restart),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_doSentence),
|
2003-05-04 17:39:25 +00:00
|
|
|
OPCODE(o5_move),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_setBitVar),
|
|
|
|
/* 9C */
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_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-26 20:03:38 +00:00
|
|
|
OPCODE(o2_saveLoadGame),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_getActorY),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* A4 */
|
2003-04-26 20:03:38 +00:00
|
|
|
OPCODE(o2_loadRoomWithEgo),
|
|
|
|
OPCODE(o2_drawObject),
|
2003-04-27 10:05:36 +00:00
|
|
|
OPCODE(o5_setVarRange),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_setState04),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* A8 */
|
2003-05-05 09:19:15 +00:00
|
|
|
OPCODE(o5_notEqualZero),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_setOwnerOf),
|
2003-05-04 02:27:22 +00:00
|
|
|
OPCODE(o2_addIndirect),
|
2003-05-04 00:29:52 +00:00
|
|
|
OPCODE(o2_dummy),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* AC */
|
2003-04-27 07:13:03 +00:00
|
|
|
OPCODE(o2_drawSentence),
|
2003-04-27 10:05:36 +00:00
|
|
|
OPCODE(o5_putActorInRoom),
|
2003-05-04 17:39:25 +00:00
|
|
|
OPCODE(o2_waitForMessage),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_ifNotState04),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* B0 */
|
2003-05-20 16:13:34 +00:00
|
|
|
OPCODE(o2_setBoxFlags),
|
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-27 10:05:36 +00:00
|
|
|
OPCODE(o5_getDist),
|
2003-05-11 00:03:03 +00:00
|
|
|
OPCODE(o2_findObject),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_walkActorToObject),
|
2003-05-22 23:01:25 +00:00
|
|
|
OPCODE(o2_setState01),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* B8 */
|
2003-07-14 19:57:44 +00:00
|
|
|
OPCODE(o2_isLessEqual),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_doSentence),
|
2003-05-22 22:42:44 +00:00
|
|
|
OPCODE(o2_subtract),
|
2003-04-20 16:04:50 +00:00
|
|
|
OPCODE(o2_waitForActor),
|
|
|
|
/* BC */
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_stopSound),
|
2003-04-27 11:38:38 +00:00
|
|
|
OPCODE(o2_setActorElevation),
|
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 */
|
2003-04-26 20:03:38 +00:00
|
|
|
OPCODE(o2_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-07-14 19:57:44 +00:00
|
|
|
OPCODE(o2_isLess),
|
2003-04-21 12:31:08 +00:00
|
|
|
OPCODE(o2_drawObject),
|
2003-04-27 07:52:26 +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-05-05 09:25:07 +00:00
|
|
|
OPCODE(o5_isEqual),
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_faceActor),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_chainScript),
|
2003-05-22 14:10:20 +00:00
|
|
|
OPCODE(o2_setObjPreposition),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* CC */
|
|
|
|
OPCODE(o5_pseudoRoom),
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_walkActorToActor),
|
2003-04-26 16:37:35 +00:00
|
|
|
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),
|
2003-04-27 10:05:36 +00:00
|
|
|
OPCODE(o5_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),
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_getActorMoving),
|
2003-05-22 23:45:34 +00:00
|
|
|
OPCODE(o2_setState02),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* D8 */
|
2003-05-04 01:10:45 +00:00
|
|
|
OPCODE(o5_printEgo),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_doSentence),
|
2003-05-22 22:42:44 +00:00
|
|
|
OPCODE(o2_add),
|
2003-04-27 07:13:03 +00:00
|
|
|
OPCODE(o2_setBitVar),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* DC */
|
2003-05-04 00:29:52 +00:00
|
|
|
OPCODE(o2_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 */
|
2003-04-26 20:03:38 +00:00
|
|
|
OPCODE(o2_cursorCommand),
|
2003-04-21 15:42:55 +00:00
|
|
|
OPCODE(o2_putActor),
|
2003-04-27 10:05:36 +00:00
|
|
|
OPCODE(o5_stopScript),
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_getActorFacing),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* E4 */
|
2003-04-26 20:03:38 +00:00
|
|
|
OPCODE(o2_loadRoomWithEgo),
|
|
|
|
OPCODE(o2_drawObject),
|
2003-04-30 11:15:11 +00:00
|
|
|
OPCODE(o5_getClosestObjActor),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_clearState04),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* E8 */
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_isScriptRunning),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_setOwnerOf),
|
2003-05-04 02:27:22 +00:00
|
|
|
OPCODE(o2_subIndirect),
|
2003-05-04 00:29:52 +00:00
|
|
|
OPCODE(o2_dummy),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* EC */
|
2003-05-22 14:10:20 +00:00
|
|
|
OPCODE(o2_getObjPreposition),
|
2003-04-27 10:05:36 +00:00
|
|
|
OPCODE(o5_putActorInRoom),
|
2003-05-04 00:29:52 +00:00
|
|
|
OPCODE(o2_dummy),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_ifState04),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* F0 */
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_lights),
|
|
|
|
OPCODE(o5_getActorCostume),
|
2003-04-27 10:05:36 +00:00
|
|
|
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-27 10:05:36 +00:00
|
|
|
OPCODE(o5_getDist),
|
2003-05-11 00:03:03 +00:00
|
|
|
OPCODE(o2_findObject),
|
2003-04-26 16:37:35 +00:00
|
|
|
OPCODE(o2_walkActorToObject),
|
2003-04-21 08:50:16 +00:00
|
|
|
OPCODE(o2_clearState01),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* F8 */
|
2003-07-14 19:57:44 +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-26 20:03:38 +00:00
|
|
|
OPCODE(o2_getActorWalkBox),
|
2003-04-20 16:04:50 +00:00
|
|
|
/* FC */
|
2003-04-27 09:39:52 +00:00
|
|
|
OPCODE(o5_isSoundRunning),
|
2003-04-27 11:38:38 +00:00
|
|
|
OPCODE(o2_setActorElevation),
|
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;
|
|
|
|
}
|
|
|
|
|
2003-05-16 01:56:06 +00:00
|
|
|
#define SENTENCE_SCRIPT 2
|
|
|
|
|
2003-05-14 20:37:53 +00:00
|
|
|
void Scumm_v2::executeOpcode(byte i) {
|
2003-04-20 16:04:50 +00:00
|
|
|
OpcodeProcV2 op = _opcodesV2[i].proc;
|
|
|
|
(this->*op) ();
|
|
|
|
}
|
|
|
|
|
2003-05-14 20:37:53 +00:00
|
|
|
const char *Scumm_v2::getOpcodeDesc(byte i) {
|
2003-04-20 16:04:50 +00:00
|
|
|
return _opcodesV2[i].desc;
|
|
|
|
}
|
|
|
|
|
2003-05-05 09:19:15 +00:00
|
|
|
int Scumm_v2::getVar() {
|
|
|
|
return readVar(fetchScriptByte());
|
|
|
|
}
|
|
|
|
|
2003-05-04 02:10:49 +00:00
|
|
|
void Scumm_v2::decodeParseString() {
|
|
|
|
byte buffer[256]; // FIXME
|
|
|
|
byte *ptr = buffer;
|
|
|
|
byte c;
|
2003-05-14 14:22:15 +00:00
|
|
|
bool insertSpace = false;
|
|
|
|
|
2003-05-04 02:10:49 +00:00
|
|
|
while ((c = fetchScriptByte())) {
|
2003-05-14 14:22:15 +00:00
|
|
|
|
|
|
|
insertSpace = (c & 0x80) != 0;
|
|
|
|
c &= 0x7f;
|
|
|
|
|
|
|
|
if (c < 8) {
|
2003-05-04 02:10:49 +00:00
|
|
|
// Special codes as seen in CHARSET_1 etc. My guess is that they
|
|
|
|
// have a similar function as the corresponding embedded stuff in modern
|
|
|
|
// games. Hence for now we convert them to the modern format.
|
|
|
|
// This might allow us to reuse the existing code.
|
|
|
|
*ptr++ = 0xFF;
|
|
|
|
*ptr++ = c;
|
|
|
|
if (c > 3) {
|
|
|
|
*ptr++ = fetchScriptByte();
|
2003-05-22 14:22:35 +00:00
|
|
|
*ptr++ = 0;
|
2003-05-04 02:10:49 +00:00
|
|
|
}
|
|
|
|
} else
|
|
|
|
*ptr++ = c;
|
2003-05-14 14:22:15 +00:00
|
|
|
|
|
|
|
if (insertSpace)
|
|
|
|
*ptr++ = ' ';
|
|
|
|
|
2003-05-04 02:10:49 +00:00
|
|
|
}
|
|
|
|
*ptr = 0;
|
|
|
|
|
2003-05-14 13:32:43 +00:00
|
|
|
// For now, always use textSlot 0. Not sure if there are any situations where we might
|
|
|
|
// need to us another one?
|
|
|
|
int textSlot = 0;
|
2003-05-14 13:30:52 +00:00
|
|
|
|
|
|
|
_string[textSlot].xpos = 0;
|
|
|
|
_string[textSlot].ypos = 0;
|
|
|
|
_string[textSlot].right = 320;
|
|
|
|
_string[textSlot].center = false;
|
|
|
|
_string[textSlot].overhead = false;
|
2003-05-23 12:07:36 +00:00
|
|
|
// _string[textSlot].color = 9; // light blue
|
2003-05-14 13:30:52 +00:00
|
|
|
|
|
|
|
_messagePtr = buffer;
|
|
|
|
switch (textSlot) {
|
|
|
|
case 0:
|
|
|
|
actorTalk();
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
drawString(1);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
unkMessage1();
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
unkMessage2();
|
|
|
|
break;
|
|
|
|
}
|
2003-05-04 02:10:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int Scumm_v2::readVar(uint var) {
|
|
|
|
if (var >= 14 && var <= 16)
|
2003-05-08 15:48:50 +00:00
|
|
|
var = _scummVars[var];
|
2003-05-04 02:10:49 +00:00
|
|
|
|
|
|
|
checkRange(_numVariables - 1, 0, var, "Variable %d out of range(r)");
|
2003-05-21 14:25:50 +00:00
|
|
|
debug(6, "readvar(%d) = %d", var, _scummVars[var]);
|
2003-05-08 15:48:50 +00:00
|
|
|
return _scummVars[var];
|
2003-05-04 02:10:49 +00:00
|
|
|
}
|
|
|
|
|
2003-05-21 14:25:14 +00:00
|
|
|
void Scumm_v2::writeVar(uint var, int value) {
|
|
|
|
checkRange(_numVariables - 1, 0, var, "Variable %d out of range(r)");
|
2003-05-21 14:25:50 +00:00
|
|
|
debug(6, "writeVar(%d) = %d", var, value);
|
2003-05-21 14:25:14 +00:00
|
|
|
_scummVars[var] = value;
|
|
|
|
}
|
|
|
|
|
2003-05-04 02:27:22 +00:00
|
|
|
void Scumm_v2::getResultPosIndirect() {
|
2003-05-08 15:48:50 +00:00
|
|
|
_resultVarNumber = _scummVars[fetchScriptByte()];
|
2003-05-04 02:27:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::getResultPos() {
|
|
|
|
_resultVarNumber = fetchScriptByte();
|
|
|
|
}
|
|
|
|
|
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-05-10 21:35:06 +00:00
|
|
|
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_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
|
|
|
}
|
|
|
|
|
2003-05-04 02:27:22 +00:00
|
|
|
void Scumm_v2::o2_assignVarWordIndirect() {
|
|
|
|
getResultPosIndirect();
|
2003-05-04 17:39:25 +00:00
|
|
|
setResult(getVarOrDirectWord(0x80));
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_assignVarByte() {
|
|
|
|
getResultPos();
|
2003-04-27 07:52:26 +00:00
|
|
|
setResult(fetchScriptByte());
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
2003-05-22 14:10:20 +00:00
|
|
|
void Scumm_v2::o2_setObjPreposition() {
|
2003-04-20 16:04:50 +00:00
|
|
|
int obj = getVarOrDirectWord(0x80);
|
2003-05-20 16:13:34 +00:00
|
|
|
int unk = fetchScriptByte();
|
2003-04-20 16:04:50 +00:00
|
|
|
|
|
|
|
if (whereIsObject(obj) != WIO_NOT_FOUND) {
|
2003-05-22 15:27:44 +00:00
|
|
|
// FIXME: this might not work properly the moment we save and restore the game.
|
|
|
|
byte *ptr = getOBCDFromObject(obj) + 12;
|
|
|
|
*ptr &= 0x1F;
|
|
|
|
*ptr |= unk << 5;
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-05-22 14:10:20 +00:00
|
|
|
void Scumm_v2::o2_getObjPreposition() {
|
2003-04-21 12:59:57 +00:00
|
|
|
getResultPos();
|
2003-05-22 00:14:28 +00:00
|
|
|
int obj = getVarOrDirectWord(0x80);
|
2003-04-20 16:04:50 +00:00
|
|
|
|
|
|
|
if (whereIsObject(obj) != WIO_NOT_FOUND) {
|
2003-05-22 15:27:44 +00:00
|
|
|
byte *ptr = getOBCDFromObject(obj) + 12;
|
|
|
|
setResult(*ptr >> 5);
|
2003-04-20 16:04:50 +00:00
|
|
|
} else {
|
2003-04-30 11:15:11 +00:00
|
|
|
setResult(0xFF);
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_setBitVar() {
|
2003-05-21 14:25:14 +00:00
|
|
|
int var = fetchScriptWord();
|
2003-04-20 16:04:50 +00:00
|
|
|
byte a = getVarOrDirectByte(0x80);
|
|
|
|
|
2003-05-09 00:57:10 +00:00
|
|
|
int bit_var = var + a;
|
2003-04-20 16:04:50 +00:00
|
|
|
int bit_offset = bit_var & 0x0f;
|
2003-04-27 09:39:52 +00:00
|
|
|
bit_var >>= 4;
|
2003-04-20 16:04:50 +00:00
|
|
|
|
2003-05-04 02:10:49 +00:00
|
|
|
if (getVarOrDirectByte(0x40))
|
2003-05-08 15:48:50 +00:00
|
|
|
_scummVars[bit_var] |= (1 << bit_offset);
|
2003-04-20 16:04:50 +00:00
|
|
|
else
|
2003-05-08 15:48:50 +00:00
|
|
|
_scummVars[bit_var] &= ~(1 << bit_offset);
|
2003-05-21 14:25:14 +00:00
|
|
|
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_getBitVar() {
|
|
|
|
getResultPos();
|
2003-05-21 14:25:14 +00:00
|
|
|
int var = fetchScriptWord();
|
2003-04-20 16:04:50 +00:00
|
|
|
byte a = getVarOrDirectByte(0x80);
|
|
|
|
|
2003-05-09 00:57:10 +00:00
|
|
|
int bit_var = var + a;
|
2003-04-20 16:04:50 +00:00
|
|
|
int bit_offset = bit_var & 0x0f;
|
2003-04-27 09:39:52 +00:00
|
|
|
bit_var >>= 4;
|
2003-04-20 16:04:50 +00:00
|
|
|
|
2003-05-08 15:48:50 +00:00
|
|
|
setResult((_scummVars[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
|
|
|
}
|
|
|
|
|
2003-05-04 02:27:22 +00:00
|
|
|
void Scumm_v2::o2_addIndirect() {
|
2003-04-20 16:04:50 +00:00
|
|
|
int a;
|
2003-05-04 02:27:22 +00:00
|
|
|
getResultPosIndirect();
|
2003-04-20 16:04:50 +00:00
|
|
|
a = getVarOrDirectWord(0x80);
|
2003-05-08 15:48:50 +00:00
|
|
|
_scummVars[_resultVarNumber] += a;
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
2003-05-04 02:27:22 +00:00
|
|
|
void Scumm_v2::o2_subIndirect() {
|
2003-04-20 16:04:50 +00:00
|
|
|
int a;
|
2003-05-04 02:27:22 +00:00
|
|
|
getResultPosIndirect();
|
2003-04-20 16:04:50 +00:00
|
|
|
a = getVarOrDirectWord(0x80);
|
2003-05-08 15:48:50 +00:00
|
|
|
_scummVars[_resultVarNumber] -= a;
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
|
|
|
|
2003-05-22 22:42:44 +00:00
|
|
|
void Scumm_v2::o2_add() {
|
|
|
|
int a;
|
|
|
|
getResultPos();
|
|
|
|
a = getVarOrDirectWord(0x80);
|
|
|
|
_scummVars[_resultVarNumber] += a;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_subtract() {
|
|
|
|
int a;
|
|
|
|
getResultPos();
|
|
|
|
a = getVarOrDirectWord(0x80);
|
|
|
|
_scummVars[_resultVarNumber] -= a;
|
|
|
|
}
|
|
|
|
|
2003-04-20 16:04:50 +00:00
|
|
|
void Scumm_v2::o2_waitForActor() {
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(getVarOrDirectByte(0x80), "o2_waitForActor");
|
2003-05-23 00:22:41 +00:00
|
|
|
if (a->moving) {
|
2003-04-21 12:59:57 +00:00
|
|
|
_scriptPointer -= 2;
|
2003-04-20 16:04:50 +00:00
|
|
|
o5_breakHere();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-05-04 17:39:25 +00:00
|
|
|
void Scumm_v2::o2_waitForMessage() {
|
|
|
|
|
2003-05-08 15:48:50 +00:00
|
|
|
if (VAR(VAR_HAVE_MSG)) {
|
2003-05-04 17:39:25 +00:00
|
|
|
_scriptPointer--;
|
|
|
|
o5_breakHere();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_waitForSentence() {
|
2003-05-28 13:28:43 +00:00
|
|
|
if (!_sentenceNum && !isScriptInUse(SENTENCE_SCRIPT))
|
2003-05-04 17:39:25 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
_scriptPointer--;
|
|
|
|
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);
|
2003-05-23 12:07:36 +00:00
|
|
|
Actor *a;
|
2003-04-21 09:03:17 +00:00
|
|
|
int i;
|
2003-04-20 17:07:25 +00:00
|
|
|
|
2003-05-04 02:10:49 +00:00
|
|
|
_opcode = fetchScriptByte();
|
2003-05-23 12:07:36 +00:00
|
|
|
if (act == 0 && _opcode == 5) {
|
|
|
|
// This case happens in the Zak/MM bootscripts, to set the default talk color (9).
|
|
|
|
_string[0].color = arg;
|
2003-04-20 17:07:25 +00:00
|
|
|
return;
|
2003-05-03 06:48:26 +00:00
|
|
|
}
|
2003-05-23 12:07:36 +00:00
|
|
|
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(act, "actorSet");
|
2003-04-20 16:59:52 +00:00
|
|
|
|
2003-05-04 02:10:49 +00:00
|
|
|
switch (_opcode) {
|
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
|
2003-07-14 06:00:17 +00:00
|
|
|
if ((_gameId == GID_ZAK) && (_version == 1)) {
|
2003-07-14 18:20:20 +00:00
|
|
|
// FIXME: maybe this is needed for MM v1, too, but so far I have
|
|
|
|
// not seen any call to this in it at all, so I don't know
|
|
|
|
i = 3;
|
|
|
|
} else {
|
|
|
|
i = fetchScriptByte();
|
2003-07-14 06:00:17 +00:00
|
|
|
}
|
2003-07-14 18:20:20 +00:00
|
|
|
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-05-04 02:10:49 +00:00
|
|
|
default:
|
|
|
|
warning("o2_actorSet: opcode %d not yet supported", _opcode);
|
2003-04-20 16:59:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-20 16:04:50 +00:00
|
|
|
void Scumm_v2::o2_restart() {
|
2003-06-02 02:25:24 +00:00
|
|
|
restart();
|
2003-04-20 16:04:50 +00:00
|
|
|
}
|
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-05-09 01:01:53 +00:00
|
|
|
obj = getVarOrDirectWord(0x80);
|
2003-04-27 09:03:26 +00:00
|
|
|
xpos = getVarOrDirectByte(0x40);
|
|
|
|
ypos = getVarOrDirectByte(0x20);
|
2003-04-21 12:31:08 +00:00
|
|
|
|
|
|
|
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;
|
2003-05-10 21:35:06 +00:00
|
|
|
while (i--) {
|
2003-04-21 12:31:08 +00:00
|
|
|
if (_objs[i].obj_nr && _objs[i].x_pos == x && _objs[i].y_pos == y && _objs[i].width == w && _objs[i].height == h)
|
2003-05-10 21:35:06 +00:00
|
|
|
putState(_objs[i].obj_nr, getState(_objs[i].obj_nr) & ~0x08);
|
|
|
|
}
|
2003-04-21 12:31:08 +00:00
|
|
|
|
2003-05-16 23:50:56 +00:00
|
|
|
putState(obj, getState(od->obj_nr) | 0x08);
|
2003-04-21 12:31:08 +00:00
|
|
|
}
|
2003-04-21 14:09:16 +00:00
|
|
|
|
|
|
|
void Scumm_v2::o2_resourceRoutines() {
|
2003-05-08 14:14:37 +00:00
|
|
|
const ResTypes resTypes[] = {
|
|
|
|
rtNumTypes, // Unknown / invalid
|
|
|
|
rtNumTypes, // Unknown / invalid
|
|
|
|
rtCostume,
|
|
|
|
rtRoom,
|
|
|
|
rtNumTypes, // Unknown / invalid
|
|
|
|
rtScript,
|
|
|
|
rtSound
|
|
|
|
};
|
2003-04-21 14:20:18 +00:00
|
|
|
int resid = getVarOrDirectByte(0x80);
|
|
|
|
int opcode = fetchScriptByte();
|
2003-04-21 14:09:16 +00:00
|
|
|
|
2003-05-08 14:14:37 +00:00
|
|
|
ResTypes type = rtNumTypes;
|
|
|
|
if (0 <= (opcode >> 4) && (opcode >> 4) < (int)ARRAYSIZE(resTypes))
|
|
|
|
type = resTypes[opcode >> 4];
|
|
|
|
|
|
|
|
if (type == rtNumTypes) {
|
|
|
|
warning("o2_resourceRoutines: unknown restype %d", (opcode >> 4));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2003-04-21 14:20:18 +00:00
|
|
|
if (((opcode & 0x0f) == 0) || ((opcode & 0x0f) == 1)) {
|
2003-05-08 14:14:37 +00:00
|
|
|
if (opcode & 1) {
|
|
|
|
ensureResourceLoaded(type, resid);
|
|
|
|
} else {
|
|
|
|
// Seems the nuke opcodes do nothing?
|
|
|
|
warning("o2_resourceRoutines: nuking resType %d, id %d does nothing", type, resid);
|
2003-04-21 14:20:18 +00:00
|
|
|
}
|
|
|
|
} else {
|
2003-05-08 14:14:37 +00:00
|
|
|
if (opcode & 1) {
|
|
|
|
lock(type, resid);
|
|
|
|
} else {
|
|
|
|
unlock(type, resid);
|
2003-04-21 14:20:18 +00:00
|
|
|
}
|
|
|
|
}
|
2003-04-21 14:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_verbOps() {
|
2003-05-14 12:26:23 +00:00
|
|
|
int verb = fetchScriptByte();
|
|
|
|
int slot, state;
|
2003-05-04 20:07:32 +00:00
|
|
|
|
2003-05-14 12:26:23 +00:00
|
|
|
switch (verb) {
|
2003-04-21 14:09:16 +00:00
|
|
|
case 0: // Delete Verb
|
2003-05-14 12:26:23 +00:00
|
|
|
slot = getVarOrDirectByte(0x80) + 1;
|
|
|
|
assert(0 < slot && slot < _maxVerbs);
|
2003-05-08 22:44:46 +00:00
|
|
|
|
2003-05-14 12:26:23 +00:00
|
|
|
//printf("o2_verbOps delete slot = %d\n", slot);
|
2003-05-08 22:44:46 +00:00
|
|
|
killVerb(slot);
|
2003-05-04 20:07:32 +00:00
|
|
|
break;
|
|
|
|
|
2003-04-21 14:09:16 +00:00
|
|
|
case 0xFF: // Verb On/Off
|
2003-05-08 22:44:46 +00:00
|
|
|
verb = fetchScriptByte();
|
2003-04-21 14:09:16 +00:00
|
|
|
state = fetchScriptByte();
|
2003-05-08 22:44:46 +00:00
|
|
|
slot = getVerbSlot(verb, 0);
|
|
|
|
|
2003-05-14 12:26:23 +00:00
|
|
|
//printf("o2_verbOps Verb On/Off: verb = %d, slot = %d, state = %d\n", verb, slot, state);
|
2003-05-08 22:44:46 +00:00
|
|
|
|
|
|
|
_verbs[slot].curmode = state;
|
|
|
|
|
2003-05-04 20:07:32 +00:00
|
|
|
break;
|
|
|
|
|
2003-04-21 14:09:16 +00:00
|
|
|
default: { // New Verb
|
2003-05-08 22:44:46 +00:00
|
|
|
int x = fetchScriptByte() << 3;
|
|
|
|
int y = fetchScriptByte() << 3;
|
2003-05-14 12:26:23 +00:00
|
|
|
slot = getVarOrDirectByte(0x80) + 1;
|
2003-05-21 23:46:02 +00:00
|
|
|
/* int unk = */ fetchScriptByte(); // ?
|
2003-07-14 06:00:17 +00:00
|
|
|
|
|
|
|
// V1 Maniac verbs are relative to the 'verb area' - under the sentence
|
|
|
|
if ((_gameId == GID_MANIAC) && (_version == 1))
|
2003-07-15 00:23:18 +00:00
|
|
|
y+=8;
|
2003-07-09 14:57:15 +00:00
|
|
|
|
2003-05-14 13:30:52 +00:00
|
|
|
//printf("o2_verbOps: verb = %d, slot = %d, x = %d, y = %d, unk = %d, name = %s\n",
|
|
|
|
// verb, slot, x, y, unk, _scriptPointer);
|
|
|
|
|
2003-05-08 22:44:46 +00:00
|
|
|
VerbSlot *vs;
|
2003-05-14 12:26:23 +00:00
|
|
|
assert(0 < slot && slot < _maxVerbs);
|
|
|
|
|
2003-05-08 22:44:46 +00:00
|
|
|
vs = &_verbs[slot];
|
|
|
|
vs->verbid = verb;
|
2003-07-13 15:13:43 +00:00
|
|
|
if (_version == 1) {
|
|
|
|
vs->color = 5;
|
|
|
|
vs->hicolor = 7;
|
|
|
|
vs->dimcolor = 11;
|
|
|
|
} else {
|
|
|
|
vs->color = 2;
|
|
|
|
vs->hicolor = 14;
|
|
|
|
vs->dimcolor = 8;
|
|
|
|
}
|
2003-05-08 22:44:46 +00:00
|
|
|
vs->type = kTextVerbType;
|
|
|
|
vs->charset_nr = _string[0].t_charset;
|
|
|
|
vs->curmode = 1;
|
|
|
|
vs->saveid = 0;
|
|
|
|
vs->key = 0;
|
|
|
|
vs->center = 0;
|
|
|
|
vs->imgindex = 0;
|
|
|
|
|
|
|
|
vs->x = x;
|
|
|
|
vs->y = y;
|
2003-05-21 23:46:02 +00:00
|
|
|
|
|
|
|
// FIXME: again, this map depends on the language of the game.
|
|
|
|
// E.g. a german keyboard has 'z' and 'y' swapped, while a french
|
|
|
|
// keyboard starts with "awert", etc.
|
|
|
|
const char keyboard[] = {
|
|
|
|
'q','w','e','r','t',
|
|
|
|
'a','s','d','f','g',
|
|
|
|
'z','x','c','v','b'
|
|
|
|
};
|
|
|
|
if (1 <= slot && slot <= ARRAYSIZE(keyboard))
|
|
|
|
vs->key = keyboard[slot - 1];
|
2003-05-08 22:44:46 +00:00
|
|
|
|
|
|
|
// It follows the verb name
|
|
|
|
loadPtrToResource(rtVerb, slot, NULL);
|
2003-05-04 20:07:32 +00:00
|
|
|
}
|
|
|
|
break;
|
2003-04-21 14:09:16 +00:00
|
|
|
}
|
2003-05-08 22:44:46 +00:00
|
|
|
|
|
|
|
// FIXME - hack!
|
|
|
|
drawVerb(slot, 0);
|
|
|
|
verbMouseOver(0);
|
2003-04-21 14:09:16 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 14:59:19 +00:00
|
|
|
void Scumm_v2::o2_doSentence() {
|
|
|
|
int a;
|
|
|
|
SentenceTab *st;
|
|
|
|
|
|
|
|
a = getVarOrDirectByte(0x80);
|
2003-05-21 04:09:20 +00:00
|
|
|
if (a == 0xFC) {
|
2003-04-21 14:59:19 +00:00
|
|
|
_sentenceNum = 0;
|
2003-05-20 20:58:26 +00:00
|
|
|
stopScript(SENTENCE_SCRIPT);
|
2003-04-21 14:59:19 +00:00
|
|
|
return;
|
|
|
|
}
|
2003-05-21 04:09:20 +00:00
|
|
|
if (a == 0xFB) {
|
2003-05-18 12:52:27 +00:00
|
|
|
resetSentence();
|
2003-04-21 14:59:19 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
st = &_sentence[_sentenceNum++];
|
|
|
|
|
2003-04-28 03:13:49 +00:00
|
|
|
st->verb = a;
|
2003-05-16 02:16:59 +00:00
|
|
|
st->objectA = getVarOrDirectWord(0x40);
|
|
|
|
st->objectB = getVarOrDirectWord(0x20);
|
2003-05-22 14:10:20 +00:00
|
|
|
st->preposition = (st->objectB != 0);
|
2003-04-21 14:59:19 +00:00
|
|
|
st->freezeCount = 0;
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
switch(fetchScriptByte()) {
|
|
|
|
case 1:
|
2003-05-16 01:56:06 +00:00
|
|
|
// Execute the sentence
|
2003-05-11 11:13:24 +00:00
|
|
|
_sentenceNum--;
|
2003-05-21 18:58:29 +00:00
|
|
|
|
2003-07-15 00:23:18 +00:00
|
|
|
if (st->verb == 254) {
|
|
|
|
stopObjectScript(st->objectA);
|
|
|
|
} else if (st->verb != 253 && st->verb != 250) {
|
2003-05-22 12:30:19 +00:00
|
|
|
VAR(VAR_ACTIVE_VERB) = st->verb;
|
|
|
|
VAR(VAR_ACTIVE_OBJECT1) = st->objectA;
|
|
|
|
VAR(VAR_ACTIVE_OBJECT2) = st->objectB;
|
2003-05-16 01:56:06 +00:00
|
|
|
|
2003-05-22 12:30:19 +00:00
|
|
|
runObjectScript(st->objectA, st->verb, false, false, NULL);
|
|
|
|
} else
|
2003-07-15 00:23:18 +00:00
|
|
|
runObjectScript(st->objectA, 253, (st->verb == 250), true, NULL);
|
2003-04-21 14:59:19 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2003-05-16 02:16:59 +00:00
|
|
|
// Print the sentence
|
2003-05-11 11:13:24 +00:00
|
|
|
_sentenceNum--;
|
2003-05-21 20:34:21 +00:00
|
|
|
//warning("TODO o2_doSentence(%d, %d, %d): print", st->verb, st->objectA, st->objectB);
|
2003-05-16 02:16:59 +00:00
|
|
|
|
2003-05-21 14:00:19 +00:00
|
|
|
VAR(VAR_SENTENCE_VERB) = st->verb;
|
|
|
|
VAR(VAR_SENTENCE_OBJECT1) = st->objectA;
|
|
|
|
VAR(VAR_SENTENCE_OBJECT2) = st->objectB;
|
2003-05-17 06:04:22 +00:00
|
|
|
|
2003-05-16 02:16:59 +00:00
|
|
|
o2_drawSentence();
|
2003-04-21 14:59:19 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-05-16 01:56:06 +00:00
|
|
|
void Scumm_v2::o2_drawSentence() {
|
2003-05-21 06:00:16 +00:00
|
|
|
ScummVM::Rect sentenceline;
|
2003-07-12 22:46:23 +00:00
|
|
|
static char sentence[256];
|
2003-05-21 18:09:49 +00:00
|
|
|
const byte *temp;
|
2003-05-21 14:00:19 +00:00
|
|
|
int slot = getVerbSlot(VAR(VAR_SENTENCE_VERB),0);
|
2003-05-21 06:00:16 +00:00
|
|
|
|
2003-05-21 07:22:43 +00:00
|
|
|
if (!(_userState & 32))
|
2003-05-21 06:14:02 +00:00
|
|
|
return;
|
|
|
|
|
2003-05-22 11:40:20 +00:00
|
|
|
if (getResourceAddress(rtVerb, slot))
|
|
|
|
strcpy(sentence, (char*)getResourceAddress(rtVerb, slot));
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
|
2003-05-21 14:00:19 +00:00
|
|
|
if (VAR(VAR_SENTENCE_OBJECT1) > 0) {
|
|
|
|
temp = getObjOrActorName(VAR(VAR_SENTENCE_OBJECT1));
|
2003-05-21 11:22:03 +00:00
|
|
|
if (temp) {
|
2003-05-21 10:13:06 +00:00
|
|
|
strcat(sentence, " ");
|
2003-05-21 18:09:49 +00:00
|
|
|
strcat(sentence, (const char*)temp);
|
2003-05-21 10:13:06 +00:00
|
|
|
}
|
2003-05-16 12:58:49 +00:00
|
|
|
}
|
|
|
|
|
2003-05-25 18:56:20 +00:00
|
|
|
if (0 < VAR(VAR_SENTENCE_PREPOSITION) && VAR(VAR_SENTENCE_PREPOSITION) <= 4) {
|
2003-05-21 23:46:02 +00:00
|
|
|
// FIXME: Are these stored somewhere in the data? If not, we have to provide
|
|
|
|
// localized versions for all the languages MM/Zak are available in. Note
|
|
|
|
// that we already will have to do that for the fonts anyway.
|
2003-05-25 18:56:20 +00:00
|
|
|
//
|
|
|
|
// The order here matches the one defined in gameDetector.h
|
|
|
|
const char *prepositions[][5] = {
|
|
|
|
{ " ", " in", " with", " on", " to" }, // English
|
|
|
|
{ " ", " mit", " mit", " mit", " zu" }, // German
|
|
|
|
{ " ", " dans", " avec", " sur", " <" }, // French
|
2003-05-27 23:28:41 +00:00
|
|
|
{ " ", " in", " con", " su", " a" }, // Italian
|
2003-05-25 18:56:20 +00:00
|
|
|
{ " ", " in", " with", " on", " to" }, // Portugese
|
2003-06-19 10:29:38 +00:00
|
|
|
{ " ", " an", " con", " on", " a" }, // Spanish
|
2003-05-25 18:56:20 +00:00
|
|
|
{ " ", " in", " with", " on", " to" }, // Japanese
|
|
|
|
{ " ", " in", " with", " on", " to" }, // Chinese
|
|
|
|
{ " ", " in", " with", " on", " to" } // Korean
|
|
|
|
};
|
2003-05-25 20:38:44 +00:00
|
|
|
int lang = (_language <= 8) ? _language : 0;
|
|
|
|
strcat(sentence, prepositions[lang][VAR(VAR_SENTENCE_PREPOSITION)]);
|
2003-05-21 23:46:02 +00:00
|
|
|
}
|
|
|
|
|
2003-05-21 14:00:19 +00:00
|
|
|
if (VAR(VAR_SENTENCE_OBJECT2) > 0) {
|
|
|
|
temp = getObjOrActorName(VAR(VAR_SENTENCE_OBJECT2));
|
2003-05-21 11:22:03 +00:00
|
|
|
if (temp) {
|
2003-05-21 23:46:02 +00:00
|
|
|
strcat(sentence, " ");
|
2003-05-21 18:09:49 +00:00
|
|
|
strcat(sentence, (const char*)temp);
|
2003-05-21 10:13:06 +00:00
|
|
|
}
|
2003-05-16 12:58:49 +00:00
|
|
|
}
|
|
|
|
|
2003-05-21 06:00:16 +00:00
|
|
|
_string[2].charset = 1;
|
|
|
|
_string[2].ypos = virtscr[2].topline;
|
|
|
|
_string[2].xpos = 0;
|
2003-07-14 06:14:49 +00:00
|
|
|
if(_version == 1)
|
|
|
|
_string[2].color = 4;
|
2003-07-14 06:19:06 +00:00
|
|
|
else
|
|
|
|
_string[2].color = 13;
|
2003-05-21 06:00:16 +00:00
|
|
|
|
2003-07-12 22:46:23 +00:00
|
|
|
sentence[80] = 0;
|
2003-05-21 06:00:16 +00:00
|
|
|
_messagePtr = (byte*)sentence;
|
|
|
|
|
|
|
|
sentenceline.top = virtscr[2].topline;
|
|
|
|
sentenceline.bottom = virtscr[2].topline + 8;
|
|
|
|
sentenceline.left = 0;
|
2003-05-22 05:44:18 +00:00
|
|
|
sentenceline.right = 319;
|
2003-05-21 06:00:16 +00:00
|
|
|
restoreBG(sentenceline);
|
|
|
|
|
|
|
|
drawString(2);
|
2003-05-16 01:56:06 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 15:25:29 +00:00
|
|
|
void Scumm_v2::o2_ifClassOfIs() {
|
2003-05-22 13:57:34 +00:00
|
|
|
int obj = getVarOrDirectWord(0x80);
|
2003-04-21 15:25:29 +00:00
|
|
|
int clsop = getVarOrDirectByte(0x40);
|
2003-05-23 01:14:29 +00:00
|
|
|
byte *obcd = getOBCDFromObject(obj);
|
2003-04-21 15:25:29 +00:00
|
|
|
|
2003-05-23 01:14:29 +00:00
|
|
|
if (obcd == 0) {
|
2003-04-21 15:25:29 +00:00
|
|
|
o5_jumpRelative();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2003-05-22 13:57:34 +00:00
|
|
|
byte cls = *(obcd + 6);
|
2003-04-21 15:25:29 +00:00
|
|
|
if ((cls & clsop) != clsop) {
|
|
|
|
o5_jumpRelative();
|
2003-04-27 11:38:38 +00:00
|
|
|
return;
|
2003-04-21 15:25:29 +00:00
|
|
|
}
|
2003-04-27 11:38:38 +00:00
|
|
|
ignoreScriptWord();
|
2003-04-21 15:25:29 +00:00
|
|
|
}
|
2003-04-21 15:42:55 +00:00
|
|
|
|
|
|
|
void Scumm_v2::o2_walkActorTo() {
|
|
|
|
int x, y;
|
|
|
|
Actor *a;
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(getVarOrDirectByte(0x80), "o2_walkActorTo");
|
2003-05-23 00:22:41 +00:00
|
|
|
|
2003-05-10 23:47:39 +00:00
|
|
|
x = getVarOrDirectByte(0x40) * 8;
|
|
|
|
y = getVarOrDirectByte(0x20) * 2;
|
2003-05-11 00:03:03 +00:00
|
|
|
|
2003-05-18 23:46:30 +00:00
|
|
|
a->startWalkActor(x, y, -1);
|
2003-04-21 15:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_putActor() {
|
2003-05-17 01:01:05 +00:00
|
|
|
int act = getVarOrDirectByte(0x80);
|
2003-04-21 15:42:55 +00:00
|
|
|
int x, y;
|
|
|
|
Actor *a;
|
|
|
|
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(act, "o2_putActor");
|
2003-05-23 00:04:17 +00:00
|
|
|
|
2003-05-10 23:47:39 +00:00
|
|
|
x = getVarOrDirectByte(0x40) * 8;
|
|
|
|
y = getVarOrDirectByte(0x20) * 2;
|
2003-04-21 15:42:55 +00:00
|
|
|
|
|
|
|
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() {
|
2003-05-17 01:01:05 +00:00
|
|
|
panCameraTo(getVarOrDirectByte(0x80) * 8, 0);
|
2003-04-26 16:37:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_walkActorToObject() {
|
|
|
|
int obj;
|
|
|
|
Actor *a;
|
|
|
|
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(getVarOrDirectByte(0x80), "o2_walkActorToObject");
|
2003-05-22 00:51:42 +00:00
|
|
|
obj = getVarOrDirectWord(0x40);
|
2003-04-26 16:37:35 +00:00
|
|
|
if (whereIsObject(obj) != WIO_NOT_FOUND) {
|
|
|
|
int x, y, dir;
|
|
|
|
getObjectXYPos(obj, x, y, dir);
|
|
|
|
a->startWalkActor(x, y, dir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_putActorAtObject() {
|
|
|
|
int obj, x, y;
|
|
|
|
Actor *a;
|
|
|
|
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(getVarOrDirectByte(0x80), "o2_putActorAtObject");
|
2003-05-23 00:04:17 +00:00
|
|
|
|
2003-05-24 10:39:13 +00:00
|
|
|
obj = getVarOrDirectWord(0x40);
|
2003-04-26 16:37:35 +00:00
|
|
|
if (whereIsObject(obj) != WIO_NOT_FOUND)
|
|
|
|
getObjectXYPos(obj, x, y);
|
|
|
|
else {
|
|
|
|
x = 240;
|
|
|
|
y = 120;
|
|
|
|
}
|
2003-05-23 00:04:17 +00:00
|
|
|
|
2003-04-26 16:37:35 +00:00
|
|
|
a->putActor(x, y, a->room);
|
|
|
|
}
|
|
|
|
|
2003-07-01 04:20:41 +00:00
|
|
|
void Scumm_v2::o2_getActorElevation() {
|
2003-07-02 11:26:13 +00:00
|
|
|
getResultPos();
|
|
|
|
int act = getVarOrDirectByte(0x80);
|
|
|
|
Actor *a = derefActor(act, "o2_getActorElevation");
|
|
|
|
setResult(a->elevation / 2);
|
2003-07-01 04:20:41 +00:00
|
|
|
}
|
|
|
|
|
2003-04-27 11:38:38 +00:00
|
|
|
void Scumm_v2::o2_setActorElevation() {
|
|
|
|
int act = getVarOrDirectByte(0x80);
|
2003-07-02 11:26:13 +00:00
|
|
|
int elevation = (int8)getVarOrDirectByte(0x40);
|
2003-04-27 11:38:38 +00:00
|
|
|
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(act, "o2_setActorElevation");
|
2003-07-01 04:20:41 +00:00
|
|
|
a->elevation = elevation * 2;
|
2003-04-27 11:38:38 +00:00
|
|
|
}
|
|
|
|
|
2003-04-26 16:37:35 +00:00
|
|
|
void Scumm_v2::o2_animateActor() {
|
|
|
|
int act = getVarOrDirectByte(0x80);
|
|
|
|
int anim = getVarOrDirectByte(0x40);
|
|
|
|
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(act, "o2_animateActor");
|
2003-04-26 16:37:35 +00:00
|
|
|
a->animateActor(anim);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_actorFromPos() {
|
|
|
|
int x, y;
|
|
|
|
getResultPos();
|
2003-05-11 00:03:03 +00:00
|
|
|
x = getVarOrDirectByte(0x80) * 8;
|
|
|
|
y = getVarOrDirectByte(0x40) * 2;
|
2003-04-30 11:15:11 +00:00
|
|
|
setResult(getActorFromPos(x, y));
|
2003-04-26 16:37:35 +00:00
|
|
|
}
|
|
|
|
|
2003-05-11 00:03:03 +00:00
|
|
|
void Scumm_v2::o2_findObject() {
|
|
|
|
getResultPos();
|
|
|
|
int x = getVarOrDirectByte(0x80) * 8;
|
|
|
|
int y = getVarOrDirectByte(0x40) * 2;
|
|
|
|
setResult(findObject(x, y));
|
|
|
|
}
|
|
|
|
|
2003-04-26 16:37:35 +00:00
|
|
|
void Scumm_v2::o2_saveLoadGame() {
|
|
|
|
getResultPos();
|
|
|
|
byte a = getVarOrDirectByte(0x80);
|
|
|
|
|
2003-06-21 01:44:47 +00:00
|
|
|
warning("TODO: o2_saveLoadGame(%d)", a);
|
2003-04-30 11:15:11 +00:00
|
|
|
setResult(0);
|
2003-04-26 16:37:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_getActorX() {
|
|
|
|
int a;
|
|
|
|
getResultPos();
|
|
|
|
|
|
|
|
a = getVarOrDirectByte(0x80);
|
2003-05-16 02:33:08 +00:00
|
|
|
setResult(getObjX(a) / 8);
|
2003-04-26 16:37:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_getActorY() {
|
|
|
|
int a;
|
|
|
|
getResultPos();
|
|
|
|
|
|
|
|
a = getVarOrDirectByte(0x80);
|
2003-05-16 02:33:08 +00:00
|
|
|
setResult(getObjY(a) / 2);
|
2003-04-26 16:37:35 +00:00
|
|
|
}
|
|
|
|
|
2003-07-14 19:57:44 +00:00
|
|
|
void Scumm_v2::o2_isGreater() {
|
|
|
|
uint16 a = getVar();
|
|
|
|
uint16 b = getVarOrDirectWord(0x80);
|
|
|
|
if (b > a)
|
|
|
|
ignoreScriptWord();
|
|
|
|
else
|
|
|
|
o5_jumpRelative();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_isGreaterEqual() {
|
|
|
|
uint16 a = getVar();
|
|
|
|
uint16 b = getVarOrDirectWord(0x80);
|
|
|
|
if (b >= a)
|
|
|
|
ignoreScriptWord();
|
|
|
|
else
|
|
|
|
o5_jumpRelative();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_isLess() {
|
|
|
|
uint16 a = getVar();
|
|
|
|
uint16 b = getVarOrDirectWord(0x80);
|
|
|
|
|
|
|
|
if (b < a)
|
|
|
|
ignoreScriptWord();
|
|
|
|
else
|
|
|
|
o5_jumpRelative();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_isLessEqual() {
|
|
|
|
uint16 a = getVar();
|
|
|
|
uint16 b = getVarOrDirectWord(0x80);
|
|
|
|
if (b <= a)
|
|
|
|
ignoreScriptWord();
|
|
|
|
else
|
|
|
|
o5_jumpRelative();
|
|
|
|
}
|
|
|
|
|
2003-04-26 16:37:35 +00:00
|
|
|
void Scumm_v2::o2_loadRoomWithEgo() {
|
|
|
|
Actor *a;
|
|
|
|
int obj, room, x, y;
|
|
|
|
|
|
|
|
obj = getVarOrDirectWord(0x80);
|
|
|
|
room = getVarOrDirectByte(0x40);
|
|
|
|
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(VAR(VAR_EGO), "o2_loadRoomWithEgo");
|
2003-04-26 16:37:35 +00:00
|
|
|
|
|
|
|
a->putActor(0, 0, room);
|
|
|
|
_egoPositioned = false;
|
|
|
|
|
2003-07-02 14:21:13 +00:00
|
|
|
x = (int8)fetchScriptByte() * 8;
|
|
|
|
y = (int8)fetchScriptByte() * 2;
|
2003-04-26 16:37:35 +00:00
|
|
|
|
|
|
|
startScene(a->room, a, obj);
|
|
|
|
|
|
|
|
camera._dest.x = camera._cur.x = a->x;
|
|
|
|
setCameraAt(a->x, a->y);
|
|
|
|
setCameraFollows(a);
|
|
|
|
|
|
|
|
_fullRedraw = 1;
|
|
|
|
|
2003-05-18 12:52:27 +00:00
|
|
|
resetSentence();
|
|
|
|
|
2003-07-02 14:21:13 +00:00
|
|
|
if (x >= 0 && y >= 0) {
|
2003-04-26 16:37:35 +00:00
|
|
|
a->startWalkActor(x, y, -1);
|
|
|
|
}
|
|
|
|
runScript(5, 0, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_setOwnerOf() {
|
|
|
|
int obj, owner;
|
|
|
|
|
|
|
|
obj = getVarOrDirectWord(0x80);
|
|
|
|
owner = getVarOrDirectByte(0x40);
|
|
|
|
|
|
|
|
setOwnerOf(obj, owner);
|
|
|
|
}
|
|
|
|
|
2003-05-04 00:41:52 +00:00
|
|
|
void Scumm_v2::o2_delay() {
|
|
|
|
int delay = fetchScriptByte();
|
|
|
|
delay |= fetchScriptByte() << 8;
|
|
|
|
delay |= fetchScriptByte() << 16;
|
|
|
|
delay = 0xFFFFFF - delay;
|
|
|
|
|
|
|
|
vm.slot[_currentScript].delay = delay;
|
|
|
|
vm.slot[_currentScript].status = 1;
|
|
|
|
o5_breakHere();
|
|
|
|
}
|
|
|
|
|
2003-05-20 16:13:34 +00:00
|
|
|
void Scumm_v2::o2_setBoxFlags() {
|
2003-04-26 16:37:35 +00:00
|
|
|
int a, b;
|
|
|
|
|
|
|
|
a = getVarOrDirectByte(0x80);
|
|
|
|
b = fetchScriptByte();
|
|
|
|
setBoxFlags(a, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_setCameraAt() {
|
2003-05-09 05:55:11 +00:00
|
|
|
setCameraAtEx(getVarOrDirectByte(0x80) * 8); // FIXME: I'm pretty sure we actually pan
|
|
|
|
// by strip, not X/Y, here. Hence *8
|
2003-04-26 16:37:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_roomOps() {
|
|
|
|
int a = getVarOrDirectByte(0x80);
|
|
|
|
int b = getVarOrDirectByte(0x40);
|
|
|
|
|
|
|
|
_opcode = fetchScriptByte();
|
|
|
|
switch (_opcode & 0x1F) {
|
|
|
|
case 1: /* room scroll */
|
2003-05-24 17:18:23 +00:00
|
|
|
a *= 8;
|
|
|
|
b *= 8;
|
2003-05-10 21:49:59 +00:00
|
|
|
if (a < (_screenWidth / 2))
|
|
|
|
a = (_screenWidth / 2);
|
|
|
|
if (b < (_screenWidth / 2))
|
|
|
|
b = (_screenWidth / 2);
|
|
|
|
if (a > _roomWidth - (_screenWidth / 2))
|
|
|
|
a = _roomWidth - (_screenWidth / 2);
|
|
|
|
if (b > _roomWidth - (_screenWidth / 2))
|
|
|
|
b = _roomWidth - (_screenWidth / 2);
|
2003-05-08 15:48:50 +00:00
|
|
|
VAR(VAR_CAMERA_MIN_X) = a;
|
|
|
|
VAR(VAR_CAMERA_MAX_X) = b;
|
2003-04-26 16:37:35 +00:00
|
|
|
break;
|
|
|
|
case 2: /* room color */
|
|
|
|
_shadowPalette[b] = a;
|
|
|
|
_fullRedraw = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_cutscene() {
|
2003-05-21 20:34:21 +00:00
|
|
|
//warning("TODO o2_cutscene()");
|
2003-05-21 14:00:19 +00:00
|
|
|
|
2003-07-12 22:00:59 +00:00
|
|
|
vm.cutSceneData[0] = _userState | (_userPut ? 16 : 0);
|
2003-07-02 14:21:13 +00:00
|
|
|
vm.cutSceneData[1] = (int16)VAR(VAR_CURSORSTATE);
|
2003-05-21 14:00:19 +00:00
|
|
|
vm.cutSceneData[2] = _currentRoom;
|
|
|
|
vm.cutSceneData[3] = camera._mode;
|
|
|
|
|
|
|
|
VAR(VAR_CURSORSTATE) = 200;
|
|
|
|
|
2003-07-12 22:00:59 +00:00
|
|
|
// Hide inventory, freeze scripts, hide cursor
|
|
|
|
setUserState(15);
|
2003-05-21 14:00:19 +00:00
|
|
|
|
2003-05-17 18:30:47 +00:00
|
|
|
_sentenceNum = 0;
|
2003-05-20 20:58:26 +00:00
|
|
|
stopScript(SENTENCE_SCRIPT);
|
2003-05-18 12:52:27 +00:00
|
|
|
resetSentence();
|
2003-05-21 14:00:19 +00:00
|
|
|
|
|
|
|
vm.cutScenePtr[0] = 0;
|
2003-04-26 16:37:35 +00:00
|
|
|
}
|
|
|
|
|
2003-04-26 20:03:38 +00:00
|
|
|
void Scumm_v2::o2_endCutscene() {
|
2003-05-21 20:34:21 +00:00
|
|
|
//warning("TODO o2_endCutscene()");
|
2003-05-21 14:00:19 +00:00
|
|
|
|
|
|
|
vm.cutSceneStackPointer = 0;
|
|
|
|
|
|
|
|
VAR(VAR_OVERRIDE) = 0;
|
|
|
|
vm.cutSceneScript[0] = 0;
|
|
|
|
vm.cutScenePtr[0] = 0;
|
|
|
|
|
|
|
|
VAR(VAR_CURSORSTATE) = vm.cutSceneData[1];
|
|
|
|
|
2003-07-12 22:00:59 +00:00
|
|
|
// Reset user state to values before cutscene
|
|
|
|
setUserState(vm.cutSceneData[0] | 7);
|
2003-05-21 14:00:19 +00:00
|
|
|
|
2003-06-06 10:47:12 +00:00
|
|
|
if (_gameId == GID_MANIAC) {
|
2003-05-21 17:34:01 +00:00
|
|
|
camera._mode = (byte) vm.cutSceneData[3];
|
2003-05-21 14:00:19 +00:00
|
|
|
if (camera._mode == CM_FOLLOW_ACTOR) {
|
|
|
|
actorFollowCamera(VAR(VAR_EGO));
|
|
|
|
} else if (vm.cutSceneData[2] != _currentRoom) {
|
|
|
|
startScene(vm.cutSceneData[2], 0, 0);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
actorFollowCamera(VAR(VAR_EGO));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_beginOverride() {
|
|
|
|
vm.cutScenePtr[0] = _scriptPointer - _scriptOrgPointer;
|
|
|
|
vm.cutSceneScript[0] = _currentScript;
|
|
|
|
|
|
|
|
// Skip the jump instruction following the override instruction
|
|
|
|
fetchScriptByte();
|
|
|
|
fetchScriptWord();
|
2003-04-26 20:03:38 +00:00
|
|
|
}
|
|
|
|
|
2003-04-26 16:37:35 +00:00
|
|
|
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);
|
2003-05-08 15:48:50 +00:00
|
|
|
putOwner(obj, VAR(VAR_EGO));
|
2003-05-10 21:35:06 +00:00
|
|
|
putState(obj, getState(obj) | 0xA);
|
2003-04-26 16:37:35 +00:00
|
|
|
clearDrawObjectQueue();
|
2003-05-21 06:00:16 +00:00
|
|
|
|
2003-06-14 12:23:30 +00:00
|
|
|
runInventoryScript(1);
|
2003-04-26 16:37:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_setObjectName() {
|
|
|
|
int obj = getVarOrDirectWord(0x80);
|
2003-05-23 06:35:47 +00:00
|
|
|
int size = 0;
|
2003-04-26 16:37:35 +00:00
|
|
|
int a;
|
|
|
|
int i = 0;
|
|
|
|
byte *name = NULL;
|
|
|
|
byte work[256];
|
|
|
|
|
|
|
|
// Read in new name
|
|
|
|
do {
|
|
|
|
a = fetchScriptByte();
|
|
|
|
work[i++] = a;
|
|
|
|
} while (a);
|
|
|
|
|
2003-05-13 23:42:41 +00:00
|
|
|
if (obj < _numActors)
|
2003-04-26 16:37:35 +00:00
|
|
|
error("Can't set actor %d name with new-name-of", obj);
|
|
|
|
|
2003-05-31 12:17:58 +00:00
|
|
|
// TODO: Would be nice if we used rtObjectName resource for pre-V6
|
|
|
|
// games, too. The only problem with that which I can see is that this
|
|
|
|
// would break savegames. I.e. it would require yet another change to
|
|
|
|
// the save/load system.
|
|
|
|
|
|
|
|
// FIXME: This is rather nasty code.
|
|
|
|
// Find the object name in the OBCD resource.
|
|
|
|
byte *objptr;
|
|
|
|
objptr = getOBCDFromObject(obj);
|
|
|
|
if (objptr == NULL)
|
|
|
|
return; // Silently fail for now
|
|
|
|
name = objptr + *(objptr + 14);
|
2003-04-26 16:37:35 +00:00
|
|
|
|
2003-06-07 00:49:36 +00:00
|
|
|
while (name[size++])
|
2003-05-28 19:54:46 +00:00
|
|
|
;
|
2003-04-26 16:37:35 +00:00
|
|
|
|
2003-05-23 06:35:47 +00:00
|
|
|
if (i > size) {
|
2003-04-26 16:37:35 +00:00
|
|
|
warning("New name of object %d too long (old *%s* new *%s*)", obj, name, work);
|
2003-05-23 06:35:47 +00:00
|
|
|
i = size;
|
2003-04-26 16:37:35 +00:00
|
|
|
}
|
|
|
|
|
2003-05-28 19:54:46 +00:00
|
|
|
while (i < size) {
|
|
|
|
work[i-1] = '@';
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
work[i-1] = 0;
|
|
|
|
|
2003-05-23 06:35:47 +00:00
|
|
|
memcpy(name, work, i);
|
2003-06-14 12:23:30 +00:00
|
|
|
runInventoryScript(0);
|
2003-04-26 16:37:35 +00:00
|
|
|
}
|
|
|
|
|
2003-05-21 07:22:43 +00:00
|
|
|
void Scumm_v2::o2_cursorCommand() { // TODO: Define the magic numbers
|
2003-07-12 22:00:59 +00:00
|
|
|
uint16 cmd = getVarOrDirectWord(0x80);
|
|
|
|
byte state = cmd >> 8;
|
2003-05-04 04:30:49 +00:00
|
|
|
|
2003-05-21 20:34:21 +00:00
|
|
|
if (cmd & 0xFF) {
|
2003-05-21 14:00:19 +00:00
|
|
|
VAR(VAR_CURSORSTATE) = cmd & 0xFF;
|
2003-05-18 12:52:27 +00:00
|
|
|
}
|
2003-07-12 22:00:59 +00:00
|
|
|
|
|
|
|
setUserState(state);
|
|
|
|
}
|
2003-05-21 06:14:02 +00:00
|
|
|
|
2003-07-12 22:00:59 +00:00
|
|
|
void Scumm_v2::setUserState(byte state) {
|
|
|
|
if (state & 4) { // Userface
|
|
|
|
_userState = state & (32 | 64 | 128);
|
2003-06-14 12:23:30 +00:00
|
|
|
runInventoryScript(0);
|
2003-05-21 07:22:43 +00:00
|
|
|
}
|
2003-05-04 04:30:49 +00:00
|
|
|
|
2003-07-12 22:00:59 +00:00
|
|
|
if (state & 1) { // Freeze
|
|
|
|
if (state & 8)
|
2003-05-04 04:30:49 +00:00
|
|
|
freezeScripts(0);
|
|
|
|
else
|
|
|
|
unfreezeScripts();
|
|
|
|
}
|
|
|
|
|
2003-07-12 22:00:59 +00:00
|
|
|
if (state & 2) { // Cursor Show/Hide
|
2003-07-12 22:33:03 +00:00
|
|
|
|
|
|
|
// Mark verbs as hidden/visible
|
|
|
|
for (int i = 0; i < _maxVerbs; i++) {
|
|
|
|
_verbs[i].saveid = !(state & 16);
|
|
|
|
}
|
|
|
|
|
2003-07-12 22:00:59 +00:00
|
|
|
if (state & 16) {
|
2003-05-21 07:22:43 +00:00
|
|
|
_userPut = 1;
|
2003-05-10 23:47:39 +00:00
|
|
|
_cursor.state = 1;
|
2003-07-12 22:33:03 +00:00
|
|
|
|
|
|
|
// Draw all verbs
|
|
|
|
redrawVerbs();
|
2003-05-21 07:22:43 +00:00
|
|
|
} else {
|
|
|
|
_userPut = 0;
|
2003-05-10 23:47:39 +00:00
|
|
|
_cursor.state = 0;
|
2003-07-12 22:33:03 +00:00
|
|
|
|
|
|
|
// Hide all verbs
|
|
|
|
ScummVM::Rect rect;
|
|
|
|
rect.top = virtscr[2].topline;
|
|
|
|
rect.bottom = virtscr[2].topline + 6*88;
|
|
|
|
rect.left = 0;
|
|
|
|
rect.right = 319;
|
|
|
|
restoreBG(rect);
|
2003-05-21 07:22:43 +00:00
|
|
|
}
|
2003-05-04 04:30:49 +00:00
|
|
|
}
|
2003-04-26 20:03:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scumm_v2::o2_getActorWalkBox() {
|
|
|
|
Actor *a;
|
|
|
|
getResultPos();
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(getVarOrDirectByte(0x80), "o2_getActorWalkbox");
|
2003-05-23 00:22:41 +00:00
|
|
|
setResult(a->walkbox);
|
2003-04-26 20:03:38 +00:00
|
|
|
}
|
|
|
|
|
2003-05-04 00:29:52 +00:00
|
|
|
void Scumm_v2::o2_dummy() {
|
|
|
|
warning("o2_dummy invoked (opcode %d)", _opcode);
|
|
|
|
}
|
|
|
|
|
2003-05-18 12:52:27 +00:00
|
|
|
void Scumm_v2::resetSentence() {
|
2003-05-21 14:00:19 +00:00
|
|
|
VAR(VAR_SENTENCE_VERB) = VAR(VAR_BACKUP_VERB);
|
|
|
|
VAR(VAR_SENTENCE_OBJECT1) = 0;
|
|
|
|
VAR(VAR_SENTENCE_OBJECT2) = 0;
|
2003-05-22 14:10:20 +00:00
|
|
|
VAR(VAR_SENTENCE_PREPOSITION) = 0;
|
2003-05-18 12:52:27 +00:00
|
|
|
}
|