diff options
Diffstat (limited to 'scumm/script_c64.cpp')
-rw-r--r-- | scumm/script_c64.cpp | 382 |
1 files changed, 382 insertions, 0 deletions
diff --git a/scumm/script_c64.cpp b/scumm/script_c64.cpp new file mode 100644 index 0000000000..24dcf54431 --- /dev/null +++ b/scumm/script_c64.cpp @@ -0,0 +1,382 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2001 Ludvig Strigeus + * Copyright (C) 2001-2005 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/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), + OPCODE(o5_startMusic), + OPCODE(o5_getActorRoom), + /* 04 */ + OPCODE(o2_isGreaterEqual), + OPCODE(o2_drawObject), + OPCODE(o2_getActorElevation), + OPCODE(o2_setState08), + /* 08 */ + OPCODE(o5_isNotEqual), + OPCODE(o5_faceActor), + OPCODE(o2_assignVarWordIndirect), + OPCODE(o2_setObjPreposition), + /* 0C */ + OPCODE(o2_resourceRoutines), + OPCODE(o5_walkActorToActor), + OPCODE(o2_putActorAtObject), + OPCODE(o2_ifNotState08), + /* 10 */ + OPCODE(o5_getObjectOwner), + OPCODE(o2_animateActor), + OPCODE(o2_panCameraTo), + OPCODE(o2_actorOps), + /* 14 */ + OPCODE(o5_print), + OPCODE(o2_actorFromPos), + OPCODE(o5_getRandomNr), + OPCODE(o2_clearState02), + /* 18 */ + OPCODE(o5_jumpRelative), + OPCODE(o2_doSentence), + OPCODE(o5_move), + OPCODE(o2_setBitVar), + /* 1C */ + OPCODE(o5_startSound), + OPCODE(o2_ifClassOfIs), + OPCODE(o2_walkActorTo), + OPCODE(o2_ifState02), + /* 20 */ + OPCODE(o5_stopMusic), + OPCODE(o2_putActor), + OPCODE(o5_saveLoadGame), + OPCODE(o2_getActorY), + /* 24 */ + OPCODE(o2_loadRoomWithEgo), + OPCODE(o2_drawObject), + OPCODE(o5_setVarRange), + OPCODE(o2_setState04), + /* 28 */ + OPCODE(o5_equalZero), + OPCODE(o2_setOwnerOf), + OPCODE(o2_addIndirect), + OPCODE(o5_delayVariable), + /* 2C */ + OPCODE(o2_assignVarByte), + OPCODE(o5_putActorInRoom), + OPCODE(o2_delay), + OPCODE(o2_ifNotState04), + /* 30 */ + OPCODE(o2_setBoxFlags), + OPCODE(o2_getBitVar), + OPCODE(o2_setCameraAt), + OPCODE(o2_roomOps), + /* 34 */ + OPCODE(o5_getDist), + OPCODE(o2_findObject), + OPCODE(o2_walkActorToObject), + OPCODE(o2_setState01), + /* 38 */ + OPCODE(o2_isLessEqual), + OPCODE(o2_doSentence), + OPCODE(o2_subtract), + OPCODE(o2_waitForActor), + /* 3C */ + OPCODE(o5_stopSound), + OPCODE(o2_setActorElevation), + OPCODE(o2_walkActorTo), + OPCODE(o2_ifNotState01), + /* 40 */ + OPCODE(o2_cutscene), + OPCODE(o2_putActor), + OPCODE(o2_startScript), + OPCODE(o2_getActorX), + /* 44 */ + OPCODE(o2_isLess), + OPCODE(o2_drawObject), + OPCODE(o5_increment), + OPCODE(o2_clearState08), + /* 48 */ + OPCODE(o5_isEqual), + OPCODE(o5_faceActor), + OPCODE(o2_chainScript), + OPCODE(o2_setObjPreposition), + /* 4C */ + OPCODE(o2_waitForSentence), + OPCODE(o5_walkActorToActor), + OPCODE(o2_putActorAtObject), + OPCODE(o2_ifState08), + /* 50 */ + OPCODE(o2_pickupObject), + OPCODE(o2_animateActor), + OPCODE(o5_actorFollowCamera), + OPCODE(o2_actorOps), + /* 54 */ + OPCODE(o5_setObjectName), + OPCODE(o2_actorFromPos), + OPCODE(o5_getActorMoving), + OPCODE(o2_setState02), + /* 58 */ + OPCODE(o2_beginOverride), + OPCODE(o2_doSentence), + OPCODE(o2_add), + OPCODE(o2_setBitVar), + /* 5C */ + OPCODE(o2_dummy), + OPCODE(o2_ifClassOfIs), + OPCODE(o2_walkActorTo), + OPCODE(o2_ifNotState02), + /* 60 */ + OPCODE(o2_cursorCommand), + OPCODE(o2_putActor), + OPCODE(o2_stopScript), + OPCODE(o5_getActorFacing), + /* 64 */ + OPCODE(o2_loadRoomWithEgo), + OPCODE(o2_drawObject), + OPCODE(o5_getClosestObjActor), + OPCODE(o2_clearState04), + /* 68 */ + OPCODE(o5_isScriptRunning), + OPCODE(o2_setOwnerOf), + OPCODE(o2_subIndirect), + OPCODE(o2_dummy), + /* 6C */ + OPCODE(o2_getObjPreposition), + OPCODE(o5_putActorInRoom), + OPCODE(o2_dummy), + OPCODE(o2_ifState04), + /* 70 */ + OPCODE(o2_lights), + OPCODE(o5_getActorCostume), + OPCODE(o5_loadRoom), + OPCODE(o2_roomOps), + /* 74 */ + OPCODE(o5_getDist), + OPCODE(o2_findObject), + OPCODE(o2_walkActorToObject), + OPCODE(o2_clearState01), + /* 78 */ + OPCODE(o2_isGreater), + OPCODE(o2_doSentence), + OPCODE(o2_verbOps), + OPCODE(o2_getActorWalkBox), + /* 7C */ + OPCODE(o5_isSoundRunning), + OPCODE(o2_setActorElevation), + OPCODE(o2_walkActorTo), + OPCODE(o2_ifState01), + /* 80 */ + OPCODE(o5_breakHere), + OPCODE(o2_putActor), + OPCODE(o5_startMusic), + OPCODE(o5_getActorRoom), + /* 84 */ + OPCODE(o2_isGreaterEqual), + OPCODE(o2_drawObject), + OPCODE(o2_getActorElevation), + OPCODE(o2_setState08), + /* 88 */ + OPCODE(o5_isNotEqual), + OPCODE(o5_faceActor), + OPCODE(o2_assignVarWordIndirect), + OPCODE(o2_setObjPreposition), + /* 8C */ + OPCODE(o2_resourceRoutines), + OPCODE(o5_walkActorToActor), + OPCODE(o2_putActorAtObject), + OPCODE(o2_ifNotState08), + /* 90 */ + OPCODE(o5_getObjectOwner), + OPCODE(o2_animateActor), + OPCODE(o2_panCameraTo), + OPCODE(o2_actorOps), + /* 94 */ + OPCODE(o5_print), + OPCODE(o2_actorFromPos), + OPCODE(o5_getRandomNr), + OPCODE(o2_clearState02), + /* 98 */ + OPCODE(o2_restart), + OPCODE(o2_doSentence), + OPCODE(o5_move), + OPCODE(o2_setBitVar), + /* 9C */ + OPCODE(o5_startSound), + OPCODE(o2_ifClassOfIs), + OPCODE(o2_walkActorTo), + OPCODE(o2_ifState02), + /* A0 */ + OPCODE(o5_stopObjectCode), + OPCODE(o2_putActor), + OPCODE(o5_saveLoadGame), + OPCODE(o2_getActorY), + /* A4 */ + OPCODE(o2_loadRoomWithEgo), + OPCODE(o2_drawObject), + OPCODE(o5_setVarRange), + OPCODE(o2_setState04), + /* A8 */ + OPCODE(o5_notEqualZero), + OPCODE(o2_setOwnerOf), + OPCODE(o2_addIndirect), + OPCODE(o2_switchCostumeSet), + /* AC */ + OPCODE(o2_drawSentence), + OPCODE(o5_putActorInRoom), + OPCODE(o2_waitForMessage), + OPCODE(o2_ifNotState04), + /* B0 */ + OPCODE(o2_setBoxFlags), + OPCODE(o2_getBitVar), + OPCODE(o2_setCameraAt), + OPCODE(o2_roomOps), + /* B4 */ + OPCODE(o5_getDist), + OPCODE(o2_findObject), + OPCODE(o2_walkActorToObject), + OPCODE(o2_setState01), + /* B8 */ + OPCODE(o2_isLessEqual), + OPCODE(o2_doSentence), + OPCODE(o2_subtract), + OPCODE(o2_waitForActor), + /* BC */ + OPCODE(o5_stopSound), + OPCODE(o2_setActorElevation), + OPCODE(o2_walkActorTo), + OPCODE(o2_ifNotState01), + /* C0 */ + OPCODE(o2_endCutscene), + OPCODE(o2_putActor), + OPCODE(o2_startScript), + OPCODE(o2_getActorX), + /* C4 */ + OPCODE(o2_isLess), + OPCODE(o2_drawObject), + OPCODE(o5_decrement), + OPCODE(o2_clearState08), + /* C8 */ + OPCODE(o5_isEqual), + OPCODE(o5_faceActor), + OPCODE(o2_chainScript), + OPCODE(o2_setObjPreposition), + /* CC */ + OPCODE(o5_pseudoRoom), + OPCODE(o5_walkActorToActor), + OPCODE(o2_putActorAtObject), + OPCODE(o2_ifState08), + /* D0 */ + OPCODE(o2_pickupObject), + OPCODE(o2_animateActor), + OPCODE(o5_actorFollowCamera), + OPCODE(o2_actorOps), + /* D4 */ + OPCODE(o5_setObjectName), + OPCODE(o2_actorFromPos), + OPCODE(o5_getActorMoving), + OPCODE(o2_setState02), + /* D8 */ + OPCODE(o5_printEgo), + OPCODE(o2_doSentence), + OPCODE(o2_add), + OPCODE(o2_setBitVar), + /* DC */ + OPCODE(o2_dummy), + OPCODE(o2_ifClassOfIs), + OPCODE(o2_walkActorTo), + OPCODE(o2_ifNotState02), + /* E0 */ + OPCODE(o2_cursorCommand), + OPCODE(o2_putActor), + OPCODE(o2_stopScript), + OPCODE(o5_getActorFacing), + /* E4 */ + OPCODE(o2_loadRoomWithEgo), + OPCODE(o2_drawObject), + OPCODE(o5_getClosestObjActor), + OPCODE(o2_clearState04), + /* E8 */ + OPCODE(o5_isScriptRunning), + OPCODE(o2_setOwnerOf), + OPCODE(o2_subIndirect), + OPCODE(o2_dummy), + /* EC */ + OPCODE(o2_getObjPreposition), + OPCODE(o5_putActorInRoom), + OPCODE(o2_dummy), + OPCODE(o2_ifState04), + /* F0 */ + OPCODE(o2_lights), + OPCODE(o5_getActorCostume), + OPCODE(o5_loadRoom), + OPCODE(o2_roomOps), + /* F4 */ + OPCODE(o5_getDist), + OPCODE(o2_findObject), + OPCODE(o2_walkActorToObject), + OPCODE(o2_clearState01), + /* F8 */ + OPCODE(o2_isGreater), + OPCODE(o2_doSentence), + OPCODE(o2_verbOps), + OPCODE(o2_getActorWalkBox), + /* FC */ + OPCODE(o5_isSoundRunning), + OPCODE(o2_setActorElevation), + OPCODE(o2_walkActorTo), + OPCODE(o2_ifState01) + }; + + _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) (); +} + +const char *ScummEngine_c64::getOpcodeDesc(byte i) { + return _opcodesC64[i].desc; +} + +#undef PARAM_1 +#undef PARAM_2 +#undef PARAM_3 + +} // End of namespace Scumm |