2005-05-18 02:32:25 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2001-2006 The ScummVM project
|
2005-05-18 02:32:25 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2005-05-18 02:32:25 +00:00
|
|
|
*
|
2006-02-11 09:55:41 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2005-05-18 02:32:25 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2005-06-24 15:23:51 +00:00
|
|
|
#include "common/stdafx.h"
|
2005-05-18 02:32:25 +00:00
|
|
|
#include "scumm/actor.h"
|
|
|
|
#include "scumm/charset.h"
|
|
|
|
#include "scumm/intern.h"
|
|
|
|
#include "scumm/object.h"
|
|
|
|
#include "scumm/scumm.h"
|
|
|
|
#include "scumm/util.h"
|
|
|
|
#include "scumm/verbs.h"
|
|
|
|
|
|
|
|
namespace Scumm {
|
|
|
|
|
|
|
|
#define OPCODE(x) _OPCODE(ScummEngine_c64, x)
|
|
|
|
|
|
|
|
void ScummEngine_c64::setupOpcodes() {
|
|
|
|
static const OpcodeEntryC64 opcodes[256] = {
|
|
|
|
/* 00 */
|
|
|
|
OPCODE(o5_stopObjectCode),
|
|
|
|
OPCODE(o2_putActor),
|
2005-09-24 14:28:00 +00:00
|
|
|
OPCODE(o5_startMusic),
|
|
|
|
OPCODE(o_doSentence),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 04 */
|
2005-09-06 15:40:12 +00:00
|
|
|
OPCODE(o_isGreaterEqual),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o5_getDist),
|
2005-05-19 14:33:52 +00:00
|
|
|
OPCODE(o5_getActorRoom),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 08 */
|
2005-09-06 15:40:12 +00:00
|
|
|
OPCODE(o_isNotEqual),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o_setActorBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 0C */
|
2005-05-18 15:30:31 +00:00
|
|
|
OPCODE(o_loadSound),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_printEgo_c64),
|
2005-05-19 14:33:52 +00:00
|
|
|
OPCODE(o_putActorAtObject),
|
2005-09-05 14:44:43 +00:00
|
|
|
OPCODE(o2_clearState02),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 10 */
|
2005-05-20 06:39:18 +00:00
|
|
|
OPCODE(o5_breakHere),
|
2005-05-20 06:47:57 +00:00
|
|
|
OPCODE(o_animateActor),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_panCameraTo),
|
2005-09-24 00:32:03 +00:00
|
|
|
OPCODE(o_lockActor),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 14 */
|
2005-09-14 08:20:37 +00:00
|
|
|
OPCODE(o_print_c64),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_actorFromPos),
|
|
|
|
OPCODE(o5_getRandomNr),
|
2005-09-14 08:20:37 +00:00
|
|
|
OPCODE(o_clearState08),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 18 */
|
2005-09-06 15:40:12 +00:00
|
|
|
OPCODE(o_jumpRelative),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o5_move),
|
|
|
|
OPCODE(o_getActorBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 1C */
|
|
|
|
OPCODE(o5_startSound),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o2_setBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_walkActorTo),
|
2005-09-05 14:44:43 +00:00
|
|
|
OPCODE(o2_ifState04),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 20 */
|
|
|
|
OPCODE(o5_stopMusic),
|
|
|
|
OPCODE(o2_putActor),
|
|
|
|
OPCODE(o5_saveLoadGame),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 24 */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_unknown2),
|
2005-05-18 15:30:31 +00:00
|
|
|
OPCODE(o5_loadRoom),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_getClosestObjActor),
|
2005-05-19 14:33:52 +00:00
|
|
|
OPCODE(o2_getActorY),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 28 */
|
2005-09-06 15:40:12 +00:00
|
|
|
OPCODE(o_equalZero),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_setOwnerOf),
|
2005-05-18 15:30:31 +00:00
|
|
|
OPCODE(o2_delay),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_setActorBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 2C */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o5_putActorInRoom),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_print_c64),
|
2005-09-05 14:44:43 +00:00
|
|
|
OPCODE(o2_ifState08),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 30 */
|
2005-05-19 14:33:52 +00:00
|
|
|
OPCODE(o_loadActor),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_getBitVar),
|
|
|
|
OPCODE(o2_setCameraAt),
|
2005-09-24 00:32:03 +00:00
|
|
|
OPCODE(o_lockScript),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 34 */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o5_getDist),
|
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o2_walkActorToObject),
|
2005-09-05 14:44:43 +00:00
|
|
|
OPCODE(o2_clearState04),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 38 */
|
2005-09-06 15:40:12 +00:00
|
|
|
OPCODE(o_isLessEqual),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o2_subtract),
|
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 3C */
|
|
|
|
OPCODE(o5_stopSound),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o2_setBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_walkActorTo),
|
2005-05-20 06:29:34 +00:00
|
|
|
OPCODE(o2_ifState02),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 40 */
|
|
|
|
OPCODE(o2_cutscene),
|
|
|
|
OPCODE(o2_putActor),
|
|
|
|
OPCODE(o2_startScript),
|
2005-09-24 14:28:00 +00:00
|
|
|
OPCODE(o_doSentence),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 44 */
|
2005-09-06 15:40:12 +00:00
|
|
|
OPCODE(o_isLess),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o5_increment),
|
2005-05-19 14:33:52 +00:00
|
|
|
OPCODE(o2_getActorX),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 48 */
|
2005-09-06 15:40:12 +00:00
|
|
|
OPCODE(o_isEqual),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-05-19 14:33:52 +00:00
|
|
|
OPCODE(o_loadRoom),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_setActorBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 4C */
|
2005-05-18 15:30:31 +00:00
|
|
|
OPCODE(o_loadScript),
|
2005-09-24 00:32:03 +00:00
|
|
|
OPCODE(o_lockRoom),
|
2005-05-19 14:33:52 +00:00
|
|
|
OPCODE(o_putActorAtObject),
|
2005-09-05 14:44:43 +00:00
|
|
|
OPCODE(o2_clearState02),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 50 */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_nop),
|
2005-05-20 06:47:57 +00:00
|
|
|
OPCODE(o_animateActor),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o5_actorFollowCamera),
|
2005-09-24 05:26:12 +00:00
|
|
|
OPCODE(o_lockSound),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 54 */
|
|
|
|
OPCODE(o5_setObjectName),
|
|
|
|
OPCODE(o2_actorFromPos),
|
2005-09-22 13:34:20 +00:00
|
|
|
OPCODE(o_getActorMoving),
|
2005-09-14 08:20:37 +00:00
|
|
|
OPCODE(o_clearState08),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 58 */
|
2005-09-06 15:40:12 +00:00
|
|
|
OPCODE(o_beginOverride),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o2_add),
|
|
|
|
OPCODE(o_getActorBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 5C */
|
2005-05-20 06:29:34 +00:00
|
|
|
OPCODE(o5_startSound),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o2_setBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_walkActorTo),
|
2005-09-05 14:44:43 +00:00
|
|
|
OPCODE(o2_ifState04),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 60 */
|
2005-05-18 15:30:31 +00:00
|
|
|
OPCODE(o_cursorCommand),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_putActor),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o2_stopScript),
|
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 64 */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_unknown3),
|
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o_getClosestObjActor),
|
2005-09-05 14:44:43 +00:00
|
|
|
OPCODE(o5_getActorFacing),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 68 */
|
|
|
|
OPCODE(o5_isScriptRunning),
|
|
|
|
OPCODE(o2_setOwnerOf),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o_setActorBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 6C */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o5_putActorInRoom),
|
|
|
|
OPCODE(o2_dummy),
|
2005-05-18 15:30:31 +00:00
|
|
|
OPCODE(o2_ifState08),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 70 */
|
2005-05-18 15:30:31 +00:00
|
|
|
OPCODE(o_lights),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o2_getBitVar),
|
|
|
|
OPCODE(o_nop),
|
|
|
|
OPCODE(o5_getObjectOwner),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 74 */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o5_getDist),
|
2005-09-14 08:20:37 +00:00
|
|
|
OPCODE(o_printEgo_c64),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o2_walkActorToObject),
|
2005-09-05 14:44:43 +00:00
|
|
|
OPCODE(o2_clearState04),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 78 */
|
2005-09-06 15:40:12 +00:00
|
|
|
OPCODE(o_isGreater),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 7C */
|
|
|
|
OPCODE(o5_isSoundRunning),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o2_setBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_walkActorTo),
|
2005-09-05 14:44:43 +00:00
|
|
|
OPCODE(o2_ifNotState02),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 80 */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_putActor),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-09-24 14:28:00 +00:00
|
|
|
OPCODE(o_doSentence),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 84 */
|
2005-09-06 15:40:12 +00:00
|
|
|
OPCODE(o_isGreaterEqual),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-09-05 14:44:43 +00:00
|
|
|
OPCODE(o_badOpcode),
|
2005-05-19 14:33:52 +00:00
|
|
|
OPCODE(o5_getActorRoom),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 88 */
|
2005-09-06 15:40:12 +00:00
|
|
|
OPCODE(o_isNotEqual),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o_setActorBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 8C */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_loadSound),
|
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-05-19 14:33:52 +00:00
|
|
|
OPCODE(o_putActorAtObject),
|
2005-09-05 14:44:43 +00:00
|
|
|
OPCODE(o2_setState02),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 90 */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o2_pickupObject),
|
2005-05-20 06:47:57 +00:00
|
|
|
OPCODE(o_animateActor),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_panCameraTo),
|
2005-09-24 00:32:03 +00:00
|
|
|
OPCODE(o_unlockActor),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 94 */
|
|
|
|
OPCODE(o5_print),
|
|
|
|
OPCODE(o2_actorFromPos),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-09-14 08:20:37 +00:00
|
|
|
OPCODE(o_setState08),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 98 */
|
|
|
|
OPCODE(o2_restart),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o5_move),
|
|
|
|
OPCODE(o_getActorBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* 9C */
|
|
|
|
OPCODE(o5_startSound),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o2_setBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_walkActorTo),
|
2005-05-20 06:29:34 +00:00
|
|
|
OPCODE(o2_ifNotState04),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* A0 */
|
|
|
|
OPCODE(o5_stopObjectCode),
|
|
|
|
OPCODE(o2_putActor),
|
|
|
|
OPCODE(o5_saveLoadGame),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* A4 */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_unknown2),
|
2005-05-20 06:29:34 +00:00
|
|
|
OPCODE(o5_loadRoom),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-05-19 14:33:52 +00:00
|
|
|
OPCODE(o2_getActorY),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* A8 */
|
2005-09-06 15:40:12 +00:00
|
|
|
OPCODE(o_notEqualZero),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_setOwnerOf),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o_setActorBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* AC */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o5_putActorInRoom),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_print_c64),
|
2005-05-20 06:29:34 +00:00
|
|
|
OPCODE(o2_ifNotState08),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* B0 */
|
2005-05-19 14:33:52 +00:00
|
|
|
OPCODE(o_loadActor),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_getBitVar),
|
|
|
|
OPCODE(o2_setCameraAt),
|
2005-09-24 00:32:03 +00:00
|
|
|
OPCODE(o_unlockScript),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* B4 */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o5_getDist),
|
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o2_walkActorToObject),
|
2005-05-20 06:29:34 +00:00
|
|
|
OPCODE(o2_setState04),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* B8 */
|
2005-09-06 15:40:12 +00:00
|
|
|
OPCODE(o_isLessEqual),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o2_subtract),
|
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* BC */
|
|
|
|
OPCODE(o5_stopSound),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o2_setBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_walkActorTo),
|
2005-09-05 14:44:43 +00:00
|
|
|
OPCODE(o2_ifNotState02),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* C0 */
|
|
|
|
OPCODE(o2_endCutscene),
|
|
|
|
OPCODE(o2_putActor),
|
|
|
|
OPCODE(o2_startScript),
|
2005-09-24 14:28:00 +00:00
|
|
|
OPCODE(o_doSentence),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* C4 */
|
2005-09-06 15:40:12 +00:00
|
|
|
OPCODE(o_isLess),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o5_decrement),
|
2005-05-19 14:33:52 +00:00
|
|
|
OPCODE(o2_getActorX),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* C8 */
|
2005-09-06 15:40:12 +00:00
|
|
|
OPCODE(o_isEqual),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-05-19 14:33:52 +00:00
|
|
|
OPCODE(o_loadRoom),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_setActorBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* CC */
|
2005-05-19 14:33:52 +00:00
|
|
|
OPCODE(o_loadScript),
|
2005-09-24 00:32:03 +00:00
|
|
|
OPCODE(o_unlockRoom),
|
2005-05-19 14:33:52 +00:00
|
|
|
OPCODE(o_putActorAtObject),
|
2005-09-05 14:44:43 +00:00
|
|
|
OPCODE(o2_setState02),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* D0 */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_nop),
|
2005-05-20 06:47:57 +00:00
|
|
|
OPCODE(o_animateActor),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o5_actorFollowCamera),
|
2005-09-24 05:26:12 +00:00
|
|
|
OPCODE(o_unlockSound),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* D4 */
|
|
|
|
OPCODE(o5_setObjectName),
|
|
|
|
OPCODE(o2_actorFromPos),
|
2005-09-22 13:34:20 +00:00
|
|
|
OPCODE(o_getActorMoving),
|
2005-09-14 08:20:37 +00:00
|
|
|
OPCODE(o_setState08),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* D8 */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o2_add),
|
|
|
|
OPCODE(o_getActorBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* DC */
|
2005-05-20 06:29:34 +00:00
|
|
|
OPCODE(o5_startSound),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o2_setBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_walkActorTo),
|
2005-05-20 06:29:34 +00:00
|
|
|
OPCODE(o2_ifNotState04),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* E0 */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_cursorCommand),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_putActor),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o2_stopScript),
|
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* E4 */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_unknown3),
|
2005-10-02 13:21:49 +00:00
|
|
|
OPCODE(o_loadRoomWithEgo),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-09-05 14:44:43 +00:00
|
|
|
OPCODE(o5_getActorFacing),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* E8 */
|
|
|
|
OPCODE(o5_isScriptRunning),
|
|
|
|
OPCODE(o2_setOwnerOf),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o_setActorBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* EC */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o5_putActorInRoom),
|
|
|
|
OPCODE(o2_dummy),
|
2005-05-18 15:30:31 +00:00
|
|
|
OPCODE(o2_ifNotState08),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* F0 */
|
2005-05-19 14:33:52 +00:00
|
|
|
OPCODE(o_lights),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o2_getBitVar),
|
|
|
|
OPCODE(o_nop),
|
|
|
|
OPCODE(o5_getObjectOwner),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* F4 */
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o5_getDist),
|
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o2_walkActorToObject),
|
2005-05-20 06:29:34 +00:00
|
|
|
OPCODE(o2_setState04),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* F8 */
|
2005-09-06 15:40:12 +00:00
|
|
|
OPCODE(o_isGreater),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o_stopCurrentScript),
|
|
|
|
OPCODE(o_stopCurrentScript),
|
2005-05-18 02:32:25 +00:00
|
|
|
/* FC */
|
|
|
|
OPCODE(o5_isSoundRunning),
|
2005-09-06 01:20:01 +00:00
|
|
|
OPCODE(o2_setBitVar),
|
2005-05-18 02:32:25 +00:00
|
|
|
OPCODE(o2_walkActorTo),
|
2005-05-19 14:33:52 +00:00
|
|
|
OPCODE(o2_ifState02)
|
2005-05-18 02:32:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_opcodesC64 = opcodes;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define SENTENCE_SCRIPT 2
|
|
|
|
|
|
|
|
#define PARAM_1 0x80
|
|
|
|
#define PARAM_2 0x40
|
|
|
|
#define PARAM_3 0x20
|
|
|
|
|
|
|
|
void ScummEngine_c64::executeOpcode(byte i) {
|
|
|
|
OpcodeProcC64 op = _opcodesC64[i].proc;
|
|
|
|
(this->*op) ();
|
|
|
|
}
|
|
|
|
|
2005-09-06 01:20:01 +00:00
|
|
|
int ScummEngine_c64::getVarOrDirectWord(byte mask) {
|
|
|
|
return getVarOrDirectByte(mask);
|
2005-05-18 15:30:31 +00:00
|
|
|
}
|
|
|
|
|
2005-09-06 01:20:01 +00:00
|
|
|
uint ScummEngine_c64::fetchScriptWord() {
|
|
|
|
return fetchScriptByte();
|
2005-05-18 15:30:31 +00:00
|
|
|
}
|
|
|
|
|
2005-09-06 01:20:01 +00:00
|
|
|
const char *ScummEngine_c64::getOpcodeDesc(byte i) {
|
|
|
|
return _opcodesC64[i].desc;
|
2005-05-18 15:30:31 +00:00
|
|
|
}
|
|
|
|
|
2005-09-14 08:20:37 +00:00
|
|
|
int ScummEngine_c64::getObjectFlag() {
|
|
|
|
if (_opcode & 0x40)
|
|
|
|
return _activeObject;
|
|
|
|
return fetchScriptByte();
|
|
|
|
}
|
|
|
|
|
2005-09-23 12:35:30 +00:00
|
|
|
void ScummEngine_c64::decodeParseString() {
|
|
|
|
byte buffer[512];
|
|
|
|
byte *ptr = buffer;
|
|
|
|
byte c;
|
|
|
|
bool insertSpace = false;
|
|
|
|
|
|
|
|
while ((c = fetchScriptByte())) {
|
|
|
|
|
|
|
|
insertSpace = (c & 0x80) != 0;
|
|
|
|
c &= 0x7f;
|
|
|
|
|
|
|
|
if (c == '/') {
|
|
|
|
*ptr++ = 13;
|
|
|
|
} else {
|
|
|
|
*ptr++ = c;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (insertSpace)
|
|
|
|
*ptr++ = ' ';
|
|
|
|
|
|
|
|
}
|
|
|
|
*ptr = 0;
|
|
|
|
|
|
|
|
int textSlot = 0;
|
|
|
|
_string[textSlot].xpos = 0;
|
|
|
|
_string[textSlot].ypos = 0;
|
|
|
|
_string[textSlot].right = 320;
|
|
|
|
_string[textSlot].center = false;
|
|
|
|
_string[textSlot].overhead = false;
|
|
|
|
|
|
|
|
if (_actorToPrintStrFor == 0xFF)
|
|
|
|
_string[textSlot].color = 14;
|
|
|
|
|
|
|
|
actorTalk(buffer);
|
|
|
|
}
|
|
|
|
|
2005-09-14 08:20:37 +00:00
|
|
|
void ScummEngine_c64::setStateCommon(byte type) {
|
|
|
|
int obj = getObjectFlag();
|
|
|
|
putState(obj, getState(obj) | type);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::clearStateCommon(byte type) {
|
|
|
|
int obj = getObjectFlag();
|
|
|
|
putState(obj, getState(obj) & ~type);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::ifStateCommon(byte type) {
|
|
|
|
int obj = getObjectFlag();
|
|
|
|
|
|
|
|
if ((getState(obj) & type) == 0) {
|
|
|
|
o_jumpRelative();
|
|
|
|
} else {
|
|
|
|
fetchScriptByte();
|
|
|
|
fetchScriptByte();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::ifNotStateCommon(byte type) {
|
|
|
|
int obj = getObjectFlag();
|
|
|
|
|
|
|
|
if ((getState(obj) & type) != 0) {
|
|
|
|
o_jumpRelative();
|
|
|
|
} else {
|
|
|
|
fetchScriptByte();
|
|
|
|
fetchScriptByte();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_setState08() {
|
|
|
|
int obj = getObjectFlag();
|
|
|
|
putState(obj, getState(obj) | 0x08);
|
|
|
|
markObjectRectAsDirty(obj);
|
|
|
|
clearDrawObjectQueue();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_clearState08() {
|
|
|
|
int obj = getObjectFlag();
|
|
|
|
putState(obj, getState(obj) & ~0x08);
|
|
|
|
markObjectRectAsDirty(obj);
|
|
|
|
clearDrawObjectQueue();
|
|
|
|
}
|
|
|
|
|
2005-09-06 01:20:01 +00:00
|
|
|
void ScummEngine_c64::o_stopCurrentScript() {
|
2005-05-20 06:29:34 +00:00
|
|
|
int script;
|
|
|
|
|
2005-09-06 01:20:01 +00:00
|
|
|
script = vm.slot[_currentScript].number;
|
2005-05-20 06:29:34 +00:00
|
|
|
|
|
|
|
if (_currentScript != 0 && vm.slot[_currentScript].number == script)
|
|
|
|
stopObjectCode();
|
|
|
|
else
|
|
|
|
stopScript(script);
|
|
|
|
}
|
|
|
|
|
2005-05-18 15:30:31 +00:00
|
|
|
void ScummEngine_c64::o_loadSound() {
|
|
|
|
int resid = fetchScriptByte();
|
|
|
|
ensureResourceLoaded(rtSound, resid);
|
|
|
|
}
|
|
|
|
|
2005-09-24 05:26:12 +00:00
|
|
|
void ScummEngine_c64::o_lockSound() {
|
|
|
|
int resid = fetchScriptByte();
|
|
|
|
res.lock(rtSound, resid);
|
|
|
|
debug(0, "o_lockSound (%d)", resid);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_unlockSound() {
|
|
|
|
int resid = fetchScriptByte();
|
|
|
|
res.unlock(rtSound, resid);
|
|
|
|
debug(0, "o_unlockSound (%d)", resid);
|
|
|
|
}
|
|
|
|
|
2005-05-19 14:33:52 +00:00
|
|
|
void ScummEngine_c64::o_loadActor() {
|
|
|
|
debug(0, "o_loadActor (%d)", getVarOrDirectByte(PARAM_1));
|
|
|
|
}
|
|
|
|
|
2005-09-24 00:32:03 +00:00
|
|
|
void ScummEngine_c64::o_lockActor() {
|
|
|
|
debug(0, "o_lockActor (%d)", fetchScriptByte());
|
2005-05-19 14:33:52 +00:00
|
|
|
}
|
|
|
|
|
2005-09-24 00:32:03 +00:00
|
|
|
void ScummEngine_c64::o_unlockActor() {
|
|
|
|
debug(0, "o_unlockActor (%d)", fetchScriptByte());
|
2005-05-19 14:33:52 +00:00
|
|
|
}
|
|
|
|
|
2005-05-18 15:30:31 +00:00
|
|
|
void ScummEngine_c64::o_loadScript() {
|
2005-05-19 14:33:52 +00:00
|
|
|
int resid = getVarOrDirectByte(PARAM_1);
|
2005-05-18 15:30:31 +00:00
|
|
|
ensureResourceLoaded(rtScript, resid);
|
|
|
|
}
|
|
|
|
|
2005-09-24 00:32:03 +00:00
|
|
|
void ScummEngine_c64::o_lockScript() {
|
|
|
|
int resid = fetchScriptByte();
|
|
|
|
res.lock(rtScript, resid);
|
|
|
|
debug(0, "o_lockScript (%d)", resid);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_unlockScript() {
|
|
|
|
int resid = fetchScriptByte();
|
|
|
|
res.unlock(rtScript, resid);
|
|
|
|
debug(0, "o_unlockScript (%d)", resid);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_loadRoom() {
|
|
|
|
int resid = getVarOrDirectByte(PARAM_1);
|
|
|
|
ensureResourceLoaded(rtRoom, resid);
|
|
|
|
}
|
|
|
|
|
2005-10-02 13:21:49 +00:00
|
|
|
void ScummEngine_c64::o_loadRoomWithEgo() {
|
|
|
|
Actor *a;
|
|
|
|
int obj, room, x, y, dir;
|
|
|
|
|
|
|
|
obj = fetchScriptByte();
|
|
|
|
room = fetchScriptByte();
|
|
|
|
|
|
|
|
a = derefActor(VAR(VAR_EGO), "o_loadRoomWithEgo");
|
|
|
|
|
|
|
|
a->putActor(0, 0, room);
|
|
|
|
_egoPositioned = false;
|
|
|
|
|
|
|
|
startScene(a->_room, a, obj);
|
|
|
|
|
|
|
|
getObjectXYPos(obj, x, y, dir);
|
|
|
|
a->putActor(x, y, _currentRoom);
|
|
|
|
a->setDirection(dir + 180);
|
|
|
|
|
|
|
|
camera._dest.x = camera._cur.x = a->_pos.x;
|
|
|
|
setCameraAt(a->_pos.x, a->_pos.y);
|
|
|
|
setCameraFollows(a);
|
|
|
|
|
|
|
|
_fullRedraw = true;
|
|
|
|
|
|
|
|
resetSentence();
|
|
|
|
|
|
|
|
if (x >= 0 && y >= 0) {
|
|
|
|
a->startWalkActor(x, y, -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-24 00:32:03 +00:00
|
|
|
void ScummEngine_c64::o_lockRoom() {
|
|
|
|
int resid = fetchScriptByte();
|
|
|
|
res.lock(rtRoom, resid);
|
|
|
|
debug(0, "o_lockRoom (%d)", resid);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_unlockRoom() {
|
|
|
|
int resid = fetchScriptByte();
|
|
|
|
res.unlock(rtRoom, resid);
|
|
|
|
debug(0, "o_unlockRoom (%d)", resid);
|
|
|
|
}
|
|
|
|
|
2005-05-18 15:30:31 +00:00
|
|
|
void ScummEngine_c64::o_cursorCommand() {
|
|
|
|
// TODO
|
2005-10-02 13:21:49 +00:00
|
|
|
int state = 0;
|
|
|
|
|
|
|
|
_currentMode = fetchScriptByte();
|
|
|
|
switch (_currentMode) {
|
|
|
|
case 0:
|
|
|
|
state = 15;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
state = 31;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
state = 247;
|
|
|
|
break;
|
2005-05-18 15:30:31 +00:00
|
|
|
}
|
2005-10-02 13:21:49 +00:00
|
|
|
|
|
|
|
setUserState(state);
|
|
|
|
debug(0, "o_cursorCommand(%d)", _currentMode);
|
2005-05-18 15:30:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_lights() {
|
|
|
|
int a;
|
|
|
|
|
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
|
|
|
// Convert older light mode values into
|
|
|
|
// equivalent values.of later games
|
|
|
|
// 0 Darkness
|
|
|
|
// 1 Flashlight
|
|
|
|
// 2 Lighted area
|
|
|
|
if (a == 2)
|
2005-07-30 21:11:48 +00:00
|
|
|
VAR(VAR_CURRENT_LIGHTS) = 11;
|
2005-05-18 15:30:31 +00:00
|
|
|
else if (a == 1)
|
|
|
|
VAR(VAR_CURRENT_LIGHTS) = 4;
|
2005-07-30 21:11:48 +00:00
|
|
|
else
|
2005-05-18 15:30:31 +00:00
|
|
|
VAR(VAR_CURRENT_LIGHTS) = 0;
|
|
|
|
|
2005-08-06 14:34:40 +00:00
|
|
|
_fullRedraw = true;
|
2005-05-18 15:30:31 +00:00
|
|
|
}
|
|
|
|
|
2005-05-20 06:47:57 +00:00
|
|
|
void ScummEngine_c64::o_animateActor() {
|
|
|
|
int act = getVarOrDirectByte(PARAM_1);
|
|
|
|
int anim = getVarOrDirectByte(PARAM_2);
|
|
|
|
int unk = fetchScriptByte();
|
|
|
|
debug(0,"o_animateActor: unk %d", unk);
|
|
|
|
|
|
|
|
Actor *a = derefActor(act, "o_animateActor");
|
|
|
|
a->animateActor(anim);
|
|
|
|
}
|
|
|
|
|
2005-09-22 13:34:20 +00:00
|
|
|
void ScummEngine_c64::o_getActorMoving() {
|
|
|
|
getResultPos();
|
|
|
|
int act = getVarOrDirectByte(PARAM_1);
|
|
|
|
Actor *a = derefActor(act, "o_getActorMoving");
|
|
|
|
if (a->_moving)
|
|
|
|
setResult(1);
|
|
|
|
else
|
|
|
|
setResult(2);
|
|
|
|
}
|
|
|
|
|
2005-05-19 14:33:52 +00:00
|
|
|
void ScummEngine_c64::o_putActorAtObject() {
|
|
|
|
int obj, x, y;
|
|
|
|
Actor *a;
|
|
|
|
|
|
|
|
a = derefActor(getVarOrDirectByte(PARAM_1), "o_putActorAtObject");
|
|
|
|
|
|
|
|
obj = fetchScriptByte();
|
|
|
|
if (whereIsObject(obj) != WIO_NOT_FOUND)
|
|
|
|
getObjectXYPos(obj, x, y);
|
|
|
|
else {
|
2005-09-06 01:20:01 +00:00
|
|
|
x = 30;
|
|
|
|
y = 60;
|
2005-05-19 14:33:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
a->putActor(x, y, a->_room);
|
|
|
|
}
|
|
|
|
|
2005-09-06 01:20:01 +00:00
|
|
|
void ScummEngine_c64::o_badOpcode() {
|
|
|
|
warning("Bad opcode 0x86 encountered");
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_nop() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_setActorBitVar() {
|
2005-10-02 13:21:49 +00:00
|
|
|
byte flag = getVarOrDirectByte(PARAM_1);
|
|
|
|
byte mask = getVarOrDirectByte(PARAM_2);
|
|
|
|
byte mod = getVarOrDirectByte(PARAM_3);
|
2005-09-06 01:20:01 +00:00
|
|
|
|
2005-10-02 13:21:49 +00:00
|
|
|
//if (mod)
|
|
|
|
// _miscFlags[flag] |= mask;
|
2005-09-06 01:20:01 +00:00
|
|
|
//else
|
2005-10-02 13:21:49 +00:00
|
|
|
// _miscFlags[flag] &= ~mash;
|
|
|
|
|
|
|
|
warning("STUB: o_setActorBitVar(%d, %d, %d)", flag, mask, mod);
|
2005-09-06 01:20:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_getActorBitVar() {
|
|
|
|
getResultPos();
|
2005-10-02 13:21:49 +00:00
|
|
|
byte flag = getVarOrDirectByte(PARAM_1);
|
|
|
|
byte mask = getVarOrDirectByte(PARAM_2);
|
2005-09-06 01:20:01 +00:00
|
|
|
|
2005-10-02 13:21:49 +00:00
|
|
|
//setResult((_miscFlags[flag] & mask) ? 1 : 0);
|
2005-09-06 01:20:01 +00:00
|
|
|
|
|
|
|
setResult(0);
|
2005-10-02 13:21:49 +00:00
|
|
|
warning("STUB: o_getActorBitVar(%d, %d)", flag, mask);
|
2005-09-06 01:20:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_print_c64() {
|
2005-09-14 08:20:37 +00:00
|
|
|
_actorToPrintStrFor = fetchScriptByte();
|
2005-09-06 01:20:01 +00:00
|
|
|
decodeParseString();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_printEgo_c64() {
|
|
|
|
_actorToPrintStrFor = (byte)VAR(VAR_EGO);
|
|
|
|
decodeParseString();
|
|
|
|
}
|
|
|
|
|
2005-09-24 14:28:00 +00:00
|
|
|
void ScummEngine_c64::o_doSentence() {
|
2005-09-06 01:20:01 +00:00
|
|
|
byte var1 = fetchScriptByte();
|
|
|
|
byte var2 = fetchScriptByte();
|
|
|
|
byte var3 = fetchScriptByte();
|
2005-09-24 14:28:00 +00:00
|
|
|
warning("STUB: o_doSentence(%d, %d, %d)", var1, var2, var3);
|
2005-09-06 01:20:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_unknown2() {
|
|
|
|
byte var1 = fetchScriptByte();
|
|
|
|
warning("STUB: o_unknown2(%d)", var1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_unknown3() {
|
|
|
|
byte var1 = fetchScriptByte();
|
|
|
|
warning("STUB: o_unknown3(%d)", var1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_getClosestObjActor() {
|
2005-05-19 14:33:52 +00:00
|
|
|
int obj;
|
2005-09-06 01:20:01 +00:00
|
|
|
int act;
|
|
|
|
int dist;
|
2005-05-19 14:33:52 +00:00
|
|
|
|
2005-09-06 01:20:01 +00:00
|
|
|
// This code can't detect any actors farther away than 255 units
|
|
|
|
// (pixels in newer games, characters in older ones.) But this is
|
|
|
|
// perfectly OK, as it is exactly how the original behaved.
|
|
|
|
|
|
|
|
int closest_obj = 0xFF, closest_dist = 0xFF;
|
|
|
|
|
|
|
|
getResultPos();
|
|
|
|
|
|
|
|
act = getVarOrDirectByte(PARAM_1);
|
|
|
|
obj = (_opcode & 0x40) ? 25 : 7;
|
|
|
|
|
|
|
|
do {
|
|
|
|
dist = getObjActToObjActDist(act, obj);
|
|
|
|
if (dist < closest_dist) {
|
|
|
|
closest_dist = dist;
|
|
|
|
closest_obj = obj;
|
|
|
|
}
|
|
|
|
} while (--obj);
|
|
|
|
|
|
|
|
setResult(closest_obj);
|
2005-05-19 14:33:52 +00:00
|
|
|
}
|
|
|
|
|
2005-09-06 15:40:12 +00:00
|
|
|
void ScummEngine_c64::o_beginOverride() {
|
2005-09-14 10:35:04 +00:00
|
|
|
const int idx = vm.cutSceneStackPointer;
|
|
|
|
assert(0 <= idx && idx < 5);
|
|
|
|
|
|
|
|
vm.cutScenePtr[idx] = _scriptPointer - _scriptOrgPointer;
|
|
|
|
vm.cutSceneScript[idx] = _currentScript;
|
|
|
|
|
|
|
|
// Skip the jump instruction following the override instruction
|
|
|
|
// (the jump is responsible for "skipping" cutscenes, and the reason
|
|
|
|
// why we record the current script position in vm.cutScenePtr).
|
2005-09-06 15:40:12 +00:00
|
|
|
fetchScriptByte();
|
2005-09-14 10:35:04 +00:00
|
|
|
ScummEngine::fetchScriptWord();
|
|
|
|
|
|
|
|
// This is based on disassembly
|
|
|
|
VAR(VAR_OVERRIDE) = 0;
|
2005-09-06 15:40:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_isEqual() {
|
|
|
|
int16 a, b;
|
|
|
|
int var;
|
|
|
|
|
|
|
|
var = fetchScriptByte();
|
|
|
|
a = readVar(var);
|
|
|
|
b = getVarOrDirectByte(PARAM_1);
|
|
|
|
|
|
|
|
if (b == a)
|
|
|
|
ScummEngine::fetchScriptWord();
|
|
|
|
else
|
|
|
|
o_jumpRelative();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_isGreater() {
|
|
|
|
int16 a = getVar();
|
|
|
|
int16 b = getVarOrDirectByte(PARAM_1);
|
|
|
|
if (b > a)
|
|
|
|
ScummEngine::fetchScriptWord();
|
|
|
|
else
|
|
|
|
o_jumpRelative();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_isGreaterEqual() {
|
|
|
|
int16 a = getVar();
|
|
|
|
int16 b = getVarOrDirectByte(PARAM_1);
|
|
|
|
if (b >= a)
|
|
|
|
ScummEngine::fetchScriptWord();
|
|
|
|
else
|
|
|
|
o_jumpRelative();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_isLess() {
|
|
|
|
int16 a = getVar();
|
|
|
|
int16 b = getVarOrDirectByte(PARAM_1);
|
|
|
|
if (b < a)
|
|
|
|
ScummEngine::fetchScriptWord();
|
|
|
|
else
|
|
|
|
o_jumpRelative();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_isLessEqual() {
|
|
|
|
int16 a = getVar();
|
|
|
|
int16 b = getVarOrDirectByte(PARAM_1);
|
|
|
|
|
|
|
|
if (b <= a)
|
|
|
|
ScummEngine::fetchScriptWord();
|
|
|
|
else
|
|
|
|
o_jumpRelative();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_isNotEqual() {
|
|
|
|
int16 a = getVar();
|
|
|
|
int16 b = getVarOrDirectByte(PARAM_1);
|
|
|
|
if (b != a)
|
|
|
|
ScummEngine::fetchScriptWord();
|
|
|
|
else
|
|
|
|
o_jumpRelative();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_notEqualZero() {
|
|
|
|
int a = getVar();
|
|
|
|
if (a != 0)
|
|
|
|
ScummEngine::fetchScriptWord();
|
|
|
|
else
|
|
|
|
o_jumpRelative();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_equalZero() {
|
|
|
|
int a = getVar();
|
|
|
|
if (a == 0)
|
|
|
|
ScummEngine::fetchScriptWord();
|
|
|
|
else
|
|
|
|
o_jumpRelative();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_c64::o_jumpRelative() {
|
|
|
|
int16 offset = (int16)ScummEngine::fetchScriptWord();
|
|
|
|
_scriptPointer += offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-05-18 02:32:25 +00:00
|
|
|
#undef PARAM_1
|
|
|
|
#undef PARAM_2
|
|
|
|
#undef PARAM_3
|
|
|
|
|
|
|
|
} // End of namespace Scumm
|