2002-12-22 21:58:16 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2004-01-06 12:45:34 +00:00
|
|
|
* Copyright (C) 2002-2004 The ScummVM project
|
2002-12-22 21:58:16 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
2003-11-11 00:40:35 +00:00
|
|
|
#include "common/config-manager.h"
|
2003-09-11 10:32:15 +00:00
|
|
|
#include "scumm/actor.h"
|
|
|
|
#include "scumm/akos.h"
|
|
|
|
#include "scumm/charset.h"
|
2004-01-06 17:28:29 +00:00
|
|
|
#include "scumm/imuse_digi/dimuse.h"
|
2003-09-11 10:32:15 +00:00
|
|
|
#include "scumm/intern.h"
|
|
|
|
#include "scumm/object.h"
|
|
|
|
#include "scumm/resource.h"
|
|
|
|
#include "scumm/scumm.h"
|
|
|
|
#include "scumm/sound.h"
|
|
|
|
#include "scumm/verbs.h"
|
|
|
|
#include "scumm/smush/smush_player.h"
|
2003-06-15 00:54:14 +00:00
|
|
|
#include "sound/mixer.h"
|
|
|
|
|
2003-10-03 18:33:57 +00:00
|
|
|
namespace Scumm {
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
#define OPCODE(x) { &ScummEngine_v8::x, #x }
|
2002-12-25 04:30:24 +00:00
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::setupOpcodes() {
|
2002-12-22 21:58:16 +00:00
|
|
|
static const OpcodeEntryV8 opcodes[256] = {
|
|
|
|
/* 00 */
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o6_pushWord),
|
|
|
|
OPCODE(o6_pushWordVar),
|
|
|
|
OPCODE(o6_wordArrayRead),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 04 */
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o6_wordArrayIndexedRead),
|
|
|
|
OPCODE(o6_dup),
|
|
|
|
OPCODE(o6_pop),
|
2002-12-22 23:51:04 +00:00
|
|
|
OPCODE(o6_not),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 08 */
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o6_eq),
|
|
|
|
OPCODE(o6_neq),
|
|
|
|
OPCODE(o6_gt),
|
|
|
|
OPCODE(o6_lt),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 0C */
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o6_le),
|
|
|
|
OPCODE(o6_ge),
|
|
|
|
OPCODE(o6_add),
|
|
|
|
OPCODE(o6_sub),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 10 */
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o6_mul),
|
|
|
|
OPCODE(o6_div),
|
|
|
|
OPCODE(o6_land),
|
|
|
|
OPCODE(o6_lor),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 14 */
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o6_band),
|
|
|
|
OPCODE(o6_bor),
|
2002-12-22 21:58:16 +00:00
|
|
|
OPCODE(o8_mod),
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 18 */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 1C */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 20 */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 24 */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 28 */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 2C */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 30 */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 34 */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 38 */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 3C */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 40 */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 44 */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 48 */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 4C */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 50 */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 54 */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 58 */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 5C */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 60 */
|
2002-12-23 18:37:56 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 64 */
|
2003-11-09 22:12:16 +00:00
|
|
|
OPCODE(o6_if),
|
|
|
|
OPCODE(o6_ifNot),
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o6_jump),
|
|
|
|
OPCODE(o6_breakHere),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 68 */
|
2002-12-25 18:47:46 +00:00
|
|
|
OPCODE(o6_delayFrames),
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o8_wait),
|
2002-12-26 21:50:13 +00:00
|
|
|
OPCODE(o6_delay),
|
|
|
|
OPCODE(o6_delaySeconds),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 6C */
|
2002-12-26 21:50:13 +00:00
|
|
|
OPCODE(o6_delayMinutes),
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o6_writeWordVar),
|
|
|
|
OPCODE(o6_wordVarInc),
|
|
|
|
OPCODE(o6_wordVarDec),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 70 */
|
2003-11-10 08:00:55 +00:00
|
|
|
OPCODE(o8_dimArray),
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o6_wordArrayWrite),
|
|
|
|
OPCODE(o6_wordArrayInc),
|
|
|
|
OPCODE(o6_wordArrayDec),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 74 */
|
2003-11-10 08:00:55 +00:00
|
|
|
OPCODE(o8_dim2dimArray),
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o6_wordArrayIndexedWrite),
|
2002-12-23 17:21:09 +00:00
|
|
|
OPCODE(o8_arrayOps),
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 78 */
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
2002-12-26 23:42:28 +00:00
|
|
|
OPCODE(o6_startScript),
|
2003-11-09 22:12:16 +00:00
|
|
|
OPCODE(o6_startScriptQuick),
|
2002-12-23 15:46:53 +00:00
|
|
|
OPCODE(o6_stopObjectCode),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 7C */
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_stopScript),
|
2002-12-27 14:36:28 +00:00
|
|
|
OPCODE(o6_jumpToScript),
|
|
|
|
OPCODE(o6_dummy), // O_RETURN boils down to a NOP
|
2003-11-09 22:12:16 +00:00
|
|
|
OPCODE(o6_startObject),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 80 */
|
2003-01-16 00:40:19 +00:00
|
|
|
OPCODE(o6_stopObjectScript),
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o6_cutscene),
|
|
|
|
OPCODE(o6_endCutscene),
|
2002-12-24 23:26:37 +00:00
|
|
|
OPCODE(o6_freezeUnfreeze),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 84 */
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o6_beginOverride),
|
|
|
|
OPCODE(o6_endOverride),
|
2002-12-24 15:23:24 +00:00
|
|
|
OPCODE(o6_stopSentence),
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 88 */
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
2002-12-23 15:46:53 +00:00
|
|
|
OPCODE(o6_setClass),
|
2002-12-24 23:26:37 +00:00
|
|
|
OPCODE(o6_setState),
|
|
|
|
OPCODE(o6_setOwner),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 8C */
|
2002-12-25 00:04:12 +00:00
|
|
|
OPCODE(o6_panCameraTo),
|
|
|
|
OPCODE(o6_actorFollowCamera),
|
|
|
|
OPCODE(o6_setCameraAt),
|
2002-12-26 21:50:13 +00:00
|
|
|
OPCODE(o6_printActor),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 90 */
|
2002-12-26 21:50:13 +00:00
|
|
|
OPCODE(o6_printEgo),
|
|
|
|
OPCODE(o6_talkActor),
|
|
|
|
OPCODE(o6_talkEgo),
|
2003-01-01 17:57:14 +00:00
|
|
|
OPCODE(o6_printLine),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 94 */
|
2003-01-01 17:57:14 +00:00
|
|
|
OPCODE(o6_printCursor),
|
|
|
|
OPCODE(o6_printDebug),
|
|
|
|
OPCODE(o6_printSystem),
|
2002-12-25 00:04:12 +00:00
|
|
|
OPCODE(o8_blastText),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 98 */
|
2003-01-27 06:51:26 +00:00
|
|
|
OPCODE(o8_drawObject),
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* 9C */
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o8_cursorCommand),
|
2002-12-23 15:46:53 +00:00
|
|
|
OPCODE(o6_loadRoom),
|
2003-01-16 00:40:19 +00:00
|
|
|
OPCODE(o6_loadRoomWithEgo),
|
2002-12-23 15:46:53 +00:00
|
|
|
OPCODE(o6_walkActorToObj),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* A0 */
|
2002-12-23 15:46:53 +00:00
|
|
|
OPCODE(o6_walkActorTo),
|
2003-11-09 22:12:16 +00:00
|
|
|
OPCODE(o6_putActorAtXY),
|
2002-12-23 15:46:53 +00:00
|
|
|
OPCODE(o6_putActorAtObject),
|
|
|
|
OPCODE(o6_faceActor),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* A4 */
|
2002-12-23 15:46:53 +00:00
|
|
|
OPCODE(o6_animateActor),
|
|
|
|
OPCODE(o6_doSentence),
|
|
|
|
OPCODE(o6_pickupObject),
|
2002-12-26 07:33:47 +00:00
|
|
|
OPCODE(o6_setBoxFlags),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* A8 */
|
2004-07-04 12:06:17 +00:00
|
|
|
OPCODE(o6_createBoxMatrix),
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o8_resourceRoutines),
|
|
|
|
OPCODE(o8_roomOps),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* AC */
|
2002-12-23 15:46:53 +00:00
|
|
|
OPCODE(o8_actorOps),
|
|
|
|
OPCODE(o8_cameraOps),
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o8_verbOps),
|
2002-12-24 23:26:37 +00:00
|
|
|
OPCODE(o6_startSound),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* B0 */
|
2002-12-24 23:26:37 +00:00
|
|
|
OPCODE(o6_startMusic),
|
2002-12-23 21:04:14 +00:00
|
|
|
OPCODE(o6_stopSound),
|
2003-07-14 22:21:11 +00:00
|
|
|
OPCODE(o6_soundKludge),
|
2002-12-23 15:46:53 +00:00
|
|
|
OPCODE(o8_system),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* B4 */
|
2002-12-25 02:12:12 +00:00
|
|
|
OPCODE(o6_saveRestoreVerbs),
|
2002-12-26 21:50:13 +00:00
|
|
|
OPCODE(o6_setObjectName),
|
2003-02-18 00:13:24 +00:00
|
|
|
OPCODE(o6_getDateTime),
|
2002-12-25 02:12:12 +00:00
|
|
|
OPCODE(o6_drawBox),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* B8 */
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
2002-12-26 02:18:45 +00:00
|
|
|
OPCODE(o8_startVideo),
|
2002-12-30 17:05:38 +00:00
|
|
|
OPCODE(o8_kernelSetFunctions),
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* BC */
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* C0 */
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* C4 */
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* C8 */
|
2003-12-25 21:27:45 +00:00
|
|
|
OPCODE(o6_startScriptQuick2),
|
|
|
|
OPCODE(o6_startObjectQuick),
|
2002-12-24 00:41:59 +00:00
|
|
|
OPCODE(o6_pickOneOf),
|
|
|
|
OPCODE(o6_pickOneOfDefault),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* CC */
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
2002-12-23 15:46:53 +00:00
|
|
|
OPCODE(o6_isAnyOf),
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o6_getRandomNumber),
|
|
|
|
OPCODE(o6_getRandomNumberRange),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* D0 */
|
2003-11-10 08:00:55 +00:00
|
|
|
OPCODE(o6_ifClassOfIs),
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_getState),
|
|
|
|
OPCODE(o6_getOwner),
|
2002-12-23 15:46:53 +00:00
|
|
|
OPCODE(o6_isScriptRunning),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* D4 */
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
2002-12-23 15:46:53 +00:00
|
|
|
OPCODE(o6_isSoundRunning),
|
|
|
|
OPCODE(o6_abs),
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* D8 */
|
2002-12-30 17:05:38 +00:00
|
|
|
OPCODE(o8_kernelGetFunctions),
|
2002-12-26 07:33:47 +00:00
|
|
|
OPCODE(o6_isActorInBox),
|
2002-12-25 02:12:12 +00:00
|
|
|
OPCODE(o6_getVerbEntrypoint),
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_getActorFromXY),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* DC */
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_findObject),
|
2002-12-27 16:52:59 +00:00
|
|
|
OPCODE(o6_getVerbFromXY),
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
2002-12-24 00:41:59 +00:00
|
|
|
OPCODE(o6_findInventory),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* E0 */
|
2002-12-24 00:41:59 +00:00
|
|
|
OPCODE(o6_getInventoryCount),
|
2002-12-24 14:39:52 +00:00
|
|
|
OPCODE(o6_getAnimateVariable),
|
2002-12-24 00:41:59 +00:00
|
|
|
OPCODE(o6_getActorRoom),
|
|
|
|
OPCODE(o6_getActorWalkBox),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* E4 */
|
2002-12-24 00:41:59 +00:00
|
|
|
OPCODE(o6_getActorMoving),
|
|
|
|
OPCODE(o6_getActorCostume),
|
|
|
|
OPCODE(o6_getActorScaleX),
|
|
|
|
OPCODE(o6_getActorLayer),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* E8 */
|
2002-12-24 00:41:59 +00:00
|
|
|
OPCODE(o6_getActorElevation),
|
|
|
|
OPCODE(o6_getActorWidth),
|
2003-01-16 00:40:19 +00:00
|
|
|
OPCODE(o6_getObjectNewDir),
|
2002-12-24 00:41:59 +00:00
|
|
|
OPCODE(o6_getObjectX),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* EC */
|
2002-12-24 00:41:59 +00:00
|
|
|
OPCODE(o6_getObjectY),
|
2003-01-06 13:41:29 +00:00
|
|
|
OPCODE(o8_getActorChore),
|
2002-12-24 00:41:59 +00:00
|
|
|
OPCODE(o6_distObjectObject),
|
|
|
|
OPCODE(o6_distPtPt),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* F0 */
|
2002-12-25 00:04:12 +00:00
|
|
|
OPCODE(o8_getObjectImageX),
|
|
|
|
OPCODE(o8_getObjectImageY),
|
|
|
|
OPCODE(o8_getObjectImageWidth),
|
|
|
|
OPCODE(o8_getObjectImageHeight),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* F4 */
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-27 15:32:27 +00:00
|
|
|
OPCODE(o8_getStringWidth),
|
2003-05-14 10:16:57 +00:00
|
|
|
OPCODE(o8_getActorZPlane),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* F8 */
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
/* FC */
|
2002-12-23 20:25:47 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-12-22 21:58:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_opcodesV8 = opcodes;
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::executeOpcode(byte i) {
|
2002-12-22 21:58:16 +00:00
|
|
|
OpcodeProcV8 op = _opcodesV8[i].proc;
|
|
|
|
(this->*op) ();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
const char *ScummEngine_v8::getOpcodeDesc(byte i) {
|
2002-12-22 21:58:16 +00:00
|
|
|
return _opcodesV8[i].desc;
|
|
|
|
}
|
|
|
|
|
2002-12-23 12:50:38 +00:00
|
|
|
// In V8, the word size is 4 byte, not 2 bytes as in V6/V7 games
|
2003-10-02 22:42:03 +00:00
|
|
|
uint ScummEngine_v8::fetchScriptWord() {
|
2002-12-23 00:23:36 +00:00
|
|
|
int a;
|
|
|
|
if (*_lastCodePtr + sizeof(MemBlkHeader) != _scriptOrgPointer) {
|
|
|
|
uint32 oldoffs = _scriptPointer - _scriptOrgPointer;
|
|
|
|
getScriptBaseAddress();
|
|
|
|
_scriptPointer = _scriptOrgPointer + oldoffs;
|
|
|
|
}
|
|
|
|
a = READ_LE_UINT32(_scriptPointer);
|
|
|
|
_scriptPointer += 4;
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
int ScummEngine_v8::fetchScriptWordSigned() {
|
2002-12-23 12:50:38 +00:00
|
|
|
return (int32)fetchScriptWord();
|
2002-12-23 00:23:36 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
int ScummEngine_v8::readVar(uint var) {
|
2002-12-23 18:30:12 +00:00
|
|
|
debug(9, "readvar(%d)", var);
|
|
|
|
|
|
|
|
if (!(var & 0xF0000000)) {
|
|
|
|
checkRange(_numVariables - 1, 0, var, "Variable %d out of range(r)");
|
2004-02-24 14:29:56 +00:00
|
|
|
if (var == VAR_CHARINC)
|
|
|
|
return (9 - _scummVars[var]);
|
|
|
|
else
|
|
|
|
return _scummVars[var];
|
2002-12-23 18:30:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (var & 0x80000000) {
|
|
|
|
var &= 0x7FFFFFFF;
|
|
|
|
checkRange(_numBitVariables - 1, 0, var, "Bit variable %d out of range(r)");
|
|
|
|
return (_bitVars[var >> 3] & (1 << (var & 7))) ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (var & 0x40000000) {
|
|
|
|
var &= 0xFFFFFFF;
|
2003-01-15 16:23:04 +00:00
|
|
|
checkRange(25, 0, var, "Local variable %d out of range(r)");
|
2002-12-23 18:30:12 +00:00
|
|
|
return vm.localvar[_currentScript][var];
|
|
|
|
}
|
|
|
|
|
|
|
|
error("Illegal varbits (r)");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::writeVar(uint var, int value) {
|
2002-12-23 18:30:12 +00:00
|
|
|
debug(9, "writeVar(%d, %d)", var, value);
|
|
|
|
|
|
|
|
if (!(var & 0xF0000000)) {
|
|
|
|
checkRange(_numVariables - 1, 0, var, "Variable %d out of range(w)");
|
|
|
|
|
2004-02-21 02:56:47 +00:00
|
|
|
if (var == VAR_CHARINC) {
|
|
|
|
if (ConfMan.hasKey("talkspeed")) {
|
2004-07-11 11:59:18 +00:00
|
|
|
uint talkspeed = ConfMan.getInt("talkspeed");
|
|
|
|
if (talkspeed <= 9)
|
2004-02-21 03:11:40 +00:00
|
|
|
VAR(VAR_CHARINC) = talkspeed;
|
2004-02-21 02:56:47 +00:00
|
|
|
} else
|
2004-02-21 03:11:40 +00:00
|
|
|
VAR(VAR_CHARINC) = (_features & GF_DEMO) ? value : (9 - value);
|
2004-02-20 17:12:16 +00:00
|
|
|
} else
|
|
|
|
_scummVars[var] = value;
|
2002-12-23 18:30:12 +00:00
|
|
|
|
|
|
|
if ((_varwatch == (int)var) || (_varwatch == 0)) {
|
|
|
|
if (vm.slot[_currentScript].number < 100)
|
|
|
|
debug(1, "vars[%d] = %d (via script-%d)", var, value, vm.slot[_currentScript].number);
|
|
|
|
else
|
|
|
|
debug(1, "vars[%d] = %d (via room-%d-%d)", var, value, _currentRoom, vm.slot[_currentScript].number);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (var & 0x80000000) {
|
|
|
|
var &= 0x7FFFFFFF;
|
|
|
|
checkRange(_numBitVariables - 1, 0, var, "Bit variable %d out of range(w)");
|
|
|
|
|
|
|
|
if (value)
|
|
|
|
_bitVars[var >> 3] |= (1 << (var & 7));
|
|
|
|
else
|
|
|
|
_bitVars[var >> 3] &= ~(1 << (var & 7));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (var & 0x40000000) {
|
|
|
|
var &= 0xFFFFFFF;
|
2003-01-15 16:23:04 +00:00
|
|
|
checkRange(25, 0, var, "Local variable %d out of range(w)");
|
2002-12-23 18:30:12 +00:00
|
|
|
vm.localvar[_currentScript][var] = value;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
error("Illegal varbits (w)");
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::decodeParseString(int m, int n) {
|
2002-12-23 18:30:12 +00:00
|
|
|
byte b;
|
|
|
|
|
|
|
|
b = fetchScriptByte();
|
|
|
|
|
|
|
|
switch (b) {
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0xC8: // SO_PRINT_BASEOP
|
2004-04-05 23:54:58 +00:00
|
|
|
_string[m].loadDefault();
|
2002-12-23 18:30:12 +00:00
|
|
|
if (n)
|
|
|
|
_actorToPrintStrFor = pop();
|
2003-01-16 00:40:19 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0xC9: // SO_PRINT_END
|
2004-04-05 23:54:58 +00:00
|
|
|
_string[m].saveDefault();
|
2003-01-16 00:40:19 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0xCA: // SO_PRINT_AT
|
2002-12-23 18:30:12 +00:00
|
|
|
_string[m].ypos = pop();
|
|
|
|
_string[m].xpos = pop();
|
|
|
|
_string[m].overhead = false;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0xCB: // SO_PRINT_COLOR
|
2002-12-23 18:30:12 +00:00
|
|
|
_string[m].color = pop();
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0xCC: // SO_PRINT_CENTER
|
2002-12-23 18:30:12 +00:00
|
|
|
_string[m].center = true;
|
|
|
|
_string[m].overhead = false;
|
|
|
|
break;
|
2003-01-16 00:40:19 +00:00
|
|
|
case 0xCD: // SO_PRINT_CHARSET Set print character set
|
|
|
|
_string[m].charset = pop();
|
2002-12-23 18:30:12 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0xCE: // SO_PRINT_LEFT
|
2002-12-23 18:30:12 +00:00
|
|
|
_string[m].center = false;
|
|
|
|
_string[m].overhead = false;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0xCF: // SO_PRINT_OVERHEAD
|
2002-12-23 18:30:12 +00:00
|
|
|
_string[m].overhead = true;
|
|
|
|
_string[m].no_talk_anim = false;
|
|
|
|
break;
|
|
|
|
case 0xD0: // SO_PRINT_MUMBLE
|
2002-12-28 05:00:45 +00:00
|
|
|
_string[m].no_talk_anim = true;
|
2002-12-23 18:30:12 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0xD1: // SO_PRINT_STRING
|
2003-01-16 00:40:19 +00:00
|
|
|
switch (m) {
|
|
|
|
case 0:
|
2004-03-19 23:19:57 +00:00
|
|
|
actorTalk(_scriptPointer);
|
2003-01-16 00:40:19 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2004-04-02 21:42:42 +00:00
|
|
|
drawString(1, _scriptPointer);
|
2003-01-16 00:40:19 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2004-04-02 21:42:42 +00:00
|
|
|
unkMessage1(_scriptPointer);
|
2003-01-16 00:40:19 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2004-04-02 21:42:42 +00:00
|
|
|
unkMessage2(_scriptPointer);
|
2003-01-16 00:40:19 +00:00
|
|
|
break;
|
|
|
|
case 5:{
|
|
|
|
byte buffer[256];
|
2004-04-02 21:42:42 +00:00
|
|
|
addMessageToStack(_scriptPointer, buffer, sizeof(buffer));
|
2004-04-02 20:35:04 +00:00
|
|
|
enqueueText(buffer, _string[m].xpos, _string[m].ypos, _string[m].color, _string[m].charset, _string[m].center);
|
2002-12-26 01:47:40 +00:00
|
|
|
}
|
2003-01-16 00:40:19 +00:00
|
|
|
break;
|
2002-12-26 01:47:40 +00:00
|
|
|
}
|
2004-03-19 23:19:57 +00:00
|
|
|
_scriptPointer += resStrLen(_scriptPointer) + 1;
|
2004-03-15 03:09:48 +00:00
|
|
|
|
2002-12-23 18:30:12 +00:00
|
|
|
break;
|
2003-06-09 00:46:32 +00:00
|
|
|
case 0xD2: // SO_PRINT_WRAP Set print wordwrap
|
|
|
|
//warning("decodeParseString: SO_PRINT_WRAP");
|
|
|
|
break;
|
2002-12-23 18:30:12 +00:00
|
|
|
default:
|
2003-01-05 22:17:26 +00:00
|
|
|
error("decodeParseString: default case 0x%x", b);
|
2002-12-23 18:30:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-19 20:27:31 +00:00
|
|
|
void ScummEngine_v8::readArrayFromIndexFile() {
|
|
|
|
int num;
|
|
|
|
int a, b;
|
|
|
|
|
|
|
|
while ((num = _fileHandle.readUint32LE()) != 0) {
|
|
|
|
a = _fileHandle.readUint32LE();
|
|
|
|
b = _fileHandle.readUint32LE();
|
|
|
|
|
2004-08-01 01:19:54 +00:00
|
|
|
if (b != 0)
|
2004-01-19 20:27:31 +00:00
|
|
|
defineArray(num, 5, b, a);
|
|
|
|
else
|
|
|
|
defineArray(num, 5, a, b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_mod() {
|
2002-12-23 12:50:38 +00:00
|
|
|
int a = pop();
|
|
|
|
push(pop() % a);
|
2002-12-22 21:58:16 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_wait() {
|
2003-05-28 14:01:54 +00:00
|
|
|
int actnum;
|
|
|
|
int offs = -2;
|
2003-01-06 13:41:29 +00:00
|
|
|
Actor *a;
|
2002-12-22 23:26:10 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2003-01-06 13:41:29 +00:00
|
|
|
|
2002-12-22 23:26:10 +00:00
|
|
|
switch (subOp) {
|
2003-01-06 13:41:29 +00:00
|
|
|
case 0x1E: // SO_WAIT_FOR_ACTOR Wait for actor (to finish current action?)
|
|
|
|
offs = fetchScriptWordSigned();
|
|
|
|
actnum = pop();
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(actnum, "o8_wait:SO_WAIT_FOR_ACTOR");
|
2003-05-31 21:25:14 +00:00
|
|
|
if (a->isInCurrentRoom() && a->moving)
|
|
|
|
break;
|
2002-12-26 08:06:33 +00:00
|
|
|
return;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x1F: // SO_WAIT_FOR_MESSAGE Wait for message
|
2003-05-08 15:48:50 +00:00
|
|
|
if (VAR(VAR_HAVE_MSG))
|
2002-12-26 08:06:33 +00:00
|
|
|
break;
|
|
|
|
return;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x20: // SO_WAIT_FOR_CAMERA Wait for camera (to finish current action?)
|
2002-12-26 08:06:33 +00:00
|
|
|
if (camera._dest != camera._cur)
|
|
|
|
break;
|
2002-12-26 12:27:04 +00:00
|
|
|
return;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x21: // SO_WAIT_FOR_SENTENCE
|
2002-12-26 08:06:33 +00:00
|
|
|
if (_sentenceNum) {
|
2003-05-08 15:48:50 +00:00
|
|
|
if (_sentence[_sentenceNum - 1].freezeCount && !isScriptInUse(VAR(VAR_SENTENCE_SCRIPT)))
|
2002-12-26 08:06:33 +00:00
|
|
|
return;
|
|
|
|
break;
|
|
|
|
}
|
2003-05-08 15:48:50 +00:00
|
|
|
if (!isScriptInUse(VAR(VAR_SENTENCE_SCRIPT)))
|
2002-12-26 08:06:33 +00:00
|
|
|
return;
|
|
|
|
break;
|
2003-01-06 13:41:29 +00:00
|
|
|
case 0x22: // SO_WAIT_FOR_ANIMATION
|
|
|
|
offs = fetchScriptWordSigned();
|
|
|
|
actnum = pop();
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(actnum, "o8_wait:SO_WAIT_FOR_ANIMATION");
|
2003-05-31 21:25:14 +00:00
|
|
|
if (a->isInCurrentRoom() && a->needRedraw)
|
|
|
|
break;
|
2002-12-26 08:06:33 +00:00
|
|
|
return;
|
2003-01-06 13:41:29 +00:00
|
|
|
case 0x23: // SO_WAIT_FOR_TURN
|
|
|
|
offs = fetchScriptWordSigned();
|
|
|
|
actnum = pop();
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(actnum, "o8_wait:SO_WAIT_FOR_TURN");
|
2003-05-31 21:25:14 +00:00
|
|
|
if (a->isInCurrentRoom() && a->moving & MF_TURN)
|
|
|
|
break;
|
2002-12-26 08:06:33 +00:00
|
|
|
return;
|
2002-12-22 23:26:10 +00:00
|
|
|
default:
|
2003-01-05 22:17:26 +00:00
|
|
|
error("o8_wait: default case 0x%x", subOp);
|
2002-12-22 23:26:10 +00:00
|
|
|
}
|
2002-12-26 08:06:33 +00:00
|
|
|
|
2003-05-28 14:01:54 +00:00
|
|
|
_scriptPointer += offs;
|
2002-12-26 21:50:13 +00:00
|
|
|
o6_breakHere();
|
2002-12-22 21:58:16 +00:00
|
|
|
}
|
|
|
|
|
2003-11-10 08:00:55 +00:00
|
|
|
void ScummEngine_v8::o8_dimArray() {
|
2002-12-23 17:21:09 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
|
|
|
int array = fetchScriptWord();
|
|
|
|
|
|
|
|
switch (subOp) {
|
|
|
|
case 0x0A: // SO_ARRAY_SCUMMVAR
|
|
|
|
defineArray(array, 5, 0, pop());
|
|
|
|
break;
|
|
|
|
case 0x0B: // SO_ARRAY_STRING
|
|
|
|
defineArray(array, 4, 0, pop());
|
|
|
|
break;
|
|
|
|
case 0x0C: // SO_ARRAY_UNDIM
|
|
|
|
nukeArray(array);
|
|
|
|
break;
|
|
|
|
default:
|
2003-11-10 08:00:55 +00:00
|
|
|
error("o8_dimArray: default case 0x%x", subOp);
|
2002-12-23 17:21:09 +00:00
|
|
|
}
|
2002-12-23 15:46:53 +00:00
|
|
|
}
|
|
|
|
|
2003-11-10 08:00:55 +00:00
|
|
|
void ScummEngine_v8::o8_dim2dimArray() {
|
2002-12-23 17:21:09 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
|
|
|
int array = fetchScriptWord(), a, b;
|
|
|
|
|
|
|
|
switch (subOp) {
|
|
|
|
case 0x0A: // SO_ARRAY_SCUMMVAR
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
defineArray(array, 5, a, b);
|
|
|
|
break;
|
|
|
|
case 0x0B: // SO_ARRAY_STRING
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
defineArray(array, 4, a, b);
|
|
|
|
break;
|
|
|
|
case 0x0C: // SO_ARRAY_UNDIM
|
|
|
|
nukeArray(array);
|
|
|
|
break;
|
|
|
|
default:
|
2003-11-10 08:00:55 +00:00
|
|
|
error("o8_dim2dimArray: default case 0x%x", subOp);
|
2002-12-23 17:21:09 +00:00
|
|
|
}
|
2002-12-23 15:46:53 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_arrayOps() {
|
2002-12-23 17:21:09 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
|
|
|
int array = fetchScriptWord();
|
2002-12-23 20:25:47 +00:00
|
|
|
int b, c, d, len;
|
2002-12-28 01:57:19 +00:00
|
|
|
ArrayHeader *ah;
|
2002-12-25 14:46:39 +00:00
|
|
|
int list[128];
|
2002-12-23 17:21:09 +00:00
|
|
|
|
|
|
|
switch (subOp) {
|
|
|
|
case 0x14: // SO_ASSIGN_STRING
|
2002-12-28 01:57:19 +00:00
|
|
|
b = pop();
|
|
|
|
len = resStrLen(_scriptPointer);
|
2004-01-19 20:27:31 +00:00
|
|
|
ah = defineArray(array, 4, 0, len + 1);
|
2002-12-28 01:57:19 +00:00
|
|
|
copyScriptString(ah->data + b);
|
2002-12-23 18:56:43 +00:00
|
|
|
break;
|
2002-12-23 17:21:09 +00:00
|
|
|
case 0x15: // SO_ASSIGN_SCUMMVAR_LIST
|
2002-12-23 20:25:47 +00:00
|
|
|
b = pop();
|
2003-05-18 21:03:57 +00:00
|
|
|
len = getStackList(list, ARRAYSIZE(list));
|
2002-12-23 20:25:47 +00:00
|
|
|
d = readVar(array);
|
|
|
|
if (d == 0) {
|
2003-01-12 21:13:22 +00:00
|
|
|
defineArray(array, 5, 0, b + len);
|
2002-12-23 20:25:47 +00:00
|
|
|
}
|
2003-01-12 21:13:22 +00:00
|
|
|
while (--len >= 0) {
|
|
|
|
writeArray(array, 0, b + len, list[len]);
|
2002-12-23 20:25:47 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-12-23 17:21:09 +00:00
|
|
|
case 0x16: // SO_ASSIGN_2DIM_LIST
|
2002-12-23 20:25:47 +00:00
|
|
|
b = pop();
|
2003-05-18 21:03:57 +00:00
|
|
|
len = getStackList(list, ARRAYSIZE(list));
|
2002-12-23 20:25:47 +00:00
|
|
|
d = readVar(array);
|
|
|
|
if (d == 0)
|
|
|
|
error("Must DIM a two dimensional array before assigning");
|
|
|
|
c = pop();
|
|
|
|
while (--len >= 0) {
|
|
|
|
writeArray(array, c, b + len, list[len]);
|
|
|
|
}
|
|
|
|
break;
|
2002-12-23 17:21:09 +00:00
|
|
|
default:
|
2003-01-05 22:17:26 +00:00
|
|
|
error("o8_arrayOps: default case 0x%x (array %d)", subOp, array);
|
2002-12-23 17:21:09 +00:00
|
|
|
}
|
2002-12-23 15:46:53 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_blastText() {
|
2002-12-25 00:04:12 +00:00
|
|
|
// FIXME
|
2003-01-16 00:40:19 +00:00
|
|
|
decodeParseString(5, 0);
|
2002-12-25 00:04:12 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_cursorCommand() {
|
2002-12-22 23:26:10 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2002-12-23 18:30:12 +00:00
|
|
|
int a, i;
|
2002-12-25 14:46:39 +00:00
|
|
|
int args[16];
|
2003-03-06 17:58:13 +00:00
|
|
|
|
2002-12-22 23:26:10 +00:00
|
|
|
switch (subOp) {
|
|
|
|
case 0xDC: // SO_CURSOR_ON Turn cursor on
|
2002-12-23 18:30:12 +00:00
|
|
|
_cursor.state = 1;
|
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xDD: // SO_CURSOR_OFF Turn cursor off
|
2002-12-23 18:30:12 +00:00
|
|
|
_cursor.state = 0;
|
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xDE: // SO_CURSOR_SOFT_ON Turn soft cursor on
|
2002-12-23 18:30:12 +00:00
|
|
|
_cursor.state++;
|
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xDF: // SO_CURSOR_SOFT_OFF Turn soft cursor off
|
2002-12-23 18:30:12 +00:00
|
|
|
_cursor.state--;
|
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xE0: // SO_USERPUT_ON
|
2002-12-23 18:30:12 +00:00
|
|
|
_userPut = 1;
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xE1: // SO_USERPUT_OFF
|
2002-12-23 18:30:12 +00:00
|
|
|
_userPut = 0;
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xE2: // SO_USERPUT_SOFT_ON
|
2002-12-23 18:30:12 +00:00
|
|
|
_userPut++;
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xE3: // SO_USERPUT_SOFT_OFF
|
2002-12-23 18:30:12 +00:00
|
|
|
_userPut--;
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xE4: // SO_CURSOR_IMAGE Set cursor image
|
2002-12-23 18:30:12 +00:00
|
|
|
{
|
2002-12-25 03:48:27 +00:00
|
|
|
int idx = pop();
|
|
|
|
int room, obj;
|
|
|
|
obj = popRoomAndObj(&room);
|
|
|
|
setCursorImg(obj, room, idx);
|
2002-12-23 18:30:12 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xE5: // SO_CURSOR_HOTSPOT Set cursor hotspot
|
2002-12-23 18:30:12 +00:00
|
|
|
a = pop();
|
2003-04-26 13:28:34 +00:00
|
|
|
setCursorHotspot(pop(), a);
|
2002-12-23 18:30:12 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xE6: // SO_CURSOR_TRANSPARENT Set cursor transparent color
|
2002-12-23 18:30:12 +00:00
|
|
|
makeCursorColorTransparent(pop());
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0xE7: { // SO_CHARSET_SET
|
2002-12-25 04:30:24 +00:00
|
|
|
int charset = pop();
|
2004-01-16 08:34:42 +00:00
|
|
|
debugC(DEBUG_GENERAL, "Set userface charset to %d", charset);
|
2002-12-26 01:47:40 +00:00
|
|
|
// loadCharset(charset);
|
2002-12-23 18:30:12 +00:00
|
|
|
break;
|
2002-12-25 04:30:24 +00:00
|
|
|
}
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xE8: // SO_CHARSET_COLOR
|
2003-05-18 21:03:57 +00:00
|
|
|
getStackList(args, ARRAYSIZE(args));
|
2002-12-23 18:30:12 +00:00
|
|
|
for (i = 0; i < 16; i++)
|
2004-04-05 23:54:58 +00:00
|
|
|
_charsetColorMap[i] = _charsetData[_string[1]._default.charset][i] = (unsigned char)args[i];
|
2002-12-23 18:30:12 +00:00
|
|
|
break;
|
2002-12-28 05:26:21 +00:00
|
|
|
case 0xE9: // SO_CURSOR_PUT
|
2003-01-09 16:57:09 +00:00
|
|
|
{
|
|
|
|
int y = pop();
|
|
|
|
int x = pop();
|
|
|
|
|
2004-03-28 16:30:50 +00:00
|
|
|
_system->warpMouse(x, y);
|
2003-01-09 16:57:09 +00:00
|
|
|
}
|
2002-12-28 05:26:21 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
default:
|
2003-01-05 22:17:26 +00:00
|
|
|
error("o8_cursorCommand: default case 0x%x", subOp);
|
2002-12-22 23:26:10 +00:00
|
|
|
}
|
2002-12-23 18:30:12 +00:00
|
|
|
|
2003-05-08 15:48:50 +00:00
|
|
|
VAR(VAR_CURSORSTATE) = _cursor.state;
|
|
|
|
VAR(VAR_USERPUT) = _userPut;
|
2002-12-22 21:58:16 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_resourceRoutines() {
|
2002-12-22 23:26:10 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2002-12-23 17:21:09 +00:00
|
|
|
int resid = pop();
|
|
|
|
|
2002-12-22 23:26:10 +00:00
|
|
|
switch (subOp) {
|
2004-07-05 06:26:57 +00:00
|
|
|
case 0x3C: // Dummy case
|
2002-12-23 17:21:09 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x3D: // SO_HEAP_LOAD_COSTUME Load costume to heap
|
2002-12-23 17:21:09 +00:00
|
|
|
ensureResourceLoaded(rtCostume, resid);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x3E: // SO_HEAP_LOAD_OBJECT Load object to heap
|
2002-12-27 14:36:28 +00:00
|
|
|
{
|
|
|
|
int room = getObjectRoom(resid);
|
|
|
|
loadFlObject(resid, room);
|
|
|
|
}
|
2002-12-23 17:21:09 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x3F: // SO_HEAP_LOAD_ROOM Load room to heap
|
2002-12-23 17:21:09 +00:00
|
|
|
ensureResourceLoaded(rtRoom, resid);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x40: // SO_HEAP_LOAD_SCRIPT Load script to heap
|
2002-12-23 17:21:09 +00:00
|
|
|
ensureResourceLoaded(rtScript, resid);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x41: // SO_HEAP_LOAD_SOUND Load sound to heap
|
2002-12-23 17:21:09 +00:00
|
|
|
ensureResourceLoaded(rtSound, resid);
|
|
|
|
break;
|
|
|
|
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x42: // SO_HEAP_LOCK_COSTUME Lock costume in heap
|
2002-12-23 17:21:09 +00:00
|
|
|
lock(rtCostume, resid);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x43: // SO_HEAP_LOCK_ROOM Lock room in heap
|
2002-12-23 17:21:09 +00:00
|
|
|
lock(rtRoom, resid);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x44: // SO_HEAP_LOCK_SCRIPT Lock script in heap
|
2002-12-23 17:21:09 +00:00
|
|
|
lock(rtScript, resid);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x45: // SO_HEAP_LOCK_SOUND Lock sound in heap
|
2002-12-23 17:21:09 +00:00
|
|
|
lock(rtSound, resid);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x46: // SO_HEAP_UNLOCK_COSTUME Unlock costume
|
2002-12-23 17:21:09 +00:00
|
|
|
unlock(rtCostume, resid);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x47: // SO_HEAP_UNLOCK_ROOM Unlock room
|
2002-12-23 17:21:09 +00:00
|
|
|
unlock(rtRoom, resid);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x48: // SO_HEAP_UNLOCK_SCRIPT Unlock script
|
2002-12-23 17:21:09 +00:00
|
|
|
unlock(rtScript, resid);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x49: // SO_HEAP_UNLOCK_SOUND Unlock sound
|
2002-12-23 17:21:09 +00:00
|
|
|
unlock(rtSound, resid);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x4A: // SO_HEAP_NUKE_COSTUME Remove costume from heap
|
2002-12-23 17:21:09 +00:00
|
|
|
setResourceCounter(rtCostume, resid, 0x7F);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x4B: // SO_HEAP_NUKE_ROOM Remove room from heap
|
2002-12-23 17:21:09 +00:00
|
|
|
setResourceCounter(rtRoom, resid, 0x7F);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x4C: // SO_HEAP_NUKE_SCRIPT Remove script from heap
|
2002-12-23 17:21:09 +00:00
|
|
|
setResourceCounter(rtScript, resid, 0x7F);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x4D: // SO_HEAP_NUKE_SOUND Remove sound from heap
|
2002-12-23 17:21:09 +00:00
|
|
|
setResourceCounter(rtSound, resid, 0x7F);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
default:
|
2003-01-05 22:17:26 +00:00
|
|
|
error("o8_resourceRoutines: default case 0x%x", subOp);
|
2002-12-22 23:26:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_roomOps() {
|
2002-12-22 23:26:10 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2002-12-26 02:02:46 +00:00
|
|
|
int a, b, c, d, e;
|
2002-12-23 18:56:43 +00:00
|
|
|
|
2002-12-22 23:26:10 +00:00
|
|
|
switch (subOp) {
|
|
|
|
case 0x52: // SO_ROOM_PALETTE Set room palette
|
2003-03-06 17:58:13 +00:00
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
setPalColor(d, a, b, c);
|
2002-12-23 18:56:43 +00:00
|
|
|
break;
|
2002-12-26 02:02:46 +00:00
|
|
|
case 0x55: // SO_ROOM_INTENSITY Set room intensity
|
|
|
|
// Not used in CMI???
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
darkenPalette(a, a, a, b, c);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x57: // SO_ROOM_FADE Fade room
|
2002-12-23 18:56:43 +00:00
|
|
|
a = pop();
|
|
|
|
if (a) {
|
|
|
|
_switchRoomEffect = (byte)(a);
|
|
|
|
_switchRoomEffect2 = (byte)(a >> 8);
|
|
|
|
} else {
|
|
|
|
fadeIn(_newEffect);
|
|
|
|
}
|
|
|
|
break;
|
2002-12-26 02:02:46 +00:00
|
|
|
case 0x58: // SO_ROOM_RGB_INTENSITY Set room color intensity
|
|
|
|
e = pop();
|
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
darkenPalette(a, b, c, d, e);
|
2002-12-26 01:54:27 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x59: // SO_ROOM_TRANSFORM Transform room
|
2003-01-13 14:22:53 +00:00
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
warning("o8_roomOps: unimplemented case SO_ROOM_TRANSFORM(%d,%d,%d,%d)", a, b, c, d);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x5A: // SO_ROOM_CYCLE_SPEED Set palette cycling speed
|
|
|
|
case 0x5B: // SO_ROOM_COPY_PALETTE Copy palette
|
2002-12-26 01:54:27 +00:00
|
|
|
error("o8_roomOps: unimplemented case %d", subOp);
|
2002-12-24 23:26:37 +00:00
|
|
|
break;
|
2003-01-13 14:22:53 +00:00
|
|
|
case 0x5C: // SO_ROOM_NEW_PALETTE New palette
|
2003-03-15 21:28:22 +00:00
|
|
|
a = pop();
|
|
|
|
setPalette(a);
|
2003-01-01 11:38:59 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x5D: // SO_ROOM_SAVE_GAME Save game
|
2004-01-31 22:12:35 +00:00
|
|
|
_saveTemporaryState = true;
|
2003-01-02 08:39:33 +00:00
|
|
|
_saveLoadSlot = 1;
|
|
|
|
_saveLoadFlag = 1;
|
2002-12-24 23:26:37 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x5E: // SO_ROOM_LOAD_GAME Load game
|
2004-01-31 22:12:35 +00:00
|
|
|
_saveTemporaryState = true;
|
2003-01-02 08:39:33 +00:00
|
|
|
_saveLoadSlot = 1;
|
|
|
|
_saveLoadFlag = 2;
|
2002-12-24 23:26:37 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x5F: // SO_ROOM_SATURATION Set saturation of room colors
|
2002-12-31 18:21:01 +00:00
|
|
|
e = pop();
|
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
2003-03-13 02:23:55 +00:00
|
|
|
desaturatePalette(a, b, c, d, e);
|
2002-12-30 17:05:38 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
default:
|
2003-01-05 22:17:26 +00:00
|
|
|
error("o8_roomOps: default case 0x%x", subOp);
|
2002-12-22 23:26:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_actorOps() {
|
2002-12-22 23:26:10 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
|
|
|
Actor *a;
|
2002-12-23 23:53:29 +00:00
|
|
|
int i, j;
|
2002-12-22 23:26:10 +00:00
|
|
|
|
2002-12-23 23:30:14 +00:00
|
|
|
if (subOp == 0x7A) {
|
|
|
|
_curActor = pop();
|
2002-12-25 14:31:17 +00:00
|
|
|
//printf("Setting current actor to %d\n", _curActor);
|
2002-12-23 23:30:14 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-12-23 15:46:53 +00:00
|
|
|
a = derefActorSafe(_curActor, "o8_actorOps");
|
2002-12-22 23:26:10 +00:00
|
|
|
if (!a)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (subOp) {
|
|
|
|
case 0x64: // SO_ACTOR_COSTUME Set actor costume
|
2002-12-23 23:53:29 +00:00
|
|
|
a->setActorCostume(pop());
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x65: // SO_ACTOR_STEP_DIST Set actor width of steps
|
2002-12-23 23:53:29 +00:00
|
|
|
j = pop();
|
|
|
|
i = pop();
|
|
|
|
a->setActorWalkSpeed(i, j);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x67: // SO_ACTOR_ANIMATION_DEFAULT Set actor animation to default
|
2002-12-23 23:53:29 +00:00
|
|
|
a->initFrame = 1;
|
|
|
|
a->walkFrame = 2;
|
|
|
|
a->standFrame = 3;
|
2003-05-22 09:58:33 +00:00
|
|
|
a->talkStartFrame = 4;
|
|
|
|
a->talkStopFrame = 5;
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x68: // SO_ACTOR_ANIMATION_INIT Initialize animation
|
2002-12-23 23:53:29 +00:00
|
|
|
a->initFrame = pop();
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x69: // SO_ACTOR_ANIMATION_TALK Set actor animation to talk animation
|
2003-05-22 09:58:33 +00:00
|
|
|
a->talkStopFrame = pop();
|
|
|
|
a->talkStartFrame = pop();
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x6A: // SO_ACTOR_ANIMATION_WALK Set actor animation to walk animation
|
2002-12-23 23:53:29 +00:00
|
|
|
a->walkFrame = pop();
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x6B: // SO_ACTOR_ANIMATION_STAND Set actor animation to standing animation
|
2002-12-23 23:53:29 +00:00
|
|
|
a->standFrame = pop();
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x6C: // SO_ACTOR_ANIMATION_SPEED Set speed of animation
|
2003-07-24 17:44:00 +00:00
|
|
|
a->setAnimSpeed(pop());
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x6D: // SO_ACTOR_DEFAULT
|
2002-12-23 23:53:29 +00:00
|
|
|
a->initActor(0);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x6E: // SO_ACTOR_ELEVATION
|
2004-01-05 16:19:14 +00:00
|
|
|
a->setElevation(pop());
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x6F: // SO_ACTOR_PALETTE Set actor palette
|
2002-12-23 23:53:29 +00:00
|
|
|
j = pop();
|
|
|
|
i = pop();
|
2003-02-20 02:10:39 +00:00
|
|
|
checkRange(31, 0, i, "Illegal palette slot %d");
|
2004-01-05 16:30:00 +00:00
|
|
|
a->setPalette(i, j);
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x70: // SO_ACTOR_TALK_COLOR Set actor talk color
|
2002-12-23 23:53:29 +00:00
|
|
|
a->talkColor = pop();
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x71: // SO_ACTOR_NAME Set name of actor
|
2002-12-23 23:53:29 +00:00
|
|
|
loadPtrToResource(rtActorName, a->number, NULL);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x72: // SO_ACTOR_WIDTH Set width of actor
|
2002-12-23 23:53:29 +00:00
|
|
|
a->width = pop();
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x73: // SO_ACTOR_SCALE Set scaling of actor
|
2004-01-05 16:30:00 +00:00
|
|
|
i = pop();
|
|
|
|
a->setScale(i, i);
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0x74: // SO_ACTOR_NEVER_ZCLIP
|
2002-12-23 23:53:29 +00:00
|
|
|
a->forceClip = 0;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0x75: // SO_ACTOR_ALWAYS_ZCLIP
|
2002-12-23 23:53:29 +00:00
|
|
|
a->forceClip = pop();
|
2002-12-31 15:26:02 +00:00
|
|
|
// V8 uses 255 where we used to use 100
|
|
|
|
if (a->forceClip == 255)
|
|
|
|
a->forceClip = 100;
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x76: // SO_ACTOR_IGNORE_BOXES Make actor ignore boxes
|
2002-12-23 23:53:29 +00:00
|
|
|
a->ignoreBoxes = true;
|
|
|
|
a->forceClip = 100;
|
|
|
|
if (a->isInCurrentRoom())
|
2003-09-14 18:16:45 +00:00
|
|
|
a->putActor(a->_pos.x, a->_pos.y, a->room);
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x77: // SO_ACTOR_FOLLOW_BOXES Make actor follow boxes
|
2002-12-23 23:53:29 +00:00
|
|
|
a->ignoreBoxes = false;
|
|
|
|
a->forceClip = 100;
|
|
|
|
if (a->isInCurrentRoom())
|
2003-09-14 18:16:45 +00:00
|
|
|
a->putActor(a->_pos.x, a->_pos.y, a->room);
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x78: // SO_ACTOR_SPECIAL_DRAW
|
2002-12-27 20:15:24 +00:00
|
|
|
a->shadow_mode = pop();
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x79: // SO_ACTOR_TEXT_OFFSET Set text offset relative to actor
|
2002-12-23 23:53:29 +00:00
|
|
|
a->talkPosY = pop();
|
2003-05-12 22:08:39 +00:00
|
|
|
a->talkPosX = pop();
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-27 20:15:24 +00:00
|
|
|
// case 0x7A: // SO_ACTOR_INIT Set current actor (handled above)
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x7B: // SO_ACTOR_VARIABLE Set actor variable
|
2002-12-23 23:53:29 +00:00
|
|
|
i = pop();
|
|
|
|
a->setAnimVar(pop(), i);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x7C: // SO_ACTOR_IGNORE_TURNS_ON Make actor ignore turns
|
2002-12-23 23:53:29 +00:00
|
|
|
a->ignoreTurns = true;
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x7D: // SO_ACTOR_IGNORE_TURNS_OFF Make actor follow turns
|
2002-12-23 23:53:29 +00:00
|
|
|
a->ignoreTurns = false;
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x7E: // SO_ACTOR_NEW New actor
|
2002-12-23 23:53:29 +00:00
|
|
|
a->initActor(2);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x7F: // SO_ACTOR_DEPTH Set actor Z position
|
2002-12-23 23:53:29 +00:00
|
|
|
a->layer = pop();
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x80: // SO_ACTOR_STOP
|
2002-12-23 23:53:29 +00:00
|
|
|
a->stopActorMoving();
|
2004-07-10 23:32:31 +00:00
|
|
|
a->startAnimActor(a->standFrame);
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x81: // SO_ACTOR_FACE Make actor face angle
|
2002-12-23 23:53:29 +00:00
|
|
|
a->moving &= ~MF_TURN;
|
|
|
|
a->setDirection(pop());
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x82: // SO_ACTOR_TURN Turn actor
|
2002-12-23 23:53:29 +00:00
|
|
|
a->turnToDirection(pop());
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x83: // SO_ACTOR_WALK_SCRIPT Set walk script for actor?
|
2003-05-31 14:27:47 +00:00
|
|
|
a->walkScript = pop();
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x84: // SO_ACTOR_TALK_SCRIPT Set talk script for actor?
|
2003-05-31 14:27:47 +00:00
|
|
|
a->talkScript = pop();
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x85: // SO_ACTOR_WALK_PAUSE
|
2003-03-08 02:06:56 +00:00
|
|
|
a->moving |= MF_FROZEN;
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x86: // SO_ACTOR_WALK_RESUME
|
2003-03-08 02:06:56 +00:00
|
|
|
a->moving &= ~MF_FROZEN;
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x87: // SO_ACTOR_VOLUME Set volume of actor speech
|
2004-02-09 08:05:23 +00:00
|
|
|
a->talkVolume = pop();
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x88: // SO_ACTOR_FREQUENCY Set frequency of actor speech
|
2003-01-26 10:54:34 +00:00
|
|
|
a->talkFrequency = pop();
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x89: // SO_ACTOR_PAN
|
2003-09-03 17:00:33 +00:00
|
|
|
a->talkPan = pop();
|
2002-12-23 23:53:29 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
default:
|
2003-01-05 22:17:26 +00:00
|
|
|
error("o8_actorOps: default case 0x%x", subOp);
|
2002-12-22 23:26:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_cameraOps() {
|
2002-12-22 21:58:16 +00:00
|
|
|
// TODO
|
2002-12-22 23:26:10 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
|
|
|
switch (subOp) {
|
|
|
|
case 0x32: // SO_CAMERA_PAUSE
|
2002-12-28 12:42:55 +00:00
|
|
|
//warning("freezeCamera NYI");
|
2002-12-24 00:41:59 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x33: // SO_CAMERA_RESUME
|
2002-12-28 12:42:55 +00:00
|
|
|
//warning("unfreezeCamera NYI");
|
2002-12-24 00:41:59 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
default:
|
2003-01-05 22:17:26 +00:00
|
|
|
error("o8_cameraOps: default case 0x%x", subOp);
|
2002-12-22 23:26:10 +00:00
|
|
|
}
|
2002-12-22 21:58:16 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_verbOps() {
|
2002-12-22 23:26:10 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2002-12-23 19:15:51 +00:00
|
|
|
VerbSlot *vs = NULL;
|
2002-12-27 15:32:27 +00:00
|
|
|
int slot, a, b;
|
2002-12-23 19:15:51 +00:00
|
|
|
|
2002-12-27 16:49:08 +00:00
|
|
|
_verbRedraw = true;
|
|
|
|
|
2003-01-09 22:53:21 +00:00
|
|
|
if (subOp == 0x96) {
|
2002-12-23 19:15:51 +00:00
|
|
|
_curVerb = pop();
|
|
|
|
_curVerbSlot = getVerbSlot(_curVerb, 0);
|
2003-12-26 23:11:35 +00:00
|
|
|
checkRange(_numVerbs - 1, 0, _curVerbSlot, "Illegal new verb slot %d");
|
2003-01-09 22:53:21 +00:00
|
|
|
//printf("Setting current actor to %d\n", _curActor);
|
|
|
|
return;
|
|
|
|
}
|
2003-03-06 17:58:13 +00:00
|
|
|
|
2003-12-26 23:11:35 +00:00
|
|
|
assert(0 <= _curVerbSlot && _curVerbSlot < _numVerbs);
|
2003-01-09 22:53:21 +00:00
|
|
|
vs = &_verbs[_curVerbSlot];
|
|
|
|
assert(vs);
|
|
|
|
|
|
|
|
switch (subOp) {
|
|
|
|
case 0x96: // SO_VERB_INIT Choose verb number for editing
|
|
|
|
// handled above!
|
2002-12-23 19:15:51 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x97: // SO_VERB_NEW New verb
|
2002-12-27 16:49:08 +00:00
|
|
|
if (_curVerbSlot == 0) {
|
2003-12-26 23:11:35 +00:00
|
|
|
for (slot = 1; slot < _numVerbs; slot++) {
|
2002-12-27 15:32:27 +00:00
|
|
|
if (_verbs[slot].verbid == 0)
|
|
|
|
break;
|
|
|
|
}
|
2003-12-26 23:11:35 +00:00
|
|
|
if (slot >= _numVerbs) {
|
2003-01-09 22:53:21 +00:00
|
|
|
error("Too many verbs");
|
2003-01-08 22:47:44 +00:00
|
|
|
}
|
2002-12-27 15:32:27 +00:00
|
|
|
_curVerbSlot = slot;
|
|
|
|
}
|
2002-12-27 16:49:08 +00:00
|
|
|
vs = &_verbs[_curVerbSlot];
|
2002-12-27 15:32:27 +00:00
|
|
|
vs->verbid = _curVerb;
|
|
|
|
vs->color = 2;
|
|
|
|
vs->hicolor = 0;
|
|
|
|
vs->dimcolor = 8;
|
|
|
|
vs->type = kTextVerbType;
|
2004-04-05 23:54:58 +00:00
|
|
|
vs->charset_nr = _string[0]._default.charset;
|
2002-12-27 15:32:27 +00:00
|
|
|
vs->curmode = 0;
|
|
|
|
vs->saveid = 0;
|
|
|
|
vs->key = 0;
|
|
|
|
vs->center = 0;
|
|
|
|
vs->imgindex = 0;
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x98: // SO_VERB_DELETE Delete verb
|
2002-12-27 15:32:27 +00:00
|
|
|
killVerb(_curVerbSlot);
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x99: // SO_VERB_NAME Set verb name
|
2002-12-27 15:32:27 +00:00
|
|
|
loadPtrToResource(rtVerb, _curVerbSlot, NULL);
|
|
|
|
vs->type = kTextVerbType;
|
|
|
|
vs->imgindex = 0;
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x9A: // SO_VERB_AT Set verb (X,Y) placement
|
2004-01-15 19:25:17 +00:00
|
|
|
vs->curRect.top = pop();
|
|
|
|
vs->curRect.left = pop();
|
2002-12-23 19:15:51 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x9B: // SO_VERB_ON Turn verb on
|
2002-12-23 19:15:51 +00:00
|
|
|
vs->curmode = 1;
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x9C: // SO_VERB_OFF Turn verb off
|
2002-12-23 19:15:51 +00:00
|
|
|
vs->curmode = 0;
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x9D: // SO_VERB_COLOR Set verb color
|
2002-12-23 19:15:51 +00:00
|
|
|
vs->color = pop();
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0x9E: // SO_VERB_HICOLOR Set verb highlighted color
|
2002-12-23 19:15:51 +00:00
|
|
|
vs->hicolor = pop();
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xA0: // SO_VERB_DIMCOLOR Set verb dimmed (disabled) color
|
2002-12-23 19:15:51 +00:00
|
|
|
vs->dimcolor = pop();
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xA1: // SO_VERB_DIM
|
2002-12-23 19:15:51 +00:00
|
|
|
vs->curmode = 2;
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xA2: // SO_VERB_KEY Set keypress to associate with verb
|
2002-12-23 19:15:51 +00:00
|
|
|
vs->key = pop();
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xA3: // SO_VERB_IMAGE Set verb image
|
2002-12-27 15:32:27 +00:00
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
if (_curVerbSlot && a != vs->imgindex) {
|
|
|
|
setVerbObject(b, a, _curVerbSlot);
|
|
|
|
vs->type = kImageVerbType;
|
|
|
|
vs->imgindex = a;
|
|
|
|
}
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xA4: // SO_VERB_NAME_STR Set verb name
|
2002-12-27 15:32:27 +00:00
|
|
|
a = pop();
|
|
|
|
if (a == 0) {
|
2003-05-21 18:09:49 +00:00
|
|
|
loadPtrToResource(rtVerb, _curVerbSlot, (const byte *)"");
|
2002-12-27 15:32:27 +00:00
|
|
|
} else {
|
|
|
|
loadPtrToResource(rtVerb, _curVerbSlot, getStringAddress(a));
|
|
|
|
}
|
|
|
|
vs->type = kTextVerbType;
|
|
|
|
vs->imgindex = 0;
|
2002-12-23 19:15:51 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xA5: // SO_VERB_CENTER Center verb
|
2002-12-23 19:15:51 +00:00
|
|
|
vs->center = 1;
|
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xA6: // SO_VERB_CHARSET Choose charset for verb
|
2002-12-23 19:15:51 +00:00
|
|
|
// FIXME - TODO
|
2002-12-25 14:31:17 +00:00
|
|
|
vs->charset_nr = pop();
|
2003-11-10 00:28:09 +00:00
|
|
|
warning("SO_VERB_CHARSET %d: not yet implemented", vs->charset_nr);
|
2002-12-23 19:15:51 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
case 0xA7: // SO_VERB_LINE_SPACING Choose linespacing for verb
|
2002-12-23 19:15:51 +00:00
|
|
|
// FIXME - TODO
|
2002-12-27 16:49:08 +00:00
|
|
|
// Note: it seems that var596 stores the "line spacing". It is used by various
|
|
|
|
// scripts that place verbs for that.
|
|
|
|
// Also, var595 contains the vertical position at which to start placing verbs (330)
|
2003-11-10 00:28:09 +00:00
|
|
|
a = pop();
|
2003-12-25 21:27:45 +00:00
|
|
|
warning("SO_VERB_LINE_SPACING %d: not yet implemented", a);
|
2002-12-23 19:15:51 +00:00
|
|
|
break;
|
2002-12-22 23:26:10 +00:00
|
|
|
default:
|
2003-01-05 22:17:26 +00:00
|
|
|
error("o8_verbops: default case 0x%x", subOp);
|
2002-12-22 23:26:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_system() {
|
2002-12-23 18:56:43 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2002-12-29 19:51:10 +00:00
|
|
|
switch (subOp) {
|
|
|
|
case 0x28: // SO_SYSTEM_RESTART Restart game
|
2003-06-02 02:25:24 +00:00
|
|
|
restart();
|
|
|
|
break;
|
2002-12-29 19:51:10 +00:00
|
|
|
case 0x29: // SO_SYSTEM_QUIT Quit game
|
2003-06-02 02:25:24 +00:00
|
|
|
shutDown();
|
|
|
|
break;
|
2002-12-29 19:51:10 +00:00
|
|
|
default:
|
2003-06-02 02:25:24 +00:00
|
|
|
error("o8_system: invalid case 0x%x", subOp);
|
2002-12-29 19:51:10 +00:00
|
|
|
}
|
2002-12-23 15:46:53 +00:00
|
|
|
}
|
|
|
|
|
2002-12-30 17:05:38 +00:00
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_startVideo() {
|
2002-12-28 01:57:19 +00:00
|
|
|
int len = resStrLen(_scriptPointer);
|
2003-08-14 17:17:11 +00:00
|
|
|
|
2004-06-28 00:00:33 +00:00
|
|
|
debug(4, "o8_startVideo(%s)", (const char*)_scriptPointer);
|
2003-08-14 17:17:11 +00:00
|
|
|
|
2003-12-27 16:40:01 +00:00
|
|
|
SmushPlayer *sp = new SmushPlayer(this, 1000000 / 12);
|
2004-06-27 21:52:25 +00:00
|
|
|
sp->play((const char*)_scriptPointer);
|
2003-01-12 01:15:37 +00:00
|
|
|
delete sp;
|
|
|
|
|
2002-12-26 02:18:45 +00:00
|
|
|
_scriptPointer += len + 1;
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_kernelSetFunctions() {
|
2002-12-23 18:56:43 +00:00
|
|
|
// TODO
|
2003-01-06 13:41:29 +00:00
|
|
|
Actor *a;
|
2002-12-25 14:46:39 +00:00
|
|
|
int args[30];
|
2003-05-18 21:03:57 +00:00
|
|
|
int len = getStackList(args, ARRAYSIZE(args));
|
2002-12-23 18:56:43 +00:00
|
|
|
|
2002-12-23 21:56:26 +00:00
|
|
|
switch (args[0]) {
|
2003-01-11 19:21:38 +00:00
|
|
|
case 11: { // lockObject
|
|
|
|
int objidx = getObjectIndex(args[1]);
|
|
|
|
if (objidx == -1) {
|
2003-05-18 21:14:50 +00:00
|
|
|
warning("Cannot find object %d to lock", args[1]);
|
2003-01-11 19:21:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
lock(rtFlObject, objidx);
|
|
|
|
|
2004-07-19 01:58:08 +00:00
|
|
|
// if (ObjData.fl_object_index != 0) {
|
|
|
|
// ObjData.locked = 1;
|
2002-12-25 19:30:59 +00:00
|
|
|
// }
|
2002-12-23 22:13:06 +00:00
|
|
|
break;
|
2003-01-11 19:21:38 +00:00
|
|
|
}
|
|
|
|
case 12: { // unlockObject
|
|
|
|
int objidx = getObjectIndex(args[1]);
|
|
|
|
if (objidx == -1) {
|
2003-05-18 21:14:50 +00:00
|
|
|
warning("Cannot find object %d to unlock", args[1]);
|
2003-01-11 19:21:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
unlock(rtFlObject, objidx);
|
|
|
|
|
2004-07-19 01:58:08 +00:00
|
|
|
// if (ObjData.fl_object_index != 0) {
|
|
|
|
// ObjData.locked = 0;
|
2002-12-25 19:30:59 +00:00
|
|
|
// }
|
2002-12-23 22:13:06 +00:00
|
|
|
break;
|
2003-01-11 19:21:38 +00:00
|
|
|
}
|
2002-12-25 19:06:31 +00:00
|
|
|
case 13: // remapCostume
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(args[1], "o8_kernelSetFunctions:remapCostume");
|
2003-01-06 13:41:29 +00:00
|
|
|
a->remapActorPalette(args[2], args[3], args[4], -1);
|
2002-12-23 22:13:06 +00:00
|
|
|
break;
|
2002-12-25 19:06:31 +00:00
|
|
|
case 14: // remapCostumeInsert
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(args[1], "o8_kernelSetFunctions:remapCostumeInsert");
|
2003-01-06 13:41:29 +00:00
|
|
|
a->remapActorPalette(args[2], args[3], args[4], args[5]);
|
2002-12-25 03:48:27 +00:00
|
|
|
break;
|
2002-12-25 19:06:31 +00:00
|
|
|
case 15: // setVideoFrameRate
|
2002-12-25 17:10:34 +00:00
|
|
|
// not used anymore (was smush frame rate)
|
2002-12-25 03:48:27 +00:00
|
|
|
break;
|
2003-01-13 14:04:41 +00:00
|
|
|
case 20: // setBoxScaleSlot
|
|
|
|
setBoxScaleSlot(args[1], args[2]);
|
2002-12-25 17:10:34 +00:00
|
|
|
break;
|
2002-12-25 19:06:31 +00:00
|
|
|
case 21: // setScaleSlot
|
2003-01-13 01:29:45 +00:00
|
|
|
setScaleSlot(args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
|
2002-12-25 17:10:34 +00:00
|
|
|
break;
|
2002-12-25 19:06:31 +00:00
|
|
|
case 22: // setBannerColors
|
2002-12-30 17:05:38 +00:00
|
|
|
// warning("o8_kernelSetFunctions: setBannerColors(%d, %d, %d, %d)", args[1], args[2], args[3], args[4]);
|
2002-12-25 17:10:34 +00:00
|
|
|
break;
|
2003-01-06 13:41:29 +00:00
|
|
|
case 23: // setActorChoreLimbFrame
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(args[1], "o8_kernelSetFunctions:setActorChoreLimbFrame");
|
2003-01-06 16:04:01 +00:00
|
|
|
|
|
|
|
a->startAnimActor(args[2]);
|
|
|
|
a->animateLimb(args[3], args[4]);
|
2002-12-25 17:10:34 +00:00
|
|
|
break;
|
2002-12-25 19:06:31 +00:00
|
|
|
case 24: // clearTextQueue
|
2003-07-16 20:50:26 +00:00
|
|
|
// TODO - clearTextQueue. Maybe this should just call removeBlastTexts() ?
|
|
|
|
warning("o8_kernelSetFunctions: clearTextQueue()");
|
2002-12-25 17:10:34 +00:00
|
|
|
break;
|
2003-01-26 06:17:25 +00:00
|
|
|
case 25: { // saveGameReadName
|
|
|
|
char *address = (char*)getStringAddress(args[2]);
|
|
|
|
char name[30];
|
|
|
|
|
|
|
|
if (!address) {
|
|
|
|
warning("o8_kernelSetFunctions: saveGameReadName failed finding slot string %d", args[2]);
|
|
|
|
break;
|
|
|
|
}
|
2004-06-25 22:39:21 +00:00
|
|
|
getSavegameName(args[1] - 1, name);
|
2003-01-26 06:17:25 +00:00
|
|
|
if (strlen(name) > 0 && strlen(name) < 30)
|
|
|
|
strcpy(address, name);
|
2002-12-25 17:10:34 +00:00
|
|
|
break;
|
2003-01-26 06:17:25 +00:00
|
|
|
}
|
|
|
|
case 26: { // saveGame?
|
|
|
|
//char *address = (char*)getStringAddress(args[2]);
|
|
|
|
char address[30];
|
|
|
|
warning("o8_kernelSetFunctions: saveGame?(%d, %s)", args[1], address);
|
2002-12-25 17:10:34 +00:00
|
|
|
break;
|
2003-01-26 06:17:25 +00:00
|
|
|
}
|
|
|
|
case 27: { // FIXME: This doesn't work
|
|
|
|
// saveGameRead
|
2003-01-26 06:23:12 +00:00
|
|
|
_saveLoadSlot = args[1];
|
2003-01-26 06:17:25 +00:00
|
|
|
_saveLoadFlag = 2;
|
2004-01-31 22:12:35 +00:00
|
|
|
_saveTemporaryState = false;
|
2003-05-18 21:14:50 +00:00
|
|
|
warning("Sgl: %d", args[1]);
|
2002-12-25 17:10:34 +00:00
|
|
|
break;
|
2003-01-26 06:17:25 +00:00
|
|
|
}
|
2002-12-25 19:06:31 +00:00
|
|
|
case 28: // saveGameStampScreenshot
|
2002-12-30 17:05:38 +00:00
|
|
|
warning("o8_kernelSetFunctions: saveGameStampScreenshot(%d, %d, %d, %d, %d, %d)", args[1], args[2], args[3], args[4], args[5], args[6]);
|
2002-12-25 17:10:34 +00:00
|
|
|
break;
|
2002-12-25 19:06:31 +00:00
|
|
|
case 29: // setKeyScript
|
2003-02-08 01:27:21 +00:00
|
|
|
_keyScriptKey = args[1];
|
|
|
|
_keyScriptNo = args[2];
|
2002-12-25 17:10:34 +00:00
|
|
|
break;
|
2002-12-25 19:06:31 +00:00
|
|
|
case 30: // killAllScriptsButMe
|
2002-12-30 17:05:38 +00:00
|
|
|
warning("o8_kernelSetFunctions: killAllScriptsButMe()");
|
2002-12-25 20:29:40 +00:00
|
|
|
killAllScriptsExceptCurrent();
|
2002-12-25 17:10:34 +00:00
|
|
|
break;
|
2002-12-25 19:06:31 +00:00
|
|
|
case 31: // stopAllVideo
|
2002-12-30 17:05:38 +00:00
|
|
|
warning("o8_kernelSetFunctions: stopAllVideo()");
|
2002-12-25 17:10:34 +00:00
|
|
|
break;
|
2002-12-25 19:06:31 +00:00
|
|
|
case 32: // writeRegistryValue
|
2002-12-30 17:05:38 +00:00
|
|
|
warning("o8_kernelSetFunctions: writeRegistryValue(%d, %d)", args[1], args[2]);
|
2002-12-25 17:10:34 +00:00
|
|
|
break;
|
2002-12-25 19:06:31 +00:00
|
|
|
case 33: // paletteSetIntensity
|
2002-12-30 17:05:38 +00:00
|
|
|
warning("o8_kernelSetFunctions: paletteSetIntensity(%d, %d)", args[1], args[2]);
|
2002-12-25 17:10:34 +00:00
|
|
|
break;
|
2002-12-25 19:06:31 +00:00
|
|
|
case 34: // queryQuit
|
2004-04-04 19:24:03 +00:00
|
|
|
if (_confirmExit)
|
|
|
|
confirmexitDialog();
|
|
|
|
else
|
|
|
|
_quit = true;
|
2002-12-25 17:10:34 +00:00
|
|
|
break;
|
2002-12-27 19:48:30 +00:00
|
|
|
case 108: // buildPaletteShadow
|
2002-12-25 17:10:34 +00:00
|
|
|
setupShadowPalette(args[1], args[2], args[3], args[4], args[5], args[6]);
|
|
|
|
break;
|
2002-12-27 19:48:30 +00:00
|
|
|
case 109: // setPaletteShadow
|
2002-12-25 17:10:34 +00:00
|
|
|
setupShadowPalette(0, args[1], args[2], args[3], args[4], args[5]);
|
|
|
|
break;
|
2002-12-27 20:15:24 +00:00
|
|
|
case 118: // blastShadowObject
|
2002-12-25 17:10:34 +00:00
|
|
|
enqueueObject(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], 3);
|
|
|
|
break;
|
2002-12-27 20:15:24 +00:00
|
|
|
case 119: // superBlastObject
|
2002-12-25 17:10:34 +00:00
|
|
|
enqueueObject(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], 0);
|
|
|
|
break;
|
|
|
|
|
2002-12-23 21:56:26 +00:00
|
|
|
default:
|
2003-01-05 22:17:26 +00:00
|
|
|
warning("o8_kernelSetFunctions: default case 0x%x (len = %d)", args[0], len);
|
2002-12-23 21:56:26 +00:00
|
|
|
}
|
2002-12-23 15:46:53 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_kernelGetFunctions() {
|
2002-12-23 20:25:47 +00:00
|
|
|
// TODO
|
2002-12-25 14:46:39 +00:00
|
|
|
int args[30];
|
2003-05-18 21:03:57 +00:00
|
|
|
int len = getStackList(args, ARRAYSIZE(args));
|
2002-12-25 12:25:35 +00:00
|
|
|
|
2002-12-23 20:25:47 +00:00
|
|
|
switch (args[0]) {
|
2002-12-30 01:40:12 +00:00
|
|
|
case 0x73: // getWalkBoxAt
|
|
|
|
push(getSpecialBox(args[1], args[2]));
|
|
|
|
break;
|
|
|
|
case 0x74: // isPointInBox
|
|
|
|
push(checkXYInBoxBounds(args[3], args[1], args[2]));
|
|
|
|
break;
|
2002-12-25 02:12:12 +00:00
|
|
|
case 0xD3: // getKeyState
|
2003-12-05 00:02:01 +00:00
|
|
|
push(getKeyState(args[1]));
|
2003-01-16 12:47:34 +00:00
|
|
|
break;
|
|
|
|
case 0xCE: // getRGBSlot
|
2002-12-25 02:12:12 +00:00
|
|
|
case 0xD7: // getBox
|
2002-12-28 00:45:44 +00:00
|
|
|
push(0);
|
2003-01-05 22:17:26 +00:00
|
|
|
warning("o8_kernelGetFunctions: default case 0x%x (len = %d)", args[0], len);
|
2002-12-28 00:45:44 +00:00
|
|
|
break;
|
2002-12-30 11:03:13 +00:00
|
|
|
case 0xD8: { // findBlastObject
|
2003-01-14 11:59:39 +00:00
|
|
|
int x = args[1] + (camera._cur.x & 7);
|
2003-09-09 20:54:19 +00:00
|
|
|
int y = args[2] + _screenTop;
|
2002-12-30 11:03:13 +00:00
|
|
|
BlastObject *eo;
|
|
|
|
|
2003-03-23 19:28:12 +00:00
|
|
|
for (int i = _blastObjectQueuePos - 1; i >= 0; i--) {
|
2003-01-16 00:40:19 +00:00
|
|
|
eo = &_blastObjectQueue[i];
|
2003-01-14 11:59:39 +00:00
|
|
|
|
2004-01-08 03:10:16 +00:00
|
|
|
if (eo->rect.contains(x, y) && !getClass(eo->number, kObjectClassUntouchable)) {
|
|
|
|
push(eo->number);
|
|
|
|
return;
|
2002-12-30 11:03:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
push(0);
|
2002-12-28 00:45:44 +00:00
|
|
|
break;
|
2002-12-30 11:03:13 +00:00
|
|
|
}
|
2003-03-28 23:53:07 +00:00
|
|
|
case 0xD9: { // actorHit - used, for example, to detect ship collision
|
|
|
|
// during ship-to-ship combat.
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(args[1], "actorHit");
|
2003-06-16 15:11:24 +00:00
|
|
|
AkosRenderer *ar = (AkosRenderer *) _costumeRenderer;
|
|
|
|
bool old_need_redraw = a->needRedraw;
|
|
|
|
|
|
|
|
ar->_actorHitX = args[2];
|
|
|
|
ar->_actorHitY = args[3] + _screenTop;
|
|
|
|
ar->_actorHitMode = true;
|
|
|
|
ar->_actorHitResult = false;
|
|
|
|
|
|
|
|
a->needRedraw = true;
|
|
|
|
a->drawActorCostume();
|
|
|
|
a->needRedraw = old_need_redraw;
|
2003-01-16 13:55:57 +00:00
|
|
|
|
2003-06-16 15:11:24 +00:00
|
|
|
ar->_actorHitMode = false;
|
|
|
|
push(ar->_actorHitResult);
|
2002-12-28 00:45:44 +00:00
|
|
|
break;
|
2003-03-28 23:53:07 +00:00
|
|
|
}
|
2002-12-25 02:12:12 +00:00
|
|
|
case 0xDA: // lipSyncWidth
|
2004-01-06 17:28:29 +00:00
|
|
|
push(_imuseDigital->getCurVoiceLipSyncWidth());
|
2004-01-07 05:28:56 +00:00
|
|
|
break;
|
2002-12-25 02:12:12 +00:00
|
|
|
case 0xDB: // lipSyncHeight
|
2004-01-06 17:28:29 +00:00
|
|
|
push(_imuseDigital->getCurVoiceLipSyncHeight());
|
2003-01-06 13:41:29 +00:00
|
|
|
break;
|
2002-12-25 02:12:12 +00:00
|
|
|
case 0xDC: // actorTalkAnimation
|
2003-01-06 13:41:29 +00:00
|
|
|
{
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(args[1], "actorTalkAnimation");
|
2003-05-22 09:58:33 +00:00
|
|
|
push(a->talkStartFrame);
|
2003-01-06 13:41:29 +00:00
|
|
|
}
|
2002-12-25 14:46:39 +00:00
|
|
|
break;
|
2004-04-05 18:24:36 +00:00
|
|
|
case 0xDD: // getGroupSfxVol
|
|
|
|
push(_imuseDigital->getGroupSfxVolume());
|
2002-12-25 14:46:39 +00:00
|
|
|
break;
|
2004-04-05 18:24:36 +00:00
|
|
|
case 0xDE: // getGroupVoiceVol
|
|
|
|
push(_imuseDigital->getGroupVoiceVolume());
|
2002-12-25 14:46:39 +00:00
|
|
|
break;
|
2004-04-05 18:24:36 +00:00
|
|
|
case 0xDF: // getGroupMusicVol
|
|
|
|
push(_imuseDigital->getGroupMusicVolume());
|
2002-12-25 14:46:39 +00:00
|
|
|
break;
|
2002-12-25 02:12:12 +00:00
|
|
|
case 0xE0: // readRegistryValue
|
2002-12-25 14:46:39 +00:00
|
|
|
{
|
|
|
|
int array = args[1];
|
|
|
|
// FIXME - hack: for some reasons the wrong variable ID arrives here, compared to the
|
|
|
|
// scripts. Probably a wrong push/pop somewhere. For now override to correct value.
|
|
|
|
array = 658;
|
|
|
|
ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(array));
|
2004-02-25 10:48:35 +00:00
|
|
|
if (!strcmp((char *)ah->data, "Text Status"))
|
|
|
|
push(ConfMan.getBool("subtitles"));
|
|
|
|
else if (!strcmp((char *)ah->data, "Saveload Page") || !strcmp((char *)ah->data, "Object Names"))
|
2002-12-25 14:46:39 +00:00
|
|
|
push(1);
|
|
|
|
else
|
|
|
|
push(0);
|
|
|
|
}
|
|
|
|
break;
|
2003-01-15 13:29:00 +00:00
|
|
|
case 0xE1: // imGetMusicPosition
|
2004-01-06 17:28:29 +00:00
|
|
|
push(_imuseDigital->getCurMusicPosInMs());
|
2003-01-15 13:29:00 +00:00
|
|
|
break;
|
2003-01-06 16:04:01 +00:00
|
|
|
case 0xE2: // musicLipSyncWidth
|
2004-01-07 06:51:45 +00:00
|
|
|
push(_imuseDigital->getCurMusicLipSyncWidth(args[1]));
|
2004-01-07 05:08:46 +00:00
|
|
|
break;
|
2003-01-04 15:08:30 +00:00
|
|
|
case 0xE3: // musicLipSyncHeight
|
2004-01-07 06:51:45 +00:00
|
|
|
push(_imuseDigital->getCurMusicLipSyncHeight(args[1]));
|
2003-01-04 15:08:30 +00:00
|
|
|
break;
|
2002-12-23 20:25:47 +00:00
|
|
|
default:
|
2003-01-05 22:17:26 +00:00
|
|
|
error("o8_kernelGetFunctions: default case 0x%x (len = %d)", args[0], len);
|
2002-12-23 20:25:47 +00:00
|
|
|
}
|
2002-12-25 02:12:12 +00:00
|
|
|
|
2002-12-23 20:25:47 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_getActorChore() {
|
2003-01-06 13:41:29 +00:00
|
|
|
int actnum = pop();
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(actnum, "o8_getActorChore");
|
2003-01-06 16:04:01 +00:00
|
|
|
push(a->frame);
|
2003-01-06 13:41:29 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_getActorZPlane() {
|
2003-05-14 10:16:57 +00:00
|
|
|
int actnum = pop();
|
2003-05-23 15:48:07 +00:00
|
|
|
Actor *a = derefActor(actnum, "o8_getActorZPlane");
|
2003-05-14 10:16:57 +00:00
|
|
|
|
|
|
|
int z = a->forceClip;
|
|
|
|
if (z == 100) {
|
|
|
|
z = getMaskFromBox(a->walkbox);
|
2004-01-06 09:49:08 +00:00
|
|
|
if (z > gdi._numZBuffer - 1)
|
|
|
|
z = gdi._numZBuffer - 1;
|
2003-05-14 10:16:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
push(z);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_getObjectImageX() {
|
2002-12-25 00:04:12 +00:00
|
|
|
int i = getObjectIndex(pop());
|
|
|
|
push(_objs[i].x_pos);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_getObjectImageY() {
|
2002-12-25 00:04:12 +00:00
|
|
|
int i = getObjectIndex(pop());
|
|
|
|
push(_objs[i].y_pos);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_getObjectImageWidth() {
|
2002-12-25 00:04:12 +00:00
|
|
|
int i = getObjectIndex(pop());
|
|
|
|
push(_objs[i].width);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_getObjectImageHeight() {
|
2002-12-25 00:04:12 +00:00
|
|
|
int i = getObjectIndex(pop());
|
|
|
|
push(_objs[i].height);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_getStringWidth() {
|
2002-12-27 15:38:04 +00:00
|
|
|
int charset = pop();
|
|
|
|
int oldID = _charset->getCurID();
|
|
|
|
int width;
|
2003-05-27 15:33:38 +00:00
|
|
|
const byte *msg = _scriptPointer;
|
2004-04-02 21:56:27 +00:00
|
|
|
byte transBuf[512];
|
2002-12-27 15:38:04 +00:00
|
|
|
|
2003-05-27 15:33:38 +00:00
|
|
|
// Skip to the next instruction
|
|
|
|
_scriptPointer += resStrLen(_scriptPointer) + 1;
|
|
|
|
|
|
|
|
if (msg[0] == '/') {
|
2004-04-02 21:56:27 +00:00
|
|
|
translateText(msg, transBuf);
|
|
|
|
msg = transBuf;
|
2003-05-27 15:33:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-12-27 15:38:04 +00:00
|
|
|
// Temporary set the specified charset id
|
2003-05-27 15:33:38 +00:00
|
|
|
_charset->setCurID(_string[charset].charset);
|
|
|
|
// Determine the strings width
|
|
|
|
width = _charset->getStringWidth(0, msg);
|
|
|
|
// Revert to old font
|
2002-12-27 15:38:04 +00:00
|
|
|
_charset->setCurID(oldID);
|
2003-05-27 15:33:38 +00:00
|
|
|
|
2002-12-27 15:32:27 +00:00
|
|
|
push(width);
|
|
|
|
}
|
2003-01-27 06:51:26 +00:00
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v8::o8_drawObject() {
|
2004-01-11 21:48:31 +00:00
|
|
|
int state = pop();
|
|
|
|
int y = pop();
|
|
|
|
int x = pop();
|
|
|
|
int obj = pop();
|
|
|
|
int objnum = getObjectIndex(obj);
|
2004-06-21 02:33:23 +00:00
|
|
|
int imagecount;
|
2003-01-27 06:51:26 +00:00
|
|
|
ObjectData *od;
|
|
|
|
|
|
|
|
if (!objnum)
|
|
|
|
return;
|
|
|
|
|
2003-03-06 17:58:13 +00:00
|
|
|
od = &_objs[objnum];
|
|
|
|
if (x != 0x7FFFFFFF) {
|
|
|
|
od->x_pos = x;
|
|
|
|
od->y_pos = y;
|
|
|
|
}
|
2003-01-27 06:51:26 +00:00
|
|
|
|
|
|
|
addObjectToDrawQue(objnum);
|
|
|
|
|
2004-06-21 02:33:23 +00:00
|
|
|
if (state == 255) {
|
|
|
|
state = getState(obj);
|
|
|
|
imagecount = getObjectImageCount(obj);
|
|
|
|
|
|
|
|
if (imagecount != state)
|
|
|
|
state++;
|
|
|
|
else
|
|
|
|
state = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (state == 254)
|
|
|
|
state = _rnd.getRandomNumber(getObjectImageCount(obj));
|
2003-01-27 06:51:26 +00:00
|
|
|
|
2003-01-27 07:07:55 +00:00
|
|
|
putState(obj, state);
|
2003-01-27 06:51:26 +00:00
|
|
|
}
|
2003-10-03 18:33:57 +00:00
|
|
|
|
|
|
|
} // End of namespace Scumm
|