2001-10-16 10:01:48 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
2004-01-06 12:45:34 +00:00
|
|
|
* Copyright (C) 2001-2004 The ScummVM project
|
2001-10-16 10:01:48 +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.
|
|
|
|
*
|
2001-11-06 20:00:47 +00:00
|
|
|
* $Header$
|
2001-10-16 10:01:48 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
2003-09-11 10:32:15 +00:00
|
|
|
|
2003-12-27 15:22:59 +00:00
|
|
|
#include "common/config-manager.h"
|
|
|
|
|
2003-09-11 10:32:15 +00:00
|
|
|
#include "scumm/actor.h"
|
|
|
|
#include "scumm/charset.h"
|
|
|
|
#include "scumm/imuse.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"
|
|
|
|
|
2002-04-21 21:33:47 +00:00
|
|
|
#include "sound/mididrv.h"
|
2003-06-15 00:54:14 +00:00
|
|
|
#include "sound/mixer.h"
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2004-01-16 22:18:54 +00:00
|
|
|
#include "scumm/insane/insane.h"
|
2002-11-06 16:44:57 +00:00
|
|
|
|
2003-10-03 18:33:57 +00:00
|
|
|
namespace Scumm {
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
#define OPCODE(x) { &ScummEngine_v6::x, #x }
|
2002-11-06 16:44:57 +00:00
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::setupOpcodes() {
|
2002-12-16 12:12:31 +00:00
|
|
|
static const OpcodeEntryV6 opcodes[256] = {
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 00 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_pushByte),
|
|
|
|
OPCODE(o6_pushWord),
|
|
|
|
OPCODE(o6_pushByteVar),
|
|
|
|
OPCODE(o6_pushWordVar),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 04 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_byteArrayRead),
|
|
|
|
OPCODE(o6_wordArrayRead),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 08 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_byteArrayIndexedRead),
|
|
|
|
OPCODE(o6_wordArrayIndexedRead),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 0C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_dup),
|
2002-12-22 19:14:53 +00:00
|
|
|
OPCODE(o6_not),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_eq),
|
|
|
|
OPCODE(o6_neq),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 10 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_gt),
|
|
|
|
OPCODE(o6_lt),
|
|
|
|
OPCODE(o6_le),
|
|
|
|
OPCODE(o6_ge),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 14 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_add),
|
|
|
|
OPCODE(o6_sub),
|
|
|
|
OPCODE(o6_mul),
|
|
|
|
OPCODE(o6_div),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 18 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_land),
|
|
|
|
OPCODE(o6_lor),
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o6_pop),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 1C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 20 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 24 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 28 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 2C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 30 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 34 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 38 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 3C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 40 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_writeByteVar),
|
|
|
|
OPCODE(o6_writeWordVar),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 44 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_byteArrayWrite),
|
|
|
|
OPCODE(o6_wordArrayWrite),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 48 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_byteArrayIndexedWrite),
|
|
|
|
OPCODE(o6_wordArrayIndexedWrite),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 4C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_byteVarInc),
|
|
|
|
OPCODE(o6_wordVarInc),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 50 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_byteArrayInc),
|
|
|
|
OPCODE(o6_wordArrayInc),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 54 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_byteVarDec),
|
|
|
|
OPCODE(o6_wordVarDec),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 58 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_byteArrayDec),
|
|
|
|
OPCODE(o6_wordArrayDec),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 5C */
|
2003-11-09 22:12:16 +00:00
|
|
|
OPCODE(o6_if),
|
|
|
|
OPCODE(o6_ifNot),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_startScript),
|
2003-11-09 22:12:16 +00:00
|
|
|
OPCODE(o6_startScriptQuick),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 60 */
|
2003-11-09 22:12:16 +00:00
|
|
|
OPCODE(o6_startObject),
|
|
|
|
OPCODE(o6_drawObject),
|
|
|
|
OPCODE(o6_drawObjectAt),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_drawBlastObject),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 64 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_setBlastObjectWindow),
|
2002-12-24 02:38:41 +00:00
|
|
|
OPCODE(o6_stopObjectCode),
|
|
|
|
OPCODE(o6_stopObjectCode),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_endCutscene),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 68 */
|
2002-12-22 23:26:10 +00:00
|
|
|
OPCODE(o6_cutscene),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_stopMusic),
|
|
|
|
OPCODE(o6_freezeUnfreeze),
|
|
|
|
OPCODE(o6_cursorCommand),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 6C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_breakHere),
|
2003-11-10 08:00:55 +00:00
|
|
|
OPCODE(o6_ifClassOfIs),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_setClass),
|
|
|
|
OPCODE(o6_getState),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 70 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_setState),
|
|
|
|
OPCODE(o6_setOwner),
|
|
|
|
OPCODE(o6_getOwner),
|
|
|
|
OPCODE(o6_jump),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 74 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_startSound),
|
|
|
|
OPCODE(o6_stopSound),
|
|
|
|
OPCODE(o6_startMusic),
|
|
|
|
OPCODE(o6_stopObjectScript),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 78 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_panCameraTo),
|
|
|
|
OPCODE(o6_actorFollowCamera),
|
|
|
|
OPCODE(o6_setCameraAt),
|
|
|
|
OPCODE(o6_loadRoom),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 7C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_stopScript),
|
|
|
|
OPCODE(o6_walkActorToObj),
|
|
|
|
OPCODE(o6_walkActorTo),
|
2003-11-09 22:12:16 +00:00
|
|
|
OPCODE(o6_putActorAtXY),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 80 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_putActorAtObject),
|
|
|
|
OPCODE(o6_faceActor),
|
|
|
|
OPCODE(o6_animateActor),
|
|
|
|
OPCODE(o6_doSentence),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 84 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_pickupObject),
|
|
|
|
OPCODE(o6_loadRoomWithEgo),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_getRandomNumber),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 88 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_getRandomNumberRange),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_getActorMoving),
|
2002-12-22 19:14:53 +00:00
|
|
|
OPCODE(o6_isScriptRunning),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 8C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_getActorRoom),
|
|
|
|
OPCODE(o6_getObjectX),
|
|
|
|
OPCODE(o6_getObjectY),
|
|
|
|
OPCODE(o6_getObjectOldDir),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 90 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_getActorWalkBox),
|
|
|
|
OPCODE(o6_getActorCostume),
|
|
|
|
OPCODE(o6_findInventory),
|
|
|
|
OPCODE(o6_getInventoryCount),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 94 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_getVerbFromXY),
|
|
|
|
OPCODE(o6_beginOverride),
|
|
|
|
OPCODE(o6_endOverride),
|
|
|
|
OPCODE(o6_setObjectName),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 98 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_isSoundRunning),
|
|
|
|
OPCODE(o6_setBoxFlags),
|
|
|
|
OPCODE(o6_createBoxMatrix),
|
|
|
|
OPCODE(o6_resourceRoutines),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* 9C */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_roomOps),
|
2002-12-23 15:46:53 +00:00
|
|
|
OPCODE(o6_actorOps),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_verbOps),
|
|
|
|
OPCODE(o6_getActorFromXY),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* A0 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_findObject),
|
|
|
|
OPCODE(o6_pseudoRoom),
|
|
|
|
OPCODE(o6_getActorElevation),
|
|
|
|
OPCODE(o6_getVerbEntrypoint),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* A4 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_arrayOps),
|
|
|
|
OPCODE(o6_saveRestoreVerbs),
|
|
|
|
OPCODE(o6_drawBox),
|
2003-03-02 22:27:32 +00:00
|
|
|
OPCODE(o6_pop),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* A8 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_getActorWidth),
|
|
|
|
OPCODE(o6_wait),
|
|
|
|
OPCODE(o6_getActorScaleX),
|
|
|
|
OPCODE(o6_getActorAnimCounter1),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* AC */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_soundKludge),
|
|
|
|
OPCODE(o6_isAnyOf),
|
|
|
|
OPCODE(o6_quitPauseRestart),
|
|
|
|
OPCODE(o6_isActorInBox),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* B0 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_delay),
|
2002-12-26 21:50:13 +00:00
|
|
|
OPCODE(o6_delaySeconds),
|
|
|
|
OPCODE(o6_delayMinutes),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_stopSentence),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* B4 */
|
2003-01-01 17:57:14 +00:00
|
|
|
OPCODE(o6_printLine),
|
|
|
|
OPCODE(o6_printCursor),
|
|
|
|
OPCODE(o6_printDebug),
|
|
|
|
OPCODE(o6_printSystem),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* B8 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_printActor),
|
|
|
|
OPCODE(o6_printEgo),
|
|
|
|
OPCODE(o6_talkActor),
|
|
|
|
OPCODE(o6_talkEgo),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* BC */
|
2003-11-10 08:00:55 +00:00
|
|
|
OPCODE(o6_dimArray),
|
2002-12-16 12:12:31 +00:00
|
|
|
OPCODE(o6_dummy),
|
2002-12-23 12:50:38 +00:00
|
|
|
OPCODE(o6_startObjectQuick),
|
2003-11-09 22:12:16 +00:00
|
|
|
OPCODE(o6_startScriptQuick2),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* C0 */
|
2003-11-10 08:00:55 +00:00
|
|
|
OPCODE(o6_dim2dimArray),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* C4 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_abs),
|
|
|
|
OPCODE(o6_distObjectObject),
|
|
|
|
OPCODE(o6_distObjectPt),
|
|
|
|
OPCODE(o6_distPtPt),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* C8 */
|
2003-01-06 01:53:38 +00:00
|
|
|
OPCODE(o6_kernelGetFunctions),
|
|
|
|
OPCODE(o6_kernelSetFunctions),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_delayFrames),
|
|
|
|
OPCODE(o6_pickOneOf),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* CC */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_pickOneOfDefault),
|
2003-02-16 14:52:25 +00:00
|
|
|
OPCODE(o6_stampObject),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* D0 */
|
2003-02-18 00:13:24 +00:00
|
|
|
OPCODE(o6_getDateTime),
|
2003-02-14 08:12:45 +00:00
|
|
|
OPCODE(o6_stopTalking),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_getAnimateVariable),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* D4 */
|
2003-02-21 00:42:51 +00:00
|
|
|
OPCODE(o6_shuffle),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_jumpToScript),
|
|
|
|
OPCODE(o6_band),
|
|
|
|
OPCODE(o6_bor),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* D8 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_isRoomScriptRunning),
|
2003-02-15 09:39:52 +00:00
|
|
|
OPCODE(o6_closeFile),
|
|
|
|
OPCODE(o6_openFile),
|
2003-04-21 00:44:46 +00:00
|
|
|
OPCODE(o6_readFile),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* DC */
|
2003-09-13 20:54:12 +00:00
|
|
|
OPCODE(o6_writeFile),
|
2003-02-17 10:14:43 +00:00
|
|
|
OPCODE(o6_findAllObjects),
|
2003-02-15 09:39:52 +00:00
|
|
|
OPCODE(o6_deleteFile),
|
2004-01-02 13:21:13 +00:00
|
|
|
OPCODE(o6_rename),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* E0 */
|
2003-02-18 23:59:54 +00:00
|
|
|
OPCODE(o6_unknownE0),
|
2003-03-18 20:32:01 +00:00
|
|
|
OPCODE(o6_unknownE1),
|
2003-02-21 00:42:51 +00:00
|
|
|
OPCODE(o6_localizeArray),
|
2003-02-17 21:42:33 +00:00
|
|
|
OPCODE(o6_pickVarRandom),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* E4 */
|
2003-04-20 15:02:58 +00:00
|
|
|
OPCODE(o6_unknownE4),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* E8 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2003-05-19 04:29:41 +00:00
|
|
|
OPCODE(o6_unknownEA),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* EC */
|
2002-12-24 00:41:59 +00:00
|
|
|
OPCODE(o6_getActorLayer),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_getObjectNewDir),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* F0 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2003-08-28 15:23:23 +00:00
|
|
|
OPCODE(o6_readINI),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* F4 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* F8 */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2003-05-17 01:57:54 +00:00
|
|
|
OPCODE(o6_unknownFA),
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
2002-04-11 17:19:16 +00:00
|
|
|
/* FC */
|
2002-11-06 16:44:57 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2002-03-05 09:58:12 +00:00
|
|
|
};
|
|
|
|
|
2002-12-16 12:12:31 +00:00
|
|
|
_opcodesV6 = opcodes;
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
2002-12-22 19:14:53 +00:00
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::executeOpcode(byte i) {
|
2002-12-22 19:14:53 +00:00
|
|
|
OpcodeProcV6 op = _opcodesV6[i].proc;
|
|
|
|
(this->*op) ();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
const char *ScummEngine_v6::getOpcodeDesc(byte i) {
|
2002-12-22 19:14:53 +00:00
|
|
|
return _opcodesV6[i].desc;
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
int ScummEngine_v6::popRoomAndObj(int *room) {
|
2001-12-27 17:51:58 +00:00
|
|
|
int obj;
|
|
|
|
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version >= 7) {
|
2001-12-27 17:51:58 +00:00
|
|
|
obj = pop();
|
|
|
|
*room = getObjectRoom(obj);
|
|
|
|
} else {
|
|
|
|
*room = pop();
|
|
|
|
obj = pop();
|
|
|
|
}
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2004-01-19 20:27:31 +00:00
|
|
|
ArrayHeader *ScummEngine_v6::defineArray(int array, int type, int dim2, int dim1) {
|
|
|
|
int id;
|
|
|
|
int size;
|
|
|
|
ArrayHeader *ah;
|
|
|
|
|
|
|
|
if (type != 4)
|
|
|
|
type = 5;
|
|
|
|
|
|
|
|
nukeArray(array);
|
|
|
|
|
|
|
|
id = findFreeArrayId();
|
|
|
|
|
|
|
|
if (_version == 8) {
|
|
|
|
if (array & 0x40000000) {
|
|
|
|
}
|
|
|
|
|
|
|
|
if (array & 0x80000000) {
|
|
|
|
error("Can't define bit variable as array pointer");
|
|
|
|
}
|
|
|
|
|
|
|
|
size = (type == 5) ? 32 : 8;
|
|
|
|
} else {
|
|
|
|
if (array & 0x4000) {
|
|
|
|
}
|
|
|
|
|
|
|
|
if (array & 0x8000) {
|
|
|
|
error("Can't define bit variable as array pointer");
|
|
|
|
}
|
|
|
|
|
|
|
|
size = (type == 5) ? 16 : 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
writeVar(array, id);
|
|
|
|
|
|
|
|
size *= dim2 + 1;
|
|
|
|
size *= dim1 + 1;
|
|
|
|
size >>= 3;
|
|
|
|
|
|
|
|
ah = (ArrayHeader *)createResource(rtString, id, size + sizeof(ArrayHeader));
|
|
|
|
|
|
|
|
ah->type = TO_LE_16(type);
|
|
|
|
ah->dim1 = TO_LE_16(dim1 + 1);
|
|
|
|
ah->dim2 = TO_LE_16(dim2 + 1);
|
|
|
|
|
|
|
|
return ah;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v6::nukeArray(int a) {
|
|
|
|
int data;
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2004-01-19 20:27:31 +00:00
|
|
|
data = readVar(a);
|
|
|
|
|
|
|
|
if (data)
|
|
|
|
nukeResource(rtString, data);
|
|
|
|
|
|
|
|
writeVar(a, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int ScummEngine_v6::findFreeArrayId() {
|
|
|
|
byte **addr = _baseArrays;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 1; i < _numArray; i++) {
|
|
|
|
if (!addr[i])
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
error("Out of array pointers, %d max", _numArray);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
ArrayHeader *ScummEngine_v6::getArray(int array) {
|
2002-07-07 13:14:34 +00:00
|
|
|
ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(array));
|
2004-01-19 20:27:31 +00:00
|
|
|
if (!ah)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
// Workaround for a long standing bug where we save array headers in native
|
|
|
|
// endianess, instead of a fixed endianess. We try to detect savegames
|
|
|
|
// which were created on a big endian system and convert them to little
|
|
|
|
// endian.
|
|
|
|
if ((ah->dim1 & 0xF000) || (ah->dim2 & 0xF000) || (ah->type & 0xFF00)) {
|
|
|
|
SWAP_BYTES_16(ah->dim1);
|
|
|
|
SWAP_BYTES_16(ah->dim2);
|
|
|
|
SWAP_BYTES_16(ah->type);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ah;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ScummEngine_v6::readArray(int array, int idx, int base) {
|
|
|
|
ArrayHeader *ah = getArray(array);
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2003-05-14 20:14:03 +00:00
|
|
|
if (ah == NULL || ah->data == NULL) {
|
2002-04-11 17:19:16 +00:00
|
|
|
error("readArray: invalid array %d (%d)", array, readVar(array));
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2004-01-19 20:27:31 +00:00
|
|
|
base += idx * FROM_LE_16(ah->dim1);
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-11-30 23:16:19 +00:00
|
|
|
// FIXME: comment this for the time being as it was causing ft to crash
|
|
|
|
// in the minefeild
|
2003-05-14 20:14:03 +00:00
|
|
|
// FIX THE FIXME: fixing an assert by commenting out is bad. It's evil.
|
|
|
|
// It's wrong. Find the proper cause, or at least, silently return
|
|
|
|
// from the function, but don't just go on overwriting memory!
|
2004-01-19 20:27:31 +00:00
|
|
|
assert(base >= 0 && base < FROM_LE_16(ah->dim1) * FROM_LE_16(ah->dim2));
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2004-01-19 20:27:31 +00:00
|
|
|
if (FROM_LE_16(ah->type) == 4) {
|
2001-10-16 10:01:48 +00:00
|
|
|
return ah->data[base];
|
2003-06-07 00:13:26 +00:00
|
|
|
} else if (_version == 8) {
|
2002-12-23 00:23:36 +00:00
|
|
|
return (int32)READ_LE_UINT32(ah->data + base * 4);
|
2001-10-16 10:01:48 +00:00
|
|
|
} else {
|
2002-07-07 13:14:34 +00:00
|
|
|
return (int16)READ_LE_UINT16(ah->data + base * 2);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-19 20:27:31 +00:00
|
|
|
void ScummEngine_v6::writeArray(int array, int idx, int base, int value) {
|
|
|
|
ArrayHeader *ah = getArray(array);
|
2002-10-18 09:58:16 +00:00
|
|
|
if (!ah)
|
|
|
|
return;
|
2004-01-19 20:27:31 +00:00
|
|
|
base += idx * FROM_LE_16(ah->dim1);
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2004-01-19 20:27:31 +00:00
|
|
|
assert(base >= 0 && base < FROM_LE_16(ah->dim1) * FROM_LE_16(ah->dim2));
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2004-01-19 20:27:31 +00:00
|
|
|
if (FROM_LE_16(ah->type) == 4) {
|
2001-10-16 10:01:48 +00:00
|
|
|
ah->data[base] = value;
|
2003-06-07 00:13:26 +00:00
|
|
|
} else if (_version == 8) {
|
2003-05-04 18:28:32 +00:00
|
|
|
#if defined(SCUMM_NEED_ALIGNMENT)
|
2003-04-06 16:48:52 +00:00
|
|
|
uint32 tmp = TO_LE_32(value);
|
2003-05-04 18:27:55 +00:00
|
|
|
memcpy(&ah->data[base*4], &tmp, 4);
|
2003-04-06 12:57:25 +00:00
|
|
|
#else
|
2002-12-23 00:23:36 +00:00
|
|
|
((uint32 *)ah->data)[base] = TO_LE_32(value);
|
2003-04-06 12:57:25 +00:00
|
|
|
#endif
|
2001-10-16 10:01:48 +00:00
|
|
|
} else {
|
2003-05-04 18:28:32 +00:00
|
|
|
#if defined(SCUMM_NEED_ALIGNMENT)
|
2003-04-06 16:48:52 +00:00
|
|
|
uint16 tmp = TO_LE_16(value);
|
2003-05-04 18:27:55 +00:00
|
|
|
memcpy(&ah->data[base*2], &tmp, 2);
|
2003-04-06 12:57:25 +00:00
|
|
|
#else
|
2002-04-11 17:19:16 +00:00
|
|
|
((uint16 *)ah->data)[base] = TO_LE_16(value);
|
2003-04-06 12:57:25 +00:00
|
|
|
#endif
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-19 20:27:31 +00:00
|
|
|
void ScummEngine_v6::readArrayFromIndexFile() {
|
|
|
|
int num;
|
|
|
|
int a, b, c;
|
|
|
|
|
|
|
|
while ((num = _fileHandle.readUint16LE()) != 0) {
|
|
|
|
a = _fileHandle.readUint16LE();
|
|
|
|
b = _fileHandle.readUint16LE();
|
|
|
|
c = _fileHandle.readUint16LE();
|
|
|
|
if (c == 1)
|
|
|
|
defineArray(num, 1, a, b);
|
|
|
|
else
|
|
|
|
defineArray(num, 5, a, b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
int ScummEngine_v6::getStackList(int *args, uint maxnum) {
|
2001-10-16 10:01:48 +00:00
|
|
|
uint num, i;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
for (i = 0; i < maxnum; i++)
|
2001-10-16 10:01:48 +00:00
|
|
|
args[i] = 0;
|
|
|
|
|
|
|
|
num = pop();
|
|
|
|
|
|
|
|
if (num > maxnum)
|
|
|
|
error("Too many items %d in stack list, max %d", num, maxnum);
|
|
|
|
|
|
|
|
i = num;
|
2002-04-11 17:19:16 +00:00
|
|
|
while (((int)--i) >= 0) {
|
2001-10-16 10:01:48 +00:00
|
|
|
args[i] = pop();
|
|
|
|
}
|
|
|
|
|
|
|
|
return num;
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_pushByte() {
|
2001-10-16 10:01:48 +00:00
|
|
|
push(fetchScriptByte());
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_pushWord() {
|
2002-12-23 00:23:36 +00:00
|
|
|
push(fetchScriptWordSigned());
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_pushByteVar() {
|
2001-10-16 10:01:48 +00:00
|
|
|
push(readVar(fetchScriptByte()));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_pushWordVar() {
|
2001-10-16 10:01:48 +00:00
|
|
|
push(readVar(fetchScriptWord()));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_invalid() {
|
2002-07-07 13:14:34 +00:00
|
|
|
error("Invalid opcode '%x' at %x", _opcode, _scriptPointer - _scriptOrgPointer);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_byteArrayRead() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int base = pop();
|
|
|
|
push(readArray(fetchScriptByte(), 0, base));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_wordArrayRead() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int base = pop();
|
|
|
|
push(readArray(fetchScriptWord(), 0, base));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_byteArrayIndexedRead() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int base = pop();
|
2002-03-08 08:42:11 +00:00
|
|
|
int idx = pop();
|
|
|
|
push(readArray(fetchScriptByte(), idx, base));
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_wordArrayIndexedRead() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int base = pop();
|
2002-03-08 08:42:11 +00:00
|
|
|
int idx = pop();
|
|
|
|
push(readArray(fetchScriptWord(), idx, base));
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_dup() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
|
|
|
push(a);
|
|
|
|
push(a);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_not() {
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() == 0);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_eq() {
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() == pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_neq() {
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() != pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_gt() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() > a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_lt() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() < a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_le() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() <= a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_ge() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() >= a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_add() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() + a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_sub() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() - a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_mul() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() * a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_div() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
if (a == 0)
|
|
|
|
error("division by zero");
|
|
|
|
push(pop() / a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_land() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() && a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_lor() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(pop() || a);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_bor() {
|
2002-11-02 08:18:21 +00:00
|
|
|
int a = pop();
|
|
|
|
push(pop() | a);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_band() {
|
2002-11-02 08:18:21 +00:00
|
|
|
int a = pop();
|
2003-06-14 16:59:20 +00:00
|
|
|
push(pop() & a);
|
2002-11-02 08:18:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_pop() {
|
2001-10-16 10:01:48 +00:00
|
|
|
pop();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_writeByteVar() {
|
2001-10-16 10:01:48 +00:00
|
|
|
writeVar(fetchScriptByte(), pop());
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_writeWordVar() {
|
2001-10-16 10:01:48 +00:00
|
|
|
writeVar(fetchScriptWord(), pop());
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_byteArrayWrite() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
|
|
|
writeArray(fetchScriptByte(), 0, pop(), a);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_wordArrayWrite() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
|
|
|
writeArray(fetchScriptWord(), 0, pop(), a);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_byteArrayIndexedWrite() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int val = pop();
|
|
|
|
int base = pop();
|
|
|
|
writeArray(fetchScriptByte(), pop(), base, val);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_wordArrayIndexedWrite() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int val = pop();
|
|
|
|
int base = pop();
|
|
|
|
writeArray(fetchScriptWord(), pop(), base, val);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_byteVarInc() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int var = fetchScriptByte();
|
2002-04-11 17:19:16 +00:00
|
|
|
writeVar(var, readVar(var) + 1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_wordVarInc() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int var = fetchScriptWord();
|
2002-04-11 17:19:16 +00:00
|
|
|
writeVar(var, readVar(var) + 1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_byteArrayInc() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int var = fetchScriptByte();
|
|
|
|
int base = pop();
|
|
|
|
writeArray(var, 0, base, readArray(var, 0, base) + 1);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_wordArrayInc() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int var = fetchScriptWord();
|
|
|
|
int base = pop();
|
|
|
|
writeArray(var, 0, base, readArray(var, 0, base) + 1);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_byteVarDec() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int var = fetchScriptByte();
|
2002-04-11 17:19:16 +00:00
|
|
|
writeVar(var, readVar(var) - 1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_wordVarDec() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int var = fetchScriptWord();
|
2002-04-11 17:19:16 +00:00
|
|
|
writeVar(var, readVar(var) - 1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_byteArrayDec() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int var = fetchScriptByte();
|
|
|
|
int base = pop();
|
|
|
|
writeArray(var, 0, base, readArray(var, 0, base) - 1);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_wordArrayDec() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int var = fetchScriptWord();
|
|
|
|
int base = pop();
|
|
|
|
writeArray(var, 0, base, readArray(var, 0, base) - 1);
|
|
|
|
}
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
void ScummEngine_v6::o6_if() {
|
2001-10-16 10:01:48 +00:00
|
|
|
if (pop())
|
2001-10-23 19:51:50 +00:00
|
|
|
o6_jump();
|
2001-10-16 10:01:48 +00:00
|
|
|
else
|
|
|
|
fetchScriptWord();
|
|
|
|
}
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
void ScummEngine_v6::o6_ifNot() {
|
2001-10-16 10:01:48 +00:00
|
|
|
if (!pop())
|
2001-10-23 19:51:50 +00:00
|
|
|
o6_jump();
|
2001-10-16 10:01:48 +00:00
|
|
|
else
|
|
|
|
fetchScriptWord();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_jump() {
|
2003-11-11 13:47:53 +00:00
|
|
|
int offset = fetchScriptWordSigned();
|
|
|
|
_scriptPointer += offset;
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
void ScummEngine_v6::o6_startScript() {
|
2002-12-25 14:46:39 +00:00
|
|
|
int args[16];
|
2002-04-11 17:19:16 +00:00
|
|
|
int script, flags;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2003-05-18 21:03:57 +00:00
|
|
|
getStackList(args, ARRAYSIZE(args));
|
2001-10-16 10:01:48 +00:00
|
|
|
script = pop();
|
|
|
|
flags = pop();
|
2003-05-19 15:40:34 +00:00
|
|
|
runScript(script, (flags & 1) != 0, (flags & 2) != 0, args);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_jumpToScript() {
|
2002-12-25 14:46:39 +00:00
|
|
|
int args[16];
|
2002-04-11 17:19:16 +00:00
|
|
|
int script, flags;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2003-05-18 21:03:57 +00:00
|
|
|
getStackList(args, ARRAYSIZE(args));
|
2001-11-26 19:57:57 +00:00
|
|
|
script = pop();
|
|
|
|
flags = pop();
|
2002-12-26 23:24:57 +00:00
|
|
|
stopObjectCode();
|
2003-05-19 15:40:34 +00:00
|
|
|
runScript(script, (flags & 1) != 0, (flags & 2) != 0, args);
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
void ScummEngine_v6::o6_startScriptQuick() {
|
2002-12-25 14:46:39 +00:00
|
|
|
int args[16];
|
2001-10-16 10:01:48 +00:00
|
|
|
int script;
|
2003-05-18 21:03:57 +00:00
|
|
|
getStackList(args, ARRAYSIZE(args));
|
2001-10-16 10:01:48 +00:00
|
|
|
script = pop();
|
|
|
|
runScript(script, 0, 0, args);
|
|
|
|
}
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
void ScummEngine_v6::o6_startScriptQuick2() {
|
2002-12-26 23:24:57 +00:00
|
|
|
int args[16];
|
|
|
|
int script;
|
2003-05-18 21:03:57 +00:00
|
|
|
getStackList(args, ARRAYSIZE(args));
|
2002-12-26 23:24:57 +00:00
|
|
|
script = pop();
|
|
|
|
runScript(script, 0, 1, args);
|
|
|
|
}
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
void ScummEngine_v6::o6_startObject() {
|
2002-12-25 14:46:39 +00:00
|
|
|
int args[16];
|
2002-04-11 17:19:16 +00:00
|
|
|
int script, entryp;
|
2001-10-16 10:01:48 +00:00
|
|
|
int flags;
|
2003-05-18 21:03:57 +00:00
|
|
|
getStackList(args, ARRAYSIZE(args));
|
2001-10-16 10:01:48 +00:00
|
|
|
entryp = pop();
|
|
|
|
script = pop();
|
|
|
|
flags = pop();
|
2003-05-20 20:58:26 +00:00
|
|
|
runObjectScript(script, entryp, (flags & 1) != 0, (flags & 2) != 0, args);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_startObjectQuick() {
|
2002-12-26 23:24:57 +00:00
|
|
|
int args[16];
|
|
|
|
int script, entryp;
|
2003-05-18 21:03:57 +00:00
|
|
|
getStackList(args, ARRAYSIZE(args));
|
2002-12-26 23:24:57 +00:00
|
|
|
entryp = pop();
|
|
|
|
script = pop();
|
2003-05-20 20:58:26 +00:00
|
|
|
runObjectScript(script, entryp, 0, 1, args);
|
2002-12-26 23:24:57 +00:00
|
|
|
}
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
void ScummEngine_v6::o6_drawObject() {
|
2004-01-11 21:48:31 +00:00
|
|
|
int state = pop();
|
|
|
|
int obj = pop();
|
2003-11-09 22:12:16 +00:00
|
|
|
|
2004-01-11 21:48:31 +00:00
|
|
|
// FIXME: Why is the following here? Is it based on disassembly, or was
|
|
|
|
// it simply added to work around a bug (in ScummVM or scripts) ?
|
|
|
|
// In either case, the answer should be put into a comment (replacing this
|
|
|
|
// one, of course :-)
|
|
|
|
if (state == 0)
|
|
|
|
state = 1;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2004-01-11 21:48:31 +00:00
|
|
|
setObjectState(obj, state, -1, -1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
void ScummEngine_v6::o6_drawObjectAt() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int y = pop();
|
|
|
|
int x = pop();
|
2001-11-26 19:57:57 +00:00
|
|
|
int obj = pop();
|
|
|
|
setObjectState(obj, 1, x, y);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_stopObjectCode() {
|
2001-10-16 10:01:48 +00:00
|
|
|
stopObjectCode();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_endCutscene() {
|
2001-10-16 10:01:48 +00:00
|
|
|
endCutscene();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_cutscene() {
|
2002-12-25 14:46:39 +00:00
|
|
|
int args[16];
|
2003-05-18 21:03:57 +00:00
|
|
|
getStackList(args, ARRAYSIZE(args));
|
2003-05-20 20:58:26 +00:00
|
|
|
beginCutscene(args);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_stopMusic() {
|
2002-08-14 20:43:56 +00:00
|
|
|
_sound->stopAllSounds();
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_freezeUnfreeze() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int a = pop();
|
2003-11-09 22:12:16 +00:00
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
if (a)
|
|
|
|
freezeScripts(a);
|
|
|
|
else
|
|
|
|
unfreezeScripts();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_cursorCommand() {
|
2002-04-11 17:19:16 +00:00
|
|
|
int a, i;
|
2002-12-25 14:46:39 +00:00
|
|
|
int args[16];
|
2003-11-09 22:12:16 +00:00
|
|
|
int subOp = fetchScriptByte();
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
switch (subOp) {
|
|
|
|
case 0x90: // SO_CURSOR_ON Turn cursor on
|
2002-12-04 22:31:36 +00:00
|
|
|
_cursor.state = 1;
|
2001-10-16 10:01:48 +00:00
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0x91: // SO_CURSOR_OFF Turn cursor off
|
2002-12-04 22:31:36 +00:00
|
|
|
_cursor.state = 0;
|
2001-10-16 10:01:48 +00:00
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0x92: // SO_USERPUT_ON
|
2001-10-16 10:01:48 +00:00
|
|
|
_userPut = 1;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0x93: // SO_USERPUT_OFF
|
2001-10-16 10:01:48 +00:00
|
|
|
_userPut = 0;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0x94: // SO_CURSOR_SOFT_ON Turn soft cursor on
|
2002-12-04 22:31:36 +00:00
|
|
|
_cursor.state++;
|
|
|
|
if (_cursor.state > 1)
|
2001-10-16 10:01:48 +00:00
|
|
|
error("Cursor state greater than 1 in script");
|
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0x95: // SO_CURSOR_SOFT_OFF Turn soft cursor off
|
2002-12-04 22:31:36 +00:00
|
|
|
_cursor.state--;
|
2001-10-16 10:01:48 +00:00
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0x96: // SO_USERPUT_SOFT_ON
|
2001-10-16 10:01:48 +00:00
|
|
|
_userPut++;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0x97: // SO_USERPUT_SOFT_OFF
|
2001-10-16 10:01:48 +00:00
|
|
|
_userPut--;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0x99:{ // SO_CURSOR_IMAGE Set cursor image
|
2003-05-19 04:29:41 +00:00
|
|
|
if (_features & GF_AFTER_HEV7) {
|
|
|
|
warning("cursorCommand 0x99 PC_SetCursorToID(%d) stub", pop());
|
|
|
|
break;
|
|
|
|
}
|
2002-04-11 17:19:16 +00:00
|
|
|
int room, obj = popRoomAndObj(&room);
|
|
|
|
setCursorImg(obj, room, 1);
|
|
|
|
break;
|
|
|
|
}
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0x9A: // SO_CURSOR_HOTSPOT Set cursor hotspot
|
2001-10-16 10:01:48 +00:00
|
|
|
a = pop();
|
2003-04-26 13:28:34 +00:00
|
|
|
setCursorHotspot(pop(), a);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0x9C: // SO_CHARSET_SET
|
2001-10-16 10:01:48 +00:00
|
|
|
initCharset(pop());
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0x9D: // SO_CHARSET_COLOR
|
2003-05-18 21:03:57 +00:00
|
|
|
getStackList(args, ARRAYSIZE(args));
|
2002-04-11 17:19:16 +00:00
|
|
|
for (i = 0; i < 16; i++)
|
2002-12-26 00:21:19 +00:00
|
|
|
_charsetColorMap[i] = _charsetData[_string[1].t_charset][i] = (unsigned char)args[i];
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 0xD6: // SO_CURSOR_TRANSPARENT Set cursor transparent color
|
2001-11-06 20:00:47 +00:00
|
|
|
makeCursorColorTransparent(pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2001-11-26 19:57:57 +00:00
|
|
|
default:
|
2003-11-09 22:12:16 +00:00
|
|
|
error("o6_cursorCommand: default case %x", subOp);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-05-08 15:48:50 +00:00
|
|
|
VAR(VAR_CURSORSTATE) = _cursor.state;
|
|
|
|
VAR(VAR_USERPUT) = _userPut;
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_breakHere() {
|
2001-10-16 10:01:48 +00:00
|
|
|
updateScriptPtr();
|
|
|
|
_currentScript = 0xFF;
|
|
|
|
}
|
|
|
|
|
2003-11-10 08:00:55 +00:00
|
|
|
void ScummEngine_v6::o6_ifClassOfIs() {
|
2002-12-25 14:46:39 +00:00
|
|
|
int args[16];
|
2002-04-11 17:19:16 +00:00
|
|
|
int num, obj, cls;
|
2001-10-16 10:01:48 +00:00
|
|
|
bool b;
|
|
|
|
int cond = 1;
|
|
|
|
|
2003-05-18 21:03:57 +00:00
|
|
|
num = getStackList(args, ARRAYSIZE(args));
|
2001-10-16 10:01:48 +00:00
|
|
|
obj = pop();
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
while (--num >= 0) {
|
2001-10-16 10:01:48 +00:00
|
|
|
cls = args[num];
|
|
|
|
b = getClass(obj, cls);
|
2003-05-31 16:24:01 +00:00
|
|
|
if ((cls & 0x80 && !b) || (!(cls & 0x80) && b))
|
2001-10-16 10:01:48 +00:00
|
|
|
cond = 0;
|
|
|
|
}
|
|
|
|
push(cond);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_setClass() {
|
2002-12-25 14:46:39 +00:00
|
|
|
int args[16];
|
2002-04-11 17:19:16 +00:00
|
|
|
int num, obj, cls;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2003-05-18 21:03:57 +00:00
|
|
|
num = getStackList(args, ARRAYSIZE(args));
|
2001-10-16 10:01:48 +00:00
|
|
|
obj = pop();
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
while (--num >= 0) {
|
2001-10-16 10:01:48 +00:00
|
|
|
cls = args[num];
|
2002-04-11 17:19:16 +00:00
|
|
|
if (cls == 0)
|
2001-10-16 10:01:48 +00:00
|
|
|
_classData[num] = 0;
|
2002-04-11 17:19:16 +00:00
|
|
|
else if (cls & 0x80)
|
2001-10-16 10:01:48 +00:00
|
|
|
putClass(obj, cls, 1);
|
|
|
|
else
|
|
|
|
putClass(obj, cls, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getState() {
|
2001-10-16 10:01:48 +00:00
|
|
|
push(getState(pop()));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_setState() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int state = pop();
|
|
|
|
int obj = pop();
|
|
|
|
|
2003-04-22 00:09:07 +00:00
|
|
|
if ((_features & GF_HUMONGOUS) && (state & 0x8000)) {
|
|
|
|
state = state & 0x7F00;
|
|
|
|
putState(obj, state);
|
|
|
|
return;
|
|
|
|
}
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
putState(obj, state);
|
2004-01-11 20:42:40 +00:00
|
|
|
markObjectRectAsDirty(obj);
|
2001-10-16 10:01:48 +00:00
|
|
|
if (_BgNeedsRedraw)
|
|
|
|
clearDrawObjectQueue();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_setOwner() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int owner = pop();
|
|
|
|
int obj = pop();
|
|
|
|
|
2004-01-19 20:23:27 +00:00
|
|
|
if ((owner == 2) && (_gameId == GID_SAMNMAX)) {
|
|
|
|
// TODO / FIXME: This hack was added a long time ago, in revision 1.28
|
|
|
|
// of object.cpp in the old CVS module (see also here:
|
|
|
|
// http://cvs.sourceforge.net/viewcvs.py/scummvm/scummvm-old/object.cpp?r1=1.27&r2=1.28
|
|
|
|
// Commited by Endy with message:
|
|
|
|
// "Sam and Max inventory hack. Makes it work, but is nasty ;)"
|
|
|
|
//
|
|
|
|
// Sadly, it's not quite clear what exactly the hack fixes. In a quick
|
|
|
|
// test I didn't find any place where it is being used, but of course
|
|
|
|
// that means nothing.
|
|
|
|
//
|
|
|
|
// There aren't many places that invoke setOwner at all (in Sam and Max).
|
|
|
|
// I did a quick search of the script dumps I have here; in those I found
|
|
|
|
// seven calls to setOwner, and only one with owner == 2.
|
|
|
|
|
|
|
|
warning("Inside Sam and Max inventory hack! (obj %d)", obj);
|
|
|
|
for (int base = 6; base < 80; base++) {
|
|
|
|
int value = readArray(178, 0, base);
|
|
|
|
if (value == obj)
|
|
|
|
break;
|
|
|
|
if (value == 0) {
|
|
|
|
_scummVars[179]++;
|
|
|
|
writeArray(178, 0, base, obj);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
base++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
setOwnerOf(obj, owner);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getOwner() {
|
2001-10-16 10:01:48 +00:00
|
|
|
push(getOwner(pop()));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_startSound() {
|
2003-11-18 10:16:49 +00:00
|
|
|
if ((_features & GF_HUMONGOUS) && (_gameId != GID_PUTTDEMO))
|
2003-04-22 14:49:29 +00:00
|
|
|
pop(); // offset which seems to always be zero
|
2003-12-25 11:14:05 +00:00
|
|
|
|
|
|
|
if (_features & GF_DIGI_IMUSE)
|
2004-01-06 17:28:29 +00:00
|
|
|
_imuseDigital->startSfx(pop());
|
2003-12-25 11:14:05 +00:00
|
|
|
else
|
|
|
|
_sound->addSoundToQueue(pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_stopSound() {
|
2002-08-14 20:43:56 +00:00
|
|
|
_sound->stopSound(pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_startMusic() {
|
2003-12-25 11:14:05 +00:00
|
|
|
if (_features & GF_DIGI_IMUSE)
|
2004-01-06 17:28:29 +00:00
|
|
|
error("o6_startMusic() It shouldn't be called here for imuse digital");
|
2003-12-25 11:14:05 +00:00
|
|
|
else
|
|
|
|
_sound->addSoundToQueue(pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_stopObjectScript() {
|
2001-10-16 10:01:48 +00:00
|
|
|
stopObjectScript(pop());
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_panCameraTo() {
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version >= 7) {
|
2002-03-05 20:13:47 +00:00
|
|
|
int y = pop();
|
|
|
|
int x = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
panCameraTo(x, y);
|
2002-03-05 20:13:47 +00:00
|
|
|
} else {
|
|
|
|
panCameraTo(pop(), 0);
|
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_actorFollowCamera() {
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version >= 7)
|
2003-05-23 13:24:41 +00:00
|
|
|
setCameraFollows(derefActor(pop(), "actorFollowCamera"));
|
2002-03-06 00:18:22 +00:00
|
|
|
else
|
|
|
|
actorFollowCamera(pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_setCameraAt() {
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version >= 7) {
|
2002-04-11 17:19:16 +00:00
|
|
|
int x, y;
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2002-03-06 00:18:22 +00:00
|
|
|
camera._follows = 0;
|
2003-05-08 15:48:50 +00:00
|
|
|
VAR(VAR_CAMERA_FOLLOWED_ACTOR) = 0;
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2002-03-06 00:18:22 +00:00
|
|
|
y = pop();
|
|
|
|
x = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
|
|
|
|
setCameraAt(x, y);
|
2002-03-06 00:18:22 +00:00
|
|
|
} else {
|
|
|
|
setCameraAtEx(pop());
|
2002-04-11 17:19:16 +00:00
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_loadRoom() {
|
2002-12-23 15:46:53 +00:00
|
|
|
int room = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
startScene(room, 0, 0);
|
|
|
|
_fullRedraw = 1;
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_stopScript() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int script = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
if (script == 0)
|
2001-10-16 10:01:48 +00:00
|
|
|
stopObjectCode();
|
|
|
|
else
|
2003-05-20 20:58:26 +00:00
|
|
|
stopScript(script);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_walkActorToObj() {
|
2003-05-23 13:24:41 +00:00
|
|
|
int act, obj, dist;
|
2001-10-16 10:01:48 +00:00
|
|
|
Actor *a, *a2;
|
2003-06-11 21:45:47 +00:00
|
|
|
int x, y;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
|
|
|
dist = pop();
|
|
|
|
obj = pop();
|
2003-05-23 13:24:41 +00:00
|
|
|
act = pop();
|
|
|
|
a = derefActor(act, "o6_walkActorToObj");
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2003-05-13 23:42:41 +00:00
|
|
|
if (obj >= _numActors) {
|
2003-08-13 16:38:02 +00:00
|
|
|
int wio = whereIsObject(obj);
|
|
|
|
|
|
|
|
if (wio != WIO_FLOBJECT && wio != WIO_ROOM)
|
2001-10-16 10:01:48 +00:00
|
|
|
return;
|
2003-08-13 16:38:02 +00:00
|
|
|
|
2003-06-11 21:45:47 +00:00
|
|
|
int dir;
|
2002-07-16 18:51:27 +00:00
|
|
|
getObjectXYPos(obj, x, y, dir);
|
|
|
|
a->startWalkActor(x, y, dir);
|
2001-10-16 10:01:48 +00:00
|
|
|
} else {
|
2003-05-24 16:09:29 +00:00
|
|
|
a2 = derefActorSafe(obj, "o6_walkActorToObj(2)");
|
2003-05-26 22:37:36 +00:00
|
|
|
if (_gameId == GID_SAMNMAX && a2 == 0) {
|
2003-05-24 16:09:29 +00:00
|
|
|
// FIXME: This is a hack to work around bug #742676 SAM: Fish Farm.
|
2003-05-24 16:45:49 +00:00
|
|
|
// Note quite sure why it happens, though, if it's normal or due to
|
|
|
|
// a bug in the ScummVM code.
|
2003-06-12 20:35:13 +00:00
|
|
|
warning("o6_walkActorToObj: invalid actor %d", obj);
|
2003-05-24 16:09:29 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-08-04 13:03:33 +00:00
|
|
|
if (!a->isInCurrentRoom() || !a2->isInCurrentRoom())
|
2002-04-11 17:19:16 +00:00
|
|
|
return;
|
|
|
|
if (dist == 0) {
|
2001-10-16 10:01:48 +00:00
|
|
|
dist = a2->scalex * a2->width / 0xFF;
|
2003-06-11 21:45:47 +00:00
|
|
|
dist += dist / 2;
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
2003-09-14 18:16:45 +00:00
|
|
|
x = a2->_pos.x;
|
|
|
|
y = a2->_pos.y;
|
|
|
|
if (x < a->_pos.x)
|
2001-10-16 10:01:48 +00:00
|
|
|
x += dist;
|
|
|
|
else
|
|
|
|
x -= dist;
|
2003-06-11 21:45:47 +00:00
|
|
|
a->startWalkActor(x, y, -1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_walkActorTo() {
|
2002-04-11 17:19:16 +00:00
|
|
|
int x, y;
|
2001-10-16 10:01:48 +00:00
|
|
|
y = pop();
|
|
|
|
x = pop();
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(pop(), "o6_walkActorTo");
|
2002-12-30 02:06:18 +00:00
|
|
|
a->startWalkActor(x, y, -1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
void ScummEngine_v6::o6_putActorAtXY() {
|
2003-05-23 13:24:41 +00:00
|
|
|
int room, x, y, act;
|
2001-10-16 10:01:48 +00:00
|
|
|
Actor *a;
|
|
|
|
|
|
|
|
room = pop();
|
|
|
|
y = pop();
|
|
|
|
x = pop();
|
2003-05-23 13:24:41 +00:00
|
|
|
act = pop();
|
2003-11-09 22:12:16 +00:00
|
|
|
a = derefActor(act, "o6_putActorAtXY");
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2003-01-05 22:16:09 +00:00
|
|
|
if (room == 0xFF || room == 0x7FFFFFFF) {
|
2001-10-16 10:01:48 +00:00
|
|
|
room = a->room;
|
|
|
|
} else {
|
2004-01-16 10:45:56 +00:00
|
|
|
if (a->visible && _currentRoom != room && talkingActor() == a->number) {
|
2001-10-16 10:01:48 +00:00
|
|
|
clearMsgQueue();
|
|
|
|
}
|
|
|
|
if (room != 0)
|
|
|
|
a->room = room;
|
|
|
|
}
|
2002-07-18 15:45:10 +00:00
|
|
|
a->putActor(x, y, room);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_putActorAtObject() {
|
2002-07-16 21:03:14 +00:00
|
|
|
int room, obj, x, y;
|
2001-10-16 10:01:48 +00:00
|
|
|
Actor *a;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
obj = popRoomAndObj(&room);
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(pop(), "o6_putActorAtObject");
|
2002-04-11 17:19:16 +00:00
|
|
|
if (whereIsObject(obj) != WIO_NOT_FOUND) {
|
2002-07-16 18:51:27 +00:00
|
|
|
getObjectXYPos(obj, x, y);
|
2001-10-16 10:01:48 +00:00
|
|
|
} else {
|
2003-04-01 20:56:27 +00:00
|
|
|
x = 160;
|
2001-10-16 10:01:48 +00:00
|
|
|
y = 120;
|
|
|
|
}
|
|
|
|
if (room == 0xFF)
|
|
|
|
room = a->room;
|
2002-07-18 15:45:10 +00:00
|
|
|
a->putActor(x, y, room);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_faceActor() {
|
2003-01-01 18:22:41 +00:00
|
|
|
int obj = pop();
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(pop(), "o6_faceActor");
|
2003-04-20 17:11:13 +00:00
|
|
|
a->faceToObject(obj);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_animateActor() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int anim = pop();
|
2003-05-26 01:01:47 +00:00
|
|
|
int act = pop();
|
|
|
|
if (_gameId == GID_TENTACLE && _roomResource == 57 &&
|
|
|
|
vm.slot[_currentScript].number == 19 && act == 593) {
|
|
|
|
// FIXME: This very odd case (animateActor(593,250)) occurs in DOTT, in the
|
|
|
|
// cutscene after George cuts down the "cherry tree" and the tree Laverne
|
|
|
|
// is trapped in vanishes... see bug #743363.
|
|
|
|
// Not sure if this means animateActor somehow also must work for objects
|
|
|
|
// (593 is the time machine in room 57), or if this is simply a script bug.
|
|
|
|
act = 6;
|
|
|
|
}
|
|
|
|
Actor *a = derefActor(act, "o6_animateActor");
|
2002-08-04 02:53:50 +00:00
|
|
|
a->animateActor(anim);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_doSentence() {
|
2003-05-24 16:09:29 +00:00
|
|
|
int verb, objectA, objectB, dummy = 0;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2003-05-24 16:09:29 +00:00
|
|
|
objectB = pop();
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version < 8)
|
2003-05-24 16:45:49 +00:00
|
|
|
dummy = pop(); // dummy pop (in Sam&Max, seems to be always 0 or 130)
|
2003-05-24 16:09:29 +00:00
|
|
|
objectA = pop();
|
|
|
|
verb = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2003-05-24 16:09:29 +00:00
|
|
|
doSentence(verb, objectA, objectB);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_pickupObject() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int obj, room;
|
2001-11-26 19:57:57 +00:00
|
|
|
int i;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
obj = popRoomAndObj(&room);
|
|
|
|
if (room == 0)
|
2001-12-27 17:51:58 +00:00
|
|
|
room = _roomResource;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2003-12-26 23:11:35 +00:00
|
|
|
for (i = 0; i < _numInventory; i++) {
|
2001-11-26 19:57:57 +00:00
|
|
|
if (_inventory[i] == (uint16)obj) {
|
2003-05-08 15:48:50 +00:00
|
|
|
putOwner(obj, VAR(VAR_EGO));
|
2003-06-14 12:23:30 +00:00
|
|
|
runInventoryScript(obj);
|
2001-11-26 19:57:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
addObjectToInventory(obj, room);
|
2003-05-08 15:48:50 +00:00
|
|
|
putOwner(obj, VAR(VAR_EGO));
|
2003-05-20 20:42:28 +00:00
|
|
|
putClass(obj, kObjectClassUntouchable, 1);
|
2001-10-16 10:01:48 +00:00
|
|
|
putState(obj, 1);
|
2004-01-11 20:42:40 +00:00
|
|
|
markObjectRectAsDirty(obj);
|
2001-10-16 10:01:48 +00:00
|
|
|
clearDrawObjectQueue();
|
2003-06-14 12:23:30 +00:00
|
|
|
runInventoryScript(obj); /* Difference */
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_loadRoomWithEgo() {
|
2001-10-16 10:01:48 +00:00
|
|
|
Actor *a;
|
2002-08-15 20:12:15 +00:00
|
|
|
int obj, room, x, y;
|
2002-04-07 04:29:15 +00:00
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
y = pop();
|
|
|
|
x = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
|
|
|
|
obj = popRoomAndObj(&room);
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(VAR(VAR_EGO), "o6_loadRoomWithEgo");
|
2002-07-18 15:45:10 +00:00
|
|
|
a->putActor(0, 0, room);
|
2001-10-26 17:34:50 +00:00
|
|
|
_egoPositioned = false;
|
|
|
|
|
2003-05-14 10:14:05 +00:00
|
|
|
if (VAR_WALKTO_OBJ != 0xFF)
|
|
|
|
VAR(VAR_WALKTO_OBJ) = obj;
|
2001-10-16 10:01:48 +00:00
|
|
|
startScene(a->room, a, obj);
|
2003-05-14 10:14:05 +00:00
|
|
|
if (VAR_WALKTO_OBJ != 0xFF)
|
|
|
|
VAR(VAR_WALKTO_OBJ) = 0;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version == 6) {
|
2003-09-14 18:16:45 +00:00
|
|
|
setCameraAt(a->_pos.x, a->_pos.y);
|
2002-03-06 00:18:22 +00:00
|
|
|
setCameraFollows(a);
|
|
|
|
}
|
2002-08-15 20:12:15 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
_fullRedraw = 1;
|
2002-08-15 20:12:15 +00:00
|
|
|
|
2003-09-09 19:30:25 +00:00
|
|
|
if (x != -1 && x != 0x7FFFFFFF) {
|
2002-05-14 19:11:20 +00:00
|
|
|
a->startWalkActor(x, y, -1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getRandomNumber() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int rnd;
|
2002-12-01 14:57:50 +00:00
|
|
|
rnd = _rnd.getRandomNumber(pop());
|
2004-01-19 19:47:47 +00:00
|
|
|
if (VAR_RANDOM_NR != 0xFF)
|
|
|
|
VAR(VAR_RANDOM_NR) = rnd;
|
2001-10-16 10:01:48 +00:00
|
|
|
push(rnd);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getRandomNumberRange() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int max = pop();
|
|
|
|
int min = pop();
|
2002-12-01 14:57:50 +00:00
|
|
|
int rnd = _rnd.getRandomNumberRng(min, max);
|
2004-01-19 19:47:47 +00:00
|
|
|
if (VAR_RANDOM_NR != 0xFF)
|
|
|
|
VAR(VAR_RANDOM_NR) = rnd;
|
2001-10-16 10:01:48 +00:00
|
|
|
push(rnd);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_isScriptRunning() {
|
2001-11-26 19:57:57 +00:00
|
|
|
push(isScriptRunning(pop()));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_isRoomScriptRunning() {
|
2001-11-26 19:57:57 +00:00
|
|
|
push(isRoomScriptRunning(pop()));
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getActorMoving() {
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(pop(), "o6_getActorMoving");
|
|
|
|
push(a->moving);
|
2002-12-30 02:06:18 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getActorRoom() {
|
2003-05-23 13:24:41 +00:00
|
|
|
int act = pop();
|
2003-05-23 13:42:12 +00:00
|
|
|
|
|
|
|
if (act == 0) {
|
|
|
|
// This case occurs at the very least in COMI. That's because in COMI's script 28,
|
|
|
|
// there is a check which looks as follows:
|
|
|
|
// if (((VAR_TALK_ACTOR != 0) && (VAR_HAVE_MSG == 1)) &&
|
|
|
|
// (getActorRoom(VAR_TALK_ACTOR) == VAR_ROOM))
|
|
|
|
// Due to the way this is represented in bytecode, the engine cannot
|
2004-01-15 20:37:26 +00:00
|
|
|
// short circuit. Hence, even though this would be perfectly fine code
|
2003-05-23 13:42:12 +00:00
|
|
|
// in C/C++, here it can (and does) lead to getActorRoom(0) being
|
|
|
|
// invoked. We silently ignore this.
|
2002-12-24 00:41:59 +00:00
|
|
|
push(0);
|
2003-05-23 13:24:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2003-05-24 23:08:03 +00:00
|
|
|
if (act == 255) {
|
|
|
|
// This case also occurs in COMI...
|
|
|
|
push(0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2003-05-23 13:42:12 +00:00
|
|
|
Actor *a = derefActor(act, "o6_getActorRoom");
|
2003-05-23 13:24:41 +00:00
|
|
|
push(a->room);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getActorWalkBox() {
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(pop(), "o6_getActorWalkBox");
|
2002-12-30 02:06:18 +00:00
|
|
|
push(a->ignoreBoxes ? 0 : a->walkbox);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getActorCostume() {
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(pop(), "o6_getActorCostume");
|
2002-12-30 02:06:18 +00:00
|
|
|
push(a->costume);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getActorElevation() {
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(pop(), "o6_getActorElevation");
|
2004-01-05 16:19:14 +00:00
|
|
|
push(a->getElevation());
|
2002-12-30 02:06:18 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getActorWidth() {
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(pop(), "o6_getActorWidth");
|
2002-12-30 02:06:18 +00:00
|
|
|
push(a->width);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getActorScaleX() {
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(pop(), "o6_getActorScale");
|
2003-01-16 14:42:20 +00:00
|
|
|
push(a->scalex);
|
2002-12-30 02:06:18 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getActorAnimCounter1() {
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(pop(), "o6_getActorAnimCounter");
|
2003-06-01 18:20:38 +00:00
|
|
|
push(a->cost.animCounter);
|
2002-12-30 02:06:18 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getAnimateVariable() {
|
2002-12-30 02:06:18 +00:00
|
|
|
int var = pop();
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(pop(), "o6_getAnimateVariable");
|
2003-01-16 14:42:20 +00:00
|
|
|
push(a->getAnimVar(var));
|
2002-12-30 02:06:18 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_isActorInBox() {
|
2002-12-30 02:06:18 +00:00
|
|
|
int box = pop();
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(pop(), "o6_isActorInBox");
|
2003-09-14 18:16:45 +00:00
|
|
|
push(checkXYInBoxBounds(box, a->_pos.x, a->_pos.y));
|
2002-12-30 02:06:18 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getActorLayer() {
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(pop(), "getActorLayer");
|
2002-12-30 02:06:18 +00:00
|
|
|
push(a->layer);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getObjectX() {
|
2001-10-16 10:01:48 +00:00
|
|
|
push(getObjX(pop()));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getObjectY() {
|
2001-10-16 10:01:48 +00:00
|
|
|
push(getObjY(pop()));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getObjectOldDir() {
|
2001-12-27 17:51:58 +00:00
|
|
|
push(getObjOldDir(pop()));
|
|
|
|
}
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getObjectNewDir() {
|
2001-12-27 17:51:58 +00:00
|
|
|
push(getObjNewDir(pop()));
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_findInventory() {
|
2002-03-08 08:42:11 +00:00
|
|
|
int idx = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
int owner = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(findInventory(owner, idx));
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getInventoryCount() {
|
2001-10-16 10:01:48 +00:00
|
|
|
push(getInventoryCount(pop()));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getVerbFromXY() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int y = pop();
|
|
|
|
int x = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
int over = checkMouseOver(x, y);
|
2001-10-16 10:01:48 +00:00
|
|
|
if (over)
|
|
|
|
over = _verbs[over].verbid;
|
|
|
|
push(over);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_beginOverride() {
|
2001-10-16 10:01:48 +00:00
|
|
|
beginOverride();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_endOverride() {
|
2001-10-16 10:01:48 +00:00
|
|
|
endOverride();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_setObjectName() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int obj = pop();
|
|
|
|
int i;
|
|
|
|
|
2003-05-13 23:42:41 +00:00
|
|
|
if (obj < _numActors)
|
2001-10-16 10:01:48 +00:00
|
|
|
error("Can't set actor %d name with new-name-of", obj);
|
|
|
|
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version < 7 && !getOBCDFromObject(obj))
|
2001-10-16 10:01:48 +00:00
|
|
|
error("Can't set name of object %d", obj);
|
|
|
|
|
2003-05-28 19:55:05 +00:00
|
|
|
for (i = 0; i < _numNewNames; i++) {
|
2001-10-16 10:01:48 +00:00
|
|
|
if (_newNames[i] == obj) {
|
2001-11-05 19:21:49 +00:00
|
|
|
nukeResource(rtObjectName, i);
|
2001-10-16 10:01:48 +00:00
|
|
|
_newNames[i] = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-05-28 19:55:05 +00:00
|
|
|
for (i = 0; i < _numNewNames; i++) {
|
2001-10-16 10:01:48 +00:00
|
|
|
if (_newNames[i] == 0) {
|
2001-11-05 19:21:49 +00:00
|
|
|
loadPtrToResource(rtObjectName, i, NULL);
|
2001-10-16 10:01:48 +00:00
|
|
|
_newNames[i] = obj;
|
2003-06-14 12:23:30 +00:00
|
|
|
runInventoryScript(0);
|
2001-10-16 10:01:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-12-26 23:49:46 +00:00
|
|
|
error("New name of %d overflows name table (max = %d)", obj, _numNewNames);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_isSoundRunning() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int snd = pop();
|
2002-05-10 18:47:37 +00:00
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
if (snd)
|
2002-08-14 20:43:56 +00:00
|
|
|
snd = _sound->isSoundRunning(snd);
|
2002-07-07 13:14:34 +00:00
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
push(snd);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_setBoxFlags() {
|
2002-12-25 14:46:39 +00:00
|
|
|
int table[65];
|
2002-04-11 17:19:16 +00:00
|
|
|
int num, value;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
|
|
|
value = pop();
|
2003-05-18 21:03:57 +00:00
|
|
|
num = getStackList(table, ARRAYSIZE(table));
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
while (--num >= 0) {
|
2001-10-16 10:01:48 +00:00
|
|
|
setBoxFlags(table[num], value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_createBoxMatrix() {
|
2001-10-16 10:01:48 +00:00
|
|
|
createBoxMatrix();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_resourceRoutines() {
|
2003-05-19 04:29:41 +00:00
|
|
|
int resid, op;
|
|
|
|
op = fetchScriptByte();
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2003-05-19 04:29:41 +00:00
|
|
|
switch (op) {
|
2003-11-09 22:12:16 +00:00
|
|
|
case 100: // SO_LOAD_SCRIPT
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version >= 7)
|
2002-03-08 08:42:11 +00:00
|
|
|
if (resid >= _numGlobalScripts)
|
2002-03-06 00:18:22 +00:00
|
|
|
break;
|
2002-03-08 08:42:11 +00:00
|
|
|
ensureResourceLoaded(rtScript, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 101: // SO_LOAD_SOUND
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
ensureResourceLoaded(rtSound, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 102: // SO_LOAD_COSTUME
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
ensureResourceLoaded(rtCostume, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 103: // SO_LOAD_ROOM
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
ensureResourceLoaded(rtRoom, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 104: // SO_NUKE_SCRIPT
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version >= 7)
|
2002-03-08 08:42:11 +00:00
|
|
|
if (resid >= _numGlobalScripts)
|
2002-03-06 00:18:22 +00:00
|
|
|
break;
|
2002-03-08 08:42:11 +00:00
|
|
|
setResourceCounter(rtScript, resid, 0x7F);
|
|
|
|
debug(5, "nuke script %d", resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 105: // SO_NUKE_SOUND
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
setResourceCounter(rtSound, resid, 0x7F);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 106: // SO_NUKE_COSTUME
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
setResourceCounter(rtCostume, resid, 0x7F);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 107: // SO_NUKE_ROOM
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
setResourceCounter(rtRoom, resid, 0x7F);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 108: // SO_LOCK_SCRIPT
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
if (resid >= _numGlobalScripts)
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
lock(rtScript, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 109: // SO_LOCK_SOUND
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
lock(rtSound, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 110: // SO_LOCK_COSTUME
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
lock(rtCostume, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 111: // SO_LOCK_ROOM
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
if (resid > 0x7F)
|
2002-04-11 17:19:16 +00:00
|
|
|
resid = _resourceMapper[resid & 0x7F];
|
|
|
|
lock(rtRoom, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 112: // SO_UNLOCK_SCRIPT
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
if (resid >= _numGlobalScripts)
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
unlock(rtScript, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 113: // SO_UNLOCK_SOUND
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
unlock(rtSound, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 114: // SO_UNLOCK_COSTUME
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
unlock(rtCostume, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 115: // SO_UNLOCK_ROOM
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
if (resid > 0x7F)
|
2002-04-11 17:19:16 +00:00
|
|
|
resid = _resourceMapper[resid & 0x7F];
|
|
|
|
unlock(rtRoom, resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 116: // SO_CLEAR_HEAP
|
2001-10-16 10:01:48 +00:00
|
|
|
/* this is actually a scumm message */
|
|
|
|
error("clear heap not working yet");
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 117: // SO_LOAD_CHARSET
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
loadCharset(resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 118: // SO_NUKE_CHARSET
|
2002-03-08 08:42:11 +00:00
|
|
|
resid = pop();
|
|
|
|
nukeCharset(resid);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 119: // SO_LOAD_OBJECT
|
|
|
|
{
|
2002-04-11 17:19:16 +00:00
|
|
|
int room, obj = popRoomAndObj(&room);
|
|
|
|
loadFlObject(obj, room);
|
|
|
|
break;
|
|
|
|
}
|
2003-09-03 08:55:24 +00:00
|
|
|
case 120:{ /* queue ? for load */
|
|
|
|
warning("stub queueload resource %d", pop());
|
|
|
|
// QL_QueGlobForLoad(2, pop(), 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
default:
|
2003-05-19 04:29:41 +00:00
|
|
|
error("o6_resourceRoutines: default case %d", op);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-09-03 08:55:24 +00:00
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_roomOps() {
|
2002-04-11 17:19:16 +00:00
|
|
|
int a, b, c, d, e;
|
2003-04-20 15:02:58 +00:00
|
|
|
byte op;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2003-04-20 15:02:58 +00:00
|
|
|
op = fetchScriptByte();
|
|
|
|
|
|
|
|
switch (op) {
|
2003-11-09 22:12:16 +00:00
|
|
|
case 172: // SO_ROOM_SCROLL
|
2001-10-16 10:01:48 +00:00
|
|
|
b = pop();
|
|
|
|
a = pop();
|
2003-05-10 21:49:59 +00:00
|
|
|
if (a < (_screenWidth / 2))
|
|
|
|
a = (_screenWidth / 2);
|
|
|
|
if (b < (_screenWidth / 2))
|
|
|
|
b = (_screenWidth / 2);
|
|
|
|
if (a > _roomWidth - (_screenWidth / 2))
|
|
|
|
a = _roomWidth - (_screenWidth / 2);
|
|
|
|
if (b > _roomWidth - (_screenWidth / 2))
|
|
|
|
b = _roomWidth - (_screenWidth / 2);
|
2003-05-08 15:48:50 +00:00
|
|
|
VAR(VAR_CAMERA_MIN_X) = a;
|
|
|
|
VAR(VAR_CAMERA_MAX_X) = b;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
case 174: // SO_ROOM_SCREEN
|
2001-10-16 10:01:48 +00:00
|
|
|
b = pop();
|
|
|
|
a = pop();
|
2004-01-04 14:49:14 +00:00
|
|
|
initScreens(a, b);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
case 175: // SO_ROOM_PALETTE
|
2001-10-16 10:01:48 +00:00
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
setPalColor(d, a, b, c);
|
|
|
|
break;
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
case 176: // SO_ROOM_SHAKE_ON
|
2001-10-16 10:01:48 +00:00
|
|
|
setShake(1);
|
|
|
|
break;
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
case 177: // SO_ROOM_SHAKE_OFF
|
2001-10-16 10:01:48 +00:00
|
|
|
setShake(0);
|
|
|
|
break;
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
case 179: // SO_ROOM_INTENSITY
|
2001-10-16 10:01:48 +00:00
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
2002-12-09 02:14:17 +00:00
|
|
|
darkenPalette(a, a, a, b, c);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
case 180: // SO_ROOM_SAVEGAME
|
2004-01-31 22:12:35 +00:00
|
|
|
_saveTemporaryState = true;
|
2001-10-26 17:34:50 +00:00
|
|
|
_saveLoadSlot = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
_saveLoadFlag = pop();
|
2004-01-30 16:01:08 +00:00
|
|
|
if (_gameId == GID_TENTACLE)
|
|
|
|
_saveSound = (_saveLoadSlot != 0);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
case 181: // SO_ROOM_FADE
|
2001-10-16 10:01:48 +00:00
|
|
|
a = pop();
|
|
|
|
if (a) {
|
2003-11-16 20:52:57 +00:00
|
|
|
_switchRoomEffect = (byte)(a & 0xFF);
|
2002-04-11 17:19:16 +00:00
|
|
|
_switchRoomEffect2 = (byte)(a >> 8);
|
2001-10-16 10:01:48 +00:00
|
|
|
} else {
|
2002-07-13 14:07:37 +00:00
|
|
|
fadeIn(_newEffect);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
case 182: // SO_RGB_ROOM_INTENSITY
|
2001-10-16 10:01:48 +00:00
|
|
|
e = pop();
|
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
2002-12-09 02:14:17 +00:00
|
|
|
darkenPalette(a, b, c, d, e);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
case 183: // SO_ROOM_SHADOW
|
2001-10-16 10:01:48 +00:00
|
|
|
e = pop();
|
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
2002-12-09 02:14:17 +00:00
|
|
|
setupShadowPalette(a, b, c, d, e);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
case 184: // SO_SAVE_STRING
|
2001-10-16 10:01:48 +00:00
|
|
|
error("save string not implemented");
|
|
|
|
break;
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
case 185: // SO_LOAD_STRING
|
2001-10-16 10:01:48 +00:00
|
|
|
error("load string not implemented");
|
|
|
|
break;
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
case 186: // SO_ROOM_TRANSFORM
|
2001-10-16 10:01:48 +00:00
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
2002-09-13 11:54:59 +00:00
|
|
|
palManipulateInit(a, b, c, d);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
case 187: // SO_CYCLE_SPEED
|
2001-10-16 10:01:48 +00:00
|
|
|
b = pop();
|
|
|
|
a = pop();
|
2001-10-26 17:34:50 +00:00
|
|
|
checkRange(16, 1, a, "o6_roomOps: 187: color cycle out of range (%d)");
|
2002-04-11 17:19:16 +00:00
|
|
|
_colorCycle[a - 1].delay = (b != 0) ? 0x4000 / (b * 0x4C) : 0;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
|
2003-11-09 22:12:16 +00:00
|
|
|
case 213: // SO_ROOM_NEW_PALETTE
|
2002-12-11 20:48:32 +00:00
|
|
|
a = pop();
|
|
|
|
|
|
|
|
// This opcode is used when turning off noir mode in Sam & Max,
|
|
|
|
// but since our implementation of this feature doesn't change
|
|
|
|
// the original palette there's no need to reload it. Doing it
|
|
|
|
// this way, we avoid some graphics glitches that the original
|
|
|
|
// interpreter had.
|
|
|
|
|
|
|
|
if (_gameId == GID_SAMNMAX && vm.slot[_currentScript].number == 64)
|
|
|
|
setDirtyColors(0, 255);
|
|
|
|
else
|
|
|
|
setPalette(a);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2004-01-12 15:52:58 +00:00
|
|
|
case 220:
|
2004-01-02 13:21:13 +00:00
|
|
|
a = pop();
|
|
|
|
b = pop();
|
2004-01-02 13:30:03 +00:00
|
|
|
warning("o6_roomops:220 (%d, %d): unimplemented", a, b);
|
2004-01-02 13:21:13 +00:00
|
|
|
break;
|
2004-01-12 15:52:58 +00:00
|
|
|
case 221:
|
2003-12-28 05:52:52 +00:00
|
|
|
int len;
|
|
|
|
len = resStrLen(_scriptPointer);
|
|
|
|
_scriptPointer += len + 1;
|
|
|
|
_saveLoadFlag = pop();
|
|
|
|
_saveLoadSlot = 99;
|
2004-01-31 22:12:35 +00:00
|
|
|
_saveTemporaryState = true;
|
2003-12-28 05:52:52 +00:00
|
|
|
break;
|
2001-10-16 10:01:48 +00:00
|
|
|
default:
|
2003-04-20 15:02:58 +00:00
|
|
|
error("o6_roomOps: default case %d", op);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_actorOps() {
|
2001-10-16 10:01:48 +00:00
|
|
|
Actor *a;
|
2002-04-11 17:19:16 +00:00
|
|
|
int i, j, k;
|
2002-12-25 14:46:39 +00:00
|
|
|
int args[8];
|
2001-10-16 10:01:48 +00:00
|
|
|
byte b;
|
|
|
|
|
|
|
|
b = fetchScriptByte();
|
2002-04-11 17:19:16 +00:00
|
|
|
if (b == 197) {
|
2001-10-16 10:01:48 +00:00
|
|
|
_curActor = pop();
|
|
|
|
return;
|
|
|
|
}
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-12-23 15:46:53 +00:00
|
|
|
a = derefActorSafe(_curActor, "o6_actorOps");
|
2002-04-11 17:19:16 +00:00
|
|
|
if (!a)
|
|
|
|
return;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
switch (b) {
|
2003-11-09 22:12:16 +00:00
|
|
|
case 76: // SO_COSTUME
|
2002-05-14 19:11:20 +00:00
|
|
|
a->setActorCostume(pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 77: // SO_STEP_DIST
|
2001-10-16 10:01:48 +00:00
|
|
|
j = pop();
|
|
|
|
i = pop();
|
2002-05-14 19:11:20 +00:00
|
|
|
a->setActorWalkSpeed(i, j);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 78: // SO_SOUND
|
2003-05-18 21:03:57 +00:00
|
|
|
k = getStackList(args, ARRAYSIZE(args));
|
2002-04-11 17:19:16 +00:00
|
|
|
for (i = 0; i < k; i++)
|
2001-10-16 10:01:48 +00:00
|
|
|
a->sound[i] = args[i];
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 79: // SO_WALK_ANIMATION
|
2001-10-16 10:01:48 +00:00
|
|
|
a->walkFrame = pop();
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 80: // SO_TALK_ANIMATION
|
2003-05-22 09:58:33 +00:00
|
|
|
a->talkStopFrame = pop();
|
|
|
|
a->talkStartFrame = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 81: // SO_STAND_ANIMATION
|
2001-10-16 10:01:48 +00:00
|
|
|
a->standFrame = pop();
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 82: // SO_ANIMATION
|
2004-02-06 16:19:43 +00:00
|
|
|
// dummy case in scumm6
|
2001-10-16 10:01:48 +00:00
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 83: // SO_DEFAULT
|
2002-05-14 19:11:20 +00:00
|
|
|
a->initActor(0);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 84: // SO_ELEVATION
|
2004-01-05 16:19:14 +00:00
|
|
|
a->setElevation(pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 85: // SO_ANIMATION_DEFAULT
|
2001-10-16 10:01:48 +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;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 86: // SO_PALETTE
|
2001-10-16 10:01:48 +00:00
|
|
|
j = pop();
|
|
|
|
i = pop();
|
2003-03-02 13:44:08 +00:00
|
|
|
checkRange(255, 0, i, "Illegal palette slot %d");
|
2004-01-22 04:46:34 +00:00
|
|
|
if ((_features & GF_HUMONGOUS) && (_gameId != GID_PUTTDEMO))
|
2004-01-16 01:52:49 +00:00
|
|
|
a->remapActorPaletteColor(i, j);
|
|
|
|
else
|
|
|
|
a->setPalette(i, j);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 87: // SO_TALK_COLOR
|
2001-10-16 10:01:48 +00:00
|
|
|
a->talkColor = pop();
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 88: // SO_ACTOR_NAME
|
2001-11-14 20:09:39 +00:00
|
|
|
loadPtrToResource(rtActorName, a->number, NULL);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 89: // SO_INIT_ANIMATION
|
2001-10-16 10:01:48 +00:00
|
|
|
a->initFrame = pop();
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 91: // SO_ACTOR_WIDTH
|
2001-10-16 10:01:48 +00:00
|
|
|
a->width = pop();
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 92: // SO_SCALE
|
2004-01-05 16:30:00 +00:00
|
|
|
i = pop();
|
|
|
|
a->setScale(i, i);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 93: // SO_NEVER_ZCLIP
|
2001-11-27 17:56:04 +00:00
|
|
|
a->forceClip = 0;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2004-01-07 05:51:56 +00:00
|
|
|
case 225: // SO_ALWAYS_ZCLIP
|
2003-11-09 22:12:16 +00:00
|
|
|
case 94: // SO_ALWAYS_ZCLIP
|
2001-11-27 17:56:04 +00:00
|
|
|
a->forceClip = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 95: // SO_IGNORE_BOXES
|
2001-10-16 10:01:48 +00:00
|
|
|
a->ignoreBoxes = 1;
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version >= 7)
|
2002-05-22 12:56:26 +00:00
|
|
|
a->forceClip = 100;
|
|
|
|
else
|
|
|
|
a->forceClip = 0;
|
2002-06-04 23:32:53 +00:00
|
|
|
if (a->isInCurrentRoom())
|
2003-09-14 18:16:45 +00:00
|
|
|
a->putActor(a->_pos.x, a->_pos.y, a->room);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 96: // SO_FOLLOW_BOXES
|
2001-10-16 10:01:48 +00:00
|
|
|
a->ignoreBoxes = 0;
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version >= 7)
|
2002-05-22 12:56:26 +00:00
|
|
|
a->forceClip = 100;
|
|
|
|
else
|
|
|
|
a->forceClip = 0;
|
2003-05-20 23:05:34 +00:00
|
|
|
if (a->isInCurrentRoom())
|
2003-09-14 18:16:45 +00:00
|
|
|
a->putActor(a->_pos.x, a->_pos.y, a->room);
|
2003-05-20 23:05:34 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 97: // SO_ANIMATION_SPEED
|
2003-07-24 17:44:00 +00:00
|
|
|
a->setAnimSpeed(pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 98: // SO_SHADOW
|
2001-12-27 17:51:58 +00:00
|
|
|
a->shadow_mode = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 99: // SO_TEXT_OFFSET
|
2002-12-23 14:16:43 +00:00
|
|
|
a->talkPosY = pop();
|
2003-05-12 22:08:39 +00:00
|
|
|
a->talkPosX = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 198: // SO_ACTOR_VARIABLE
|
|
|
|
i = pop();
|
2002-05-23 00:37:00 +00:00
|
|
|
a->setAnimVar(pop(), i);
|
2001-12-27 17:51:58 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 215: // SO_ACTOR_IGNORE_TURNS_ON
|
2002-12-23 14:16:43 +00:00
|
|
|
a->ignoreTurns = true;
|
2002-04-11 17:19:16 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 216: // SO_ACTOR_IGNORE_TURNS_OFF
|
2002-12-23 14:16:43 +00:00
|
|
|
a->ignoreTurns = false;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 217: // SO_ACTOR_NEW
|
2002-05-14 19:11:20 +00:00
|
|
|
a->initActor(2);
|
2001-11-26 19:57:57 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 218:
|
2003-07-06 23:19:03 +00:00
|
|
|
{
|
|
|
|
// TODO: this opcode is used in the putt-putt fun pack, in 'checkers" mini game
|
2004-01-05 14:39:44 +00:00
|
|
|
warning("o6_actorOps():218 partially unimplemented");
|
2003-07-06 23:19:03 +00:00
|
|
|
|
|
|
|
int top_actor = a->top;
|
|
|
|
int bottom_actor = a->bottom;
|
2004-01-12 14:09:39 +00:00
|
|
|
a->forceClip = 1;
|
2003-12-17 17:36:04 +00:00
|
|
|
a->needRedraw = true;
|
2003-07-06 23:19:03 +00:00
|
|
|
a->drawActorCostume();
|
2004-01-12 14:09:39 +00:00
|
|
|
a->forceClip = 0;
|
2003-12-17 17:36:04 +00:00
|
|
|
a->needRedraw = true;
|
2003-07-06 23:19:03 +00:00
|
|
|
a->drawActorCostume();
|
2003-12-17 17:36:04 +00:00
|
|
|
a->needRedraw = false;
|
2003-07-06 23:19:03 +00:00
|
|
|
|
2004-01-22 02:37:41 +00:00
|
|
|
if (a->top > top_actor)
|
|
|
|
a->top = top_actor;
|
|
|
|
if (a->bottom < bottom_actor)
|
2003-07-06 23:19:03 +00:00
|
|
|
a->bottom = bottom_actor;
|
2004-01-22 02:37:41 +00:00
|
|
|
|
|
|
|
//FIXME Trigger redraw
|
|
|
|
a->bottom = top_actor;
|
2003-07-06 23:19:03 +00:00
|
|
|
}
|
2003-07-06 16:14:35 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 227: // SO_ACTOR_DEPTH
|
2001-12-27 17:51:58 +00:00
|
|
|
a->layer = pop();
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 228: // SO_ACTOR_WALK_SCRIPT
|
2003-05-31 14:27:47 +00:00
|
|
|
a->walkScript = pop();
|
2001-12-27 17:51:58 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 229: // SO_ACTOR_STOP
|
2002-05-14 19:11:20 +00:00
|
|
|
a->stopActorMoving();
|
2001-12-27 17:51:58 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 230: /* set direction */
|
2002-06-04 23:32:53 +00:00
|
|
|
a->moving &= ~MF_TURN;
|
2002-07-18 15:45:10 +00:00
|
|
|
a->setDirection(pop());
|
2001-12-27 17:51:58 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 231: /* turn to direction */
|
2002-05-14 19:11:20 +00:00
|
|
|
a->turnToDirection(pop());
|
2001-12-27 17:51:58 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 233: // SO_ACTOR_WALK_PAUSE
|
2003-03-08 02:06:56 +00:00
|
|
|
a->moving |= MF_FROZEN;
|
2001-12-27 17:51:58 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 234: // SO_ACTOR_WALK_RESUME
|
2003-03-08 02:06:56 +00:00
|
|
|
a->moving &= ~MF_FROZEN;
|
2001-12-27 17:51:58 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 235: // SO_ACTOR_TALK_SCRIPT
|
2003-05-31 14:27:47 +00:00
|
|
|
a->talkScript = pop();
|
2002-12-15 17:28:46 +00:00
|
|
|
break;
|
2001-10-16 10:01:48 +00:00
|
|
|
default:
|
2002-12-23 15:46:53 +00:00
|
|
|
error("o6_actorOps: default case %d", b);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_verbOps() {
|
2002-04-11 17:19:16 +00:00
|
|
|
int slot, a, b;
|
2001-10-16 10:01:48 +00:00
|
|
|
VerbSlot *vs;
|
2003-05-21 18:09:49 +00:00
|
|
|
byte op;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-10-01 09:27:09 +00:00
|
|
|
// Full Throttle implements conversation by creating new verbs, one
|
|
|
|
// for each option, but it never tells when to actually draw them.
|
|
|
|
|
2003-11-17 21:16:43 +00:00
|
|
|
if (_gameId == GID_FT)
|
2002-10-01 09:27:09 +00:00
|
|
|
_verbRedraw = true;
|
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
op = fetchScriptByte();
|
2002-04-11 17:19:16 +00:00
|
|
|
if (op == 196) {
|
2001-10-16 10:01:48 +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");
|
2001-10-16 10:01:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
vs = &_verbs[_curVerbSlot];
|
|
|
|
slot = _curVerbSlot;
|
2002-04-11 17:19:16 +00:00
|
|
|
switch (op) {
|
2003-11-09 22:12:16 +00:00
|
|
|
case 124: // SO_VERB_IMAGE
|
2001-10-16 10:01:48 +00:00
|
|
|
a = pop();
|
|
|
|
if (_curVerbSlot) {
|
2002-04-11 17:19:16 +00:00
|
|
|
setVerbObject(_roomResource, a, slot);
|
2002-11-29 18:27:35 +00:00
|
|
|
vs->type = kImageVerbType;
|
2004-01-12 09:00:31 +00:00
|
|
|
if (_features & GF_HUMONGOUS)
|
|
|
|
vs->imgindex = a;
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 125: // SO_VERB_NAME
|
2001-11-14 20:09:39 +00:00
|
|
|
loadPtrToResource(rtVerb, slot, NULL);
|
2002-11-29 18:27:35 +00:00
|
|
|
vs->type = kTextVerbType;
|
2001-10-16 10:01:48 +00:00
|
|
|
vs->imgindex = 0;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 126: // SO_VERB_COLOR
|
2001-10-16 10:01:48 +00:00
|
|
|
vs->color = pop();
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 127: // SO_VERB_HICOLOR
|
2001-10-16 10:01:48 +00:00
|
|
|
vs->hicolor = pop();
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 128: // SO_VERB_AT
|
2004-01-15 19:25:17 +00:00
|
|
|
vs->curRect.top = pop();
|
|
|
|
vs->curRect.left = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 129: // SO_VERB_ON
|
2001-10-16 10:01:48 +00:00
|
|
|
vs->curmode = 1;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 130: // SO_VERB_OFF
|
2001-10-16 10:01:48 +00:00
|
|
|
vs->curmode = 0;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 131: // SO_VERB_DELETE
|
2003-12-30 07:34:15 +00:00
|
|
|
if (_features & GF_HUMONGOUS)
|
|
|
|
slot = getVerbSlot(pop(), 0);
|
2001-10-16 10:01:48 +00:00
|
|
|
killVerb(slot);
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 132: // SO_VERB_NEW
|
2001-10-16 10:01:48 +00:00
|
|
|
slot = getVerbSlot(_curVerb, 0);
|
2002-04-11 17:19:16 +00:00
|
|
|
if (slot == 0) {
|
2003-12-26 23:11:35 +00:00
|
|
|
for (slot = 1; slot < _numVerbs; slot++) {
|
2002-04-11 17:19:16 +00:00
|
|
|
if (_verbs[slot].verbid == 0)
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
}
|
2003-12-26 23:11:35 +00:00
|
|
|
if (slot == _numVerbs)
|
2001-10-16 10:01:48 +00:00
|
|
|
error("Too many verbs");
|
|
|
|
_curVerbSlot = slot;
|
|
|
|
}
|
|
|
|
vs = &_verbs[slot];
|
|
|
|
vs->verbid = _curVerb;
|
|
|
|
vs->color = 2;
|
|
|
|
vs->hicolor = 0;
|
|
|
|
vs->dimcolor = 8;
|
2002-11-29 18:27:35 +00:00
|
|
|
vs->type = kTextVerbType;
|
2002-09-22 01:17:53 +00:00
|
|
|
vs->charset_nr = _string[0].t_charset;
|
2001-10-16 10:01:48 +00:00
|
|
|
vs->curmode = 0;
|
|
|
|
vs->saveid = 0;
|
|
|
|
vs->key = 0;
|
|
|
|
vs->center = 0;
|
|
|
|
vs->imgindex = 0;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 133: // SO_VERB_DIMCOLOR
|
2001-10-16 10:01:48 +00:00
|
|
|
vs->dimcolor = pop();
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 134: // SO_VERB_DIM
|
2001-10-16 10:01:48 +00:00
|
|
|
vs->curmode = 2;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 135: // SO_VERB_KEY
|
2001-10-16 10:01:48 +00:00
|
|
|
vs->key = pop();
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 136: // SO_VERB_CENTER
|
2001-10-16 10:01:48 +00:00
|
|
|
vs->center = 1;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 137: // SO_VERB_NAME_STR
|
2001-10-16 10:01:48 +00:00
|
|
|
a = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
if (a == 0) {
|
2003-05-21 18:09:49 +00:00
|
|
|
loadPtrToResource(rtVerb, slot, (const byte *)"");
|
2001-10-16 10:01:48 +00:00
|
|
|
} else {
|
2003-05-21 18:09:49 +00:00
|
|
|
loadPtrToResource(rtVerb, slot, getStringAddress(a));
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
2002-11-29 18:27:35 +00:00
|
|
|
vs->type = kTextVerbType;
|
2001-10-16 10:01:48 +00:00
|
|
|
vs->imgindex = 0;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 139: // SO_VERB_IMAGE_IN_ROOM
|
2001-10-16 10:01:48 +00:00
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
if (slot && a != vs->imgindex) {
|
|
|
|
setVerbObject(b, a, slot);
|
2002-11-29 18:27:35 +00:00
|
|
|
vs->type = kImageVerbType;
|
2001-10-16 10:01:48 +00:00
|
|
|
vs->imgindex = a;
|
|
|
|
}
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 140: // SO_VERB_BAKCOLOR
|
2001-10-16 10:01:48 +00:00
|
|
|
vs->bkcolor = pop();
|
|
|
|
break;
|
|
|
|
case 255:
|
|
|
|
drawVerb(slot, 0);
|
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
|
|
|
default:
|
2003-04-20 15:02:58 +00:00
|
|
|
error("o6_verbops: default case %d", op);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getActorFromXY() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int y = pop();
|
|
|
|
int x = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(getActorFromPos(x, y));
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_findObject() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int y = pop();
|
|
|
|
int x = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
int r = findObject(x, y);
|
2001-10-16 10:01:48 +00:00
|
|
|
push(r);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_pseudoRoom() {
|
2002-12-25 14:46:39 +00:00
|
|
|
int list[100];
|
2002-04-11 17:19:16 +00:00
|
|
|
int num, a, value;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2003-05-18 21:03:57 +00:00
|
|
|
num = getStackList(list, ARRAYSIZE(list));
|
2001-10-16 10:01:48 +00:00
|
|
|
value = pop();
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
while (--num >= 0) {
|
2001-10-16 10:01:48 +00:00
|
|
|
a = list[num];
|
|
|
|
if (a > 0x7F)
|
2002-04-11 17:19:16 +00:00
|
|
|
_resourceMapper[a & 0x7F] = value;
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getVerbEntrypoint() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int e = pop();
|
|
|
|
int v = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
push(getVerbEntrypoint(v, e));
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_arrayOps() {
|
2002-12-28 01:57:19 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
|
|
|
int array = fetchScriptWord();
|
|
|
|
int b, c, d, len;
|
|
|
|
ArrayHeader *ah;
|
2002-12-25 14:46:39 +00:00
|
|
|
int list[128];
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-12-28 01:57:19 +00:00
|
|
|
switch (subOp) {
|
2003-11-09 22:12:16 +00:00
|
|
|
case 205: // 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);
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 208: // SO_ASSIGN_INT_LIST
|
2001-10-16 10:01:48 +00:00
|
|
|
b = pop();
|
|
|
|
c = pop();
|
2002-12-28 01:57:19 +00:00
|
|
|
d = readVar(array);
|
2002-04-11 17:19:16 +00:00
|
|
|
if (d == 0) {
|
2002-12-28 01:57:19 +00:00
|
|
|
defineArray(array, 5, 0, b + c);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
while (c--) {
|
2002-12-28 01:57:19 +00:00
|
|
|
writeArray(array, 0, b + c, pop());
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 212: // SO_ASSIGN_2DIM_LIST
|
2001-10-16 10:01:48 +00:00
|
|
|
b = pop();
|
2003-05-18 21:03:57 +00:00
|
|
|
len = getStackList(list, ARRAYSIZE(list));
|
2002-12-28 01:57:19 +00:00
|
|
|
d = readVar(array);
|
2002-04-11 17:19:16 +00:00
|
|
|
if (d == 0)
|
2001-10-16 10:01:48 +00:00
|
|
|
error("Must DIM a two dimensional array before assigning");
|
|
|
|
c = pop();
|
2002-12-28 01:57:19 +00:00
|
|
|
while (--len >= 0) {
|
|
|
|
writeArray(array, c, b + len, list[len]);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2002-12-28 01:57:19 +00:00
|
|
|
error("o6_arrayOps: default case %d (array %d)", subOp, array);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_saveRestoreVerbs() {
|
2002-04-11 17:19:16 +00:00
|
|
|
int a, b, c;
|
|
|
|
int slot, slot2;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
|
2002-12-27 16:49:08 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version == 8) {
|
2002-12-27 16:49:08 +00:00
|
|
|
subOp = (subOp - 141) + 0xB4;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (subOp) {
|
2003-11-09 22:12:16 +00:00
|
|
|
case 141: // SO_SAVE_VERBS
|
2002-04-11 17:19:16 +00:00
|
|
|
while (a <= b) {
|
|
|
|
slot = getVerbSlot(a, 0);
|
|
|
|
if (slot && _verbs[slot].saveid == 0) {
|
2001-10-16 10:01:48 +00:00
|
|
|
_verbs[slot].saveid = c;
|
|
|
|
drawVerb(slot, 0);
|
|
|
|
verbMouseOver(0);
|
|
|
|
}
|
|
|
|
a++;
|
|
|
|
}
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 142: // SO_RESTORE_VERBS
|
2002-04-11 17:19:16 +00:00
|
|
|
while (a <= b) {
|
2001-10-16 10:01:48 +00:00
|
|
|
slot = getVerbSlot(a, c);
|
|
|
|
if (slot) {
|
2002-04-11 17:19:16 +00:00
|
|
|
slot2 = getVerbSlot(a, 0);
|
2001-10-16 10:01:48 +00:00
|
|
|
if (slot2)
|
|
|
|
killVerb(slot2);
|
2002-04-11 17:19:16 +00:00
|
|
|
slot = getVerbSlot(a, c);
|
2001-10-16 10:01:48 +00:00
|
|
|
_verbs[slot].saveid = 0;
|
|
|
|
drawVerb(slot, 0);
|
|
|
|
verbMouseOver(0);
|
|
|
|
}
|
|
|
|
a++;
|
|
|
|
}
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 143: // SO_DELETE_VERBS
|
2002-04-11 17:19:16 +00:00
|
|
|
while (a <= b) {
|
|
|
|
slot = getVerbSlot(a, c);
|
2001-10-16 10:01:48 +00:00
|
|
|
if (slot)
|
|
|
|
killVerb(slot);
|
|
|
|
a++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2001-10-23 19:51:50 +00:00
|
|
|
error("o6_saveRestoreVerbs: default case");
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_drawBox() {
|
2002-04-11 17:19:16 +00:00
|
|
|
int x, y, x2, y2, color;
|
2001-10-16 10:01:48 +00:00
|
|
|
color = pop();
|
|
|
|
y2 = pop();
|
|
|
|
x2 = pop();
|
|
|
|
y = pop();
|
|
|
|
x = pop();
|
|
|
|
drawBox(x, y, x2, y2, color);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_wait() {
|
2003-05-28 14:01:54 +00:00
|
|
|
int actnum;
|
|
|
|
int offs = -2;
|
|
|
|
Actor *a;
|
|
|
|
byte subOp = fetchScriptByte();
|
|
|
|
|
|
|
|
switch (subOp) {
|
2003-11-09 22:12:16 +00:00
|
|
|
case 168: // SO_WAIT_FOR_ACTOR Wait for actor
|
2003-05-28 14:01:54 +00:00
|
|
|
offs = fetchScriptWordSigned();
|
|
|
|
actnum = pop();
|
|
|
|
a = derefActor(actnum, "o6_wait:168");
|
2003-05-31 21:25:14 +00:00
|
|
|
if (a->isInCurrentRoom() && a->moving)
|
|
|
|
break;
|
2002-12-27 00:23:45 +00:00
|
|
|
return;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 169: // SO_WAIT_FOR_MESSAGE Wait for message
|
2003-05-08 15:48:50 +00:00
|
|
|
if (VAR(VAR_HAVE_MSG))
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
return;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 170: // SO_WAIT_FOR_CAMERA Wait for camera
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version >= 7) {
|
2003-05-28 14:01:54 +00:00
|
|
|
if (camera._dest != camera._cur)
|
2001-12-27 17:51:58 +00:00
|
|
|
break;
|
2002-03-06 00:18:22 +00:00
|
|
|
} else {
|
2003-11-16 20:52:57 +00:00
|
|
|
if (camera._cur.x / 8 != camera._dest.x / 8)
|
2002-04-11 17:19:16 +00:00
|
|
|
break;
|
2002-03-06 00:18:22 +00:00
|
|
|
}
|
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
return;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 171: // SO_WAIT_FOR_SENTENCE
|
2001-11-26 19:57:57 +00:00
|
|
|
if (_sentenceNum) {
|
2003-05-08 15:48:50 +00:00
|
|
|
if (_sentence[_sentenceNum - 1].freezeCount && !isScriptInUse(VAR(VAR_SENTENCE_SCRIPT)))
|
2001-10-16 10:01:48 +00:00
|
|
|
return;
|
|
|
|
break;
|
|
|
|
}
|
2003-05-08 15:48:50 +00:00
|
|
|
if (!isScriptInUse(VAR(VAR_SENTENCE_SCRIPT)))
|
2001-10-16 10:01:48 +00:00
|
|
|
return;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 226: // SO_WAIT_FOR_ANIMATION
|
2003-05-28 14:01:54 +00:00
|
|
|
offs = fetchScriptWordSigned();
|
|
|
|
actnum = pop();
|
|
|
|
a = derefActor(actnum, "o6_wait:226");
|
2003-05-31 21:25:14 +00:00
|
|
|
if (a->isInCurrentRoom() && a->needRedraw)
|
|
|
|
break;
|
2003-05-28 14:01:54 +00:00
|
|
|
return;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 232: // SO_WAIT_FOR_TURN
|
2003-05-28 14:01:54 +00:00
|
|
|
// FIXME: This opcode is really odd. It's used a lot in The Dig.
|
|
|
|
// But sometimes it receives the actor ID as params, and sometimes an
|
|
|
|
// angle. However in (almost?) all cases, just before calling it, _curActor
|
|
|
|
// is set, so we can use it. I tried to add code that detects if an angle
|
|
|
|
// is passed, and if so, wait till that angle is reached, but that leads to hangs.
|
|
|
|
// It would be very good if somebody could disassmble the original code
|
|
|
|
// for this opcode so that we could figure out what's really going on here.
|
|
|
|
//
|
|
|
|
// For now, if the value passed in is divisible by 45, assume it is an
|
|
|
|
// angle, and use _curActor as the actor to wait for.
|
|
|
|
offs = fetchScriptWordSigned();
|
|
|
|
actnum = pop();
|
|
|
|
if (actnum % 45 == 0) {
|
|
|
|
actnum = _curActor;
|
2001-12-27 17:51:58 +00:00
|
|
|
}
|
2003-05-28 14:01:54 +00:00
|
|
|
a = derefActor(actnum, "o6_wait:232b");
|
2003-05-31 21:25:14 +00:00
|
|
|
if (a->isInCurrentRoom() && a->moving & MF_TURN)
|
|
|
|
break;
|
2003-05-28 14:01:54 +00:00
|
|
|
return;
|
2001-10-16 10:01:48 +00:00
|
|
|
default:
|
2003-05-28 14:01:54 +00:00
|
|
|
error("o6_wait: default case 0x%x", subOp);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-05-28 14:01:54 +00:00
|
|
|
_scriptPointer += offs;
|
2001-10-23 19:51:50 +00:00
|
|
|
o6_breakHere();
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_soundKludge() {
|
2002-12-25 14:46:39 +00:00
|
|
|
int list[16];
|
2003-05-18 21:03:57 +00:00
|
|
|
int num = getStackList(list, ARRAYSIZE(list));
|
2002-05-25 19:40:42 +00:00
|
|
|
|
2002-12-25 14:46:39 +00:00
|
|
|
_sound->soundKludge(list, num);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_isAnyOf() {
|
2002-12-25 14:46:39 +00:00
|
|
|
int list[100];
|
2001-10-16 10:01:48 +00:00
|
|
|
int num;
|
|
|
|
int16 val;
|
|
|
|
|
2003-05-18 21:03:57 +00:00
|
|
|
num = getStackList(list, ARRAYSIZE(list));
|
2001-10-16 10:01:48 +00:00
|
|
|
val = pop();
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
while (--num >= 0) {
|
2001-10-16 10:01:48 +00:00
|
|
|
if (list[num] == val) {
|
|
|
|
push(1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
push(0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_quitPauseRestart() {
|
2003-06-02 02:25:24 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
|
|
|
switch (subOp) {
|
2003-11-09 22:12:16 +00:00
|
|
|
case 158: // SO_RESTART
|
2003-06-02 02:25:24 +00:00
|
|
|
restart();
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 159: // SO_PAUSE
|
2003-06-02 02:25:24 +00:00
|
|
|
pauseGame();
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 160: // SO_QUIT
|
2003-06-02 02:25:24 +00:00
|
|
|
shutDown();
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
|
|
|
default:
|
2003-07-13 16:22:17 +00:00
|
|
|
error("o6_quitPauseRestart invalid case %d", subOp);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_delay() {
|
2002-12-26 21:50:13 +00:00
|
|
|
// FIXME - what exactly are we measuring here? In order for the other two
|
|
|
|
// delay functions to be right, it should be 1/60th of a second. But for
|
|
|
|
// CMI it would seem this should delay for 1/10th of a second...
|
2001-10-16 10:01:48 +00:00
|
|
|
uint32 delay = (uint16)pop();
|
|
|
|
vm.slot[_currentScript].delay = delay;
|
2003-09-11 10:32:15 +00:00
|
|
|
vm.slot[_currentScript].status = ssPaused;
|
2001-10-23 19:51:50 +00:00
|
|
|
o6_breakHere();
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_delaySeconds() {
|
2003-01-14 10:33:18 +00:00
|
|
|
uint32 delay = (uint32)pop();
|
|
|
|
if (_gameId != GID_CMI)
|
|
|
|
// FIXME - are we really measuring minutes here?
|
|
|
|
delay = delay * 60;
|
|
|
|
else
|
|
|
|
// FIXME - Is this the same in ComI? Seem to need a 1.5 minute
|
|
|
|
// multiplier for correct timing - see patch 664893
|
|
|
|
delay = delay * 90;
|
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
vm.slot[_currentScript].delay = delay;
|
2003-09-11 10:32:15 +00:00
|
|
|
vm.slot[_currentScript].status = ssPaused;
|
2001-10-23 19:51:50 +00:00
|
|
|
o6_breakHere();
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_delayMinutes() {
|
2002-12-26 21:50:13 +00:00
|
|
|
// FIXME - are we really measuring minutes here?
|
2001-10-16 10:01:48 +00:00
|
|
|
uint32 delay = (uint16)pop() * 3600;
|
|
|
|
vm.slot[_currentScript].delay = delay;
|
2003-09-11 10:32:15 +00:00
|
|
|
vm.slot[_currentScript].status = ssPaused;
|
2001-10-23 19:51:50 +00:00
|
|
|
o6_breakHere();
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_stopSentence() {
|
2001-11-26 19:57:57 +00:00
|
|
|
_sentenceNum = 0;
|
2003-05-20 20:58:26 +00:00
|
|
|
stopScript(VAR(VAR_SENTENCE_SCRIPT));
|
2001-10-16 10:01:48 +00:00
|
|
|
clearClickedStatus();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_printLine() {
|
2001-10-16 10:01:48 +00:00
|
|
|
_actorToPrintStrFor = 0xFF;
|
2002-12-23 15:46:53 +00:00
|
|
|
decodeParseString(0, 0);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_printCursor() {
|
2002-12-23 15:46:53 +00:00
|
|
|
decodeParseString(1, 0);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_printDebug() {
|
2002-12-23 15:46:53 +00:00
|
|
|
decodeParseString(2, 0);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_printSystem() {
|
2002-12-23 15:46:53 +00:00
|
|
|
decodeParseString(3, 0);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_printActor() {
|
2002-12-23 15:46:53 +00:00
|
|
|
decodeParseString(0, 1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_printEgo() {
|
2003-05-08 15:48:50 +00:00
|
|
|
push(VAR(VAR_EGO));
|
2003-01-16 14:42:20 +00:00
|
|
|
decodeParseString(0, 1);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_talkActor() {
|
2001-10-16 10:01:48 +00:00
|
|
|
_actorToPrintStrFor = pop();
|
2003-06-01 00:45:08 +00:00
|
|
|
|
2003-07-15 21:30:53 +00:00
|
|
|
_messagePtr = translateTextAndPlaySpeech(_scriptPointer);
|
2003-06-01 00:45:08 +00:00
|
|
|
_scriptPointer += resStrLen(_scriptPointer) + 1;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2003-06-01 00:45:08 +00:00
|
|
|
setStringVars(0);
|
|
|
|
actorTalk();
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_talkEgo() {
|
2003-05-08 15:48:50 +00:00
|
|
|
push(VAR(VAR_EGO));
|
2002-12-26 21:50:13 +00:00
|
|
|
o6_talkActor();
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-11-10 08:00:55 +00:00
|
|
|
void ScummEngine_v6::o6_dimArray() {
|
2001-10-16 10:01:48 +00:00
|
|
|
int data;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
switch (fetchScriptByte()) {
|
2003-11-09 22:12:16 +00:00
|
|
|
case 199: // SO_INT_ARRAY
|
2001-10-16 10:01:48 +00:00
|
|
|
data = 5;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 200: // SO_BIT_ARRAY
|
2001-10-16 10:01:48 +00:00
|
|
|
data = 1;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 201: // SO_NIBBLE_ARRAY
|
2001-10-16 10:01:48 +00:00
|
|
|
data = 2;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 202: // SO_BYTE_ARRAY
|
2001-10-16 10:01:48 +00:00
|
|
|
data = 3;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 203: // SO_STRING_ARRAY
|
2001-10-16 10:01:48 +00:00
|
|
|
data = 4;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 204: // SO_UNDIM_ARRAY
|
2001-10-16 10:01:48 +00:00
|
|
|
nukeArray(fetchScriptWord());
|
|
|
|
return;
|
|
|
|
default:
|
2003-11-10 08:00:55 +00:00
|
|
|
error("o6_dimArray: default case");
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
defineArray(fetchScriptWord(), data, 0, pop());
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_dummy() {
|
2002-12-16 12:12:31 +00:00
|
|
|
/* nothing */
|
2003-04-21 00:22:52 +00:00
|
|
|
if (_features & GF_HUMONGOUS)
|
|
|
|
stopObjectCode();
|
2002-12-16 12:12:31 +00:00
|
|
|
}
|
|
|
|
|
2003-11-10 08:00:55 +00:00
|
|
|
void ScummEngine_v6::o6_dim2dimArray() {
|
2002-04-11 17:19:16 +00:00
|
|
|
int a, b, data;
|
|
|
|
switch (fetchScriptByte()) {
|
2003-11-09 22:12:16 +00:00
|
|
|
case 199: // SO_INT_ARRAY
|
2001-10-16 10:01:48 +00:00
|
|
|
data = 5;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 200: // SO_BIT_ARRAY
|
2001-10-16 10:01:48 +00:00
|
|
|
data = 1;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 201: // SO_NIBBLE_ARRAY
|
2001-10-16 10:01:48 +00:00
|
|
|
data = 2;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 202: // SO_BYTE_ARRAY
|
2001-10-16 10:01:48 +00:00
|
|
|
data = 3;
|
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 203: // SO_STRING_ARRAY
|
2001-10-16 10:01:48 +00:00
|
|
|
data = 4;
|
|
|
|
break;
|
|
|
|
default:
|
2003-11-10 08:00:55 +00:00
|
|
|
error("o6_dim2dimArray: default case");
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
defineArray(fetchScriptWord(), data, a, b);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_abs() {
|
2003-04-30 13:23:31 +00:00
|
|
|
int a = pop(); // palmos: prevent multi pop if we use an abs function defined as : #define abs(a) ((a) < 0 ? -(a) : (a))
|
|
|
|
push(abs(a));
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_distObjectObject() {
|
2002-04-11 17:19:16 +00:00
|
|
|
int a, b;
|
2001-10-16 10:01:48 +00:00
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
push(getDistanceBetween(true, a, 0, true, b, 0));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_distObjectPt() {
|
2002-04-11 17:19:16 +00:00
|
|
|
int a, b, c;
|
2001-10-16 10:01:48 +00:00
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
push(getDistanceBetween(true, a, 0, false, b, c));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_distPtPt() {
|
2002-04-11 17:19:16 +00:00
|
|
|
int a, b, c, d;
|
2001-10-16 10:01:48 +00:00
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
push(getDistanceBetween(false, a, b, false, c, d));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_drawBlastObject() {
|
2002-12-25 14:46:39 +00:00
|
|
|
int args[16];
|
2002-04-11 17:19:16 +00:00
|
|
|
int a, b, c, d, e;
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2003-05-18 21:03:57 +00:00
|
|
|
getStackList(args, ARRAYSIZE(args));
|
2001-12-27 17:51:58 +00:00
|
|
|
e = pop();
|
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
enqueueObject(a, b, c, d, e, 0xFF, 0xFF, 1, 0);
|
|
|
|
}
|
|
|
|
|
2002-12-23 15:46:53 +00:00
|
|
|
// Set BOMP processing window
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_setBlastObjectWindow() {
|
2002-12-23 15:46:53 +00:00
|
|
|
// TODO - implement this
|
|
|
|
int a, b, c, d;
|
|
|
|
|
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
|
2003-09-13 21:04:47 +00:00
|
|
|
warning("o6_setBlastObjectWindow(%d, %d, %d, %d)", a, b, c, d);
|
2002-12-23 15:46:53 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_kernelSetFunctions() {
|
2002-12-25 14:46:39 +00:00
|
|
|
int args[30];
|
2003-05-24 17:04:54 +00:00
|
|
|
int num;
|
2001-11-11 16:54:45 +00:00
|
|
|
Actor *a;
|
2002-04-23 18:11:36 +00:00
|
|
|
|
2003-05-24 17:04:54 +00:00
|
|
|
num = getStackList(args, ARRAYSIZE(args));
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version >= 7) {
|
2002-04-11 17:19:16 +00:00
|
|
|
switch (args[0]) {
|
2002-02-23 23:23:28 +00:00
|
|
|
case 4:
|
|
|
|
grabCursor(args[1], args[2], args[3], args[4]);
|
|
|
|
break;
|
2002-09-15 05:38:04 +00:00
|
|
|
case 6: {
|
|
|
|
uint32 speed;
|
2003-08-15 03:15:41 +00:00
|
|
|
assert(getStringAddressVar(VAR_VIDEONAME));
|
2003-12-27 16:40:01 +00:00
|
|
|
if (strcmp((char *)getStringAddressVar(VAR_VIDEONAME), "sq3.san") == 0) {
|
|
|
|
speed = 1000000 / 14;
|
|
|
|
} else {
|
2002-12-25 16:55:43 +00:00
|
|
|
if (_smushFrameRate == 0)
|
|
|
|
_smushFrameRate = 14;
|
2003-01-25 12:13:41 +00:00
|
|
|
speed = 1000000 / _smushFrameRate;
|
2002-12-21 20:05:40 +00:00
|
|
|
}
|
2003-03-06 17:58:13 +00:00
|
|
|
|
2003-12-06 05:47:24 +00:00
|
|
|
debug(1, "INSANE Arg: %d %d", args[1], args[2]);
|
2002-10-06 06:36:22 +00:00
|
|
|
|
|
|
|
// INSANE mode 0: SMUSH movie playback
|
|
|
|
if (args[1] == 0) {
|
2004-02-06 21:05:58 +00:00
|
|
|
SmushPlayer *sp = new SmushPlayer(this, speed);
|
|
|
|
|
2003-03-06 17:58:13 +00:00
|
|
|
sp->play((char *)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
|
2004-02-06 21:05:58 +00:00
|
|
|
delete sp;
|
2003-11-17 21:16:43 +00:00
|
|
|
} else if (_gameId == GID_FT) {
|
2004-02-06 21:05:58 +00:00
|
|
|
const int insaneVarNum = ((_features & GF_DEMO) && (_features & GF_PC))
|
|
|
|
? 232 : 233;
|
2003-12-06 05:47:24 +00:00
|
|
|
|
2004-02-06 21:05:58 +00:00
|
|
|
_insane->setSmushParams(speed);
|
|
|
|
_insane->runScene(insaneVarNum);
|
2002-10-06 06:36:22 +00:00
|
|
|
}
|
2003-03-06 17:58:13 +00:00
|
|
|
}
|
2002-09-15 05:38:04 +00:00
|
|
|
break;
|
2002-02-23 23:23:28 +00:00
|
|
|
case 12:
|
2002-04-11 17:19:16 +00:00
|
|
|
setCursorImg(args[1], (uint) - 1, args[2]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 13:
|
2003-05-28 14:09:55 +00:00
|
|
|
derefActor(args[1], "o6_kernelSetFunctions:13")->remapActorPalette(args[2], args[3], args[4], -1);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 14:
|
2003-05-23 13:24:41 +00:00
|
|
|
derefActor(args[1], "o6_kernelSetFunctions:14")->remapActorPalette(args[2], args[3], args[4], args[5]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 15:
|
2002-12-25 16:55:43 +00:00
|
|
|
_smushFrameRate = args[1];
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
2002-04-08 13:55:03 +00:00
|
|
|
case 16:
|
2003-06-02 23:06:34 +00:00
|
|
|
case 17:{
|
2003-06-02 23:54:52 +00:00
|
|
|
const byte *message;
|
2003-07-15 21:33:57 +00:00
|
|
|
byte buf_input[300], buf_output[300];
|
2003-06-02 23:54:52 +00:00
|
|
|
_messagePtr = getStringAddressVar(VAR_STRING2DRAW);
|
|
|
|
message = _msgPtrToAdd = buf_input;
|
|
|
|
addMessageToStack(_messagePtr);
|
2003-11-18 04:05:06 +00:00
|
|
|
if ((_gameId == GID_DIG) && !(_features & GF_DEMO)) {
|
2003-07-15 21:33:57 +00:00
|
|
|
byte buf_trans[300];
|
|
|
|
char *t_ptr = (char *)buf_input;
|
2003-03-08 17:38:59 +00:00
|
|
|
buf_output[0] = 0;
|
2003-06-02 23:06:34 +00:00
|
|
|
while (t_ptr != NULL) {
|
2003-03-08 17:38:59 +00:00
|
|
|
if (*t_ptr == '/') {
|
|
|
|
translateText((byte *)t_ptr, buf_trans);
|
2003-03-09 08:30:53 +00:00
|
|
|
// hack
|
|
|
|
if (strstr((char *)buf_trans, "%___") != 0) {
|
|
|
|
strcat((char *)buf_output, " ");
|
|
|
|
} else {
|
|
|
|
strcat((char *)buf_output, (char *)buf_trans);
|
|
|
|
}
|
2003-03-08 17:38:59 +00:00
|
|
|
}
|
|
|
|
t_ptr = strchr((char *)t_ptr + 1, '/');
|
|
|
|
if (t_ptr == NULL)
|
|
|
|
break;
|
|
|
|
t_ptr = strchr((char *)t_ptr + 1, '/');
|
|
|
|
}
|
2003-06-02 23:06:34 +00:00
|
|
|
message = buf_output;
|
2002-05-25 08:53:08 +00:00
|
|
|
}
|
2003-09-09 20:54:19 +00:00
|
|
|
enqueueText(message, args[3], args[4], args[2], args[1], true);
|
2003-06-02 23:06:34 +00:00
|
|
|
break;}
|
2003-05-25 11:18:57 +00:00
|
|
|
case 20:
|
2004-01-17 11:05:57 +00:00
|
|
|
// it's used for turn on/off 'RadioChatter' effect for voice in the dig, but i's not needed
|
2003-05-25 11:18:57 +00:00
|
|
|
break;
|
2002-02-23 23:23:28 +00:00
|
|
|
case 107:
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(args[1], "o6_kernelSetFunctions: 107");
|
2004-01-05 16:30:00 +00:00
|
|
|
a->setScale((unsigned char)args[2], -1);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 108:
|
2002-07-07 13:14:34 +00:00
|
|
|
setupShadowPalette(args[1], args[2], args[3], args[4], args[5], args[6]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 109:
|
2002-04-11 17:19:16 +00:00
|
|
|
setupShadowPalette(0, args[1], args[2], args[3], args[4], args[5]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 114:
|
2003-01-06 01:53:38 +00:00
|
|
|
warning("o6_kernelSetFunctions: stub114()");
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 117:
|
|
|
|
freezeScripts(2);
|
|
|
|
break;
|
|
|
|
case 118:
|
2002-07-07 13:14:34 +00:00
|
|
|
enqueueObject(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], 3);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 119:
|
2002-07-07 13:14:34 +00:00
|
|
|
enqueueObject(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], 0);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 124:
|
2003-03-08 14:42:59 +00:00
|
|
|
_saveSound = args[1];
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
2003-11-08 03:33:21 +00:00
|
|
|
case 215:
|
2003-12-27 15:22:59 +00:00
|
|
|
ConfMan.set("subtitles", args[1] != 0);
|
2003-11-08 03:33:21 +00:00
|
|
|
break;
|
2003-05-24 17:04:54 +00:00
|
|
|
default:
|
2003-05-25 11:18:57 +00:00
|
|
|
error("o6_kernelSetFunctions: default case %d (param count %d)", args[0], num);
|
2003-05-24 17:04:54 +00:00
|
|
|
break;
|
2002-02-23 23:23:28 +00:00
|
|
|
}
|
|
|
|
} else {
|
2002-04-11 17:19:16 +00:00
|
|
|
switch (args[0]) {
|
2003-09-13 20:54:12 +00:00
|
|
|
case 1:
|
2004-01-16 04:55:49 +00:00
|
|
|
// Used to restore images when decorating cake in
|
|
|
|
// Fatty Bear's Birthday Surprise
|
|
|
|
warning("o6_kernelSetFunctions: stub1()");
|
2003-09-13 20:54:12 +00:00
|
|
|
break;
|
2002-02-23 23:23:28 +00:00
|
|
|
case 3:
|
2003-01-06 01:53:38 +00:00
|
|
|
warning("o6_kernelSetFunctions: nothing in 3");
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
grabCursor(args[1], args[2], args[3], args[4]);
|
|
|
|
break;
|
|
|
|
case 5:
|
2002-07-13 14:07:37 +00:00
|
|
|
fadeOut(args[1]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
_fullRedraw = 1;
|
|
|
|
redrawBGAreas();
|
2003-05-30 00:55:21 +00:00
|
|
|
setActorRedrawFlags();
|
2002-02-23 23:23:28 +00:00
|
|
|
processActors();
|
2002-07-13 14:07:37 +00:00
|
|
|
fadeIn(args[1]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
startManiac();
|
|
|
|
break;
|
|
|
|
case 9:
|
2004-01-14 23:51:22 +00:00
|
|
|
error("o6_kernelSetFunctions: stub9()");
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 104: /* samnmax */
|
2002-02-23 23:23:28 +00:00
|
|
|
nukeFlObjects(args[2], args[3]);
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 107: /* set actor scale */
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(args[1], "o6_kernelSetFunctions: 107");
|
2004-01-05 16:30:00 +00:00
|
|
|
a->setScale((unsigned char)args[2], -1);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
2002-04-19 12:38:03 +00:00
|
|
|
case 108: /* create proc_special_palette */
|
2002-02-23 23:23:28 +00:00
|
|
|
case 109:
|
2004-01-14 14:36:19 +00:00
|
|
|
// Case 108 and 109 share the same function
|
2003-05-24 17:04:54 +00:00
|
|
|
if (num != 6)
|
|
|
|
warning("o6_kernelSetFunctions sub op %d: expected 6 params but got %d", args[0], num);
|
2002-07-07 13:14:34 +00:00
|
|
|
createSpecialPalette(args[1], args[2], args[3], args[4], args[5], 0, 256);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 110:
|
2004-01-08 21:21:40 +00:00
|
|
|
_charset->clearCharsetMask();
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 111:
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(args[1], "o6_kernelSetFunctions: 111");
|
2002-02-23 23:23:28 +00:00
|
|
|
a->shadow_mode = args[2] + args[3];
|
|
|
|
break;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 112: /* palette shift? */
|
2002-04-20 09:30:04 +00:00
|
|
|
createSpecialPalette(args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
2002-07-26 17:03:03 +00:00
|
|
|
case 114:
|
|
|
|
// Sam & Max film noir mode
|
2002-07-28 01:40:24 +00:00
|
|
|
if (_gameId == GID_SAMNMAX) {
|
|
|
|
// At this point ScummVM will already have set
|
|
|
|
// variable 0x8000 to indicate that the game is
|
|
|
|
// in film noir mode. All we have to do here is
|
2002-10-19 22:35:22 +00:00
|
|
|
// to mark the palette as "dirty", because
|
|
|
|
// updatePalette() will desaturate the colors
|
|
|
|
// as they are uploaded to the backend.
|
2002-07-28 01:40:24 +00:00
|
|
|
//
|
2002-10-19 22:35:22 +00:00
|
|
|
// This actually works better than the original
|
|
|
|
// interpreter, where actors would sometimes
|
|
|
|
// still be drawn in color.
|
2002-07-28 01:40:24 +00:00
|
|
|
setDirtyColors(0, 255);
|
|
|
|
} else
|
2003-01-06 01:53:38 +00:00
|
|
|
warning("stub o6_kernelSetFunctions_114()");
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 117:
|
2003-06-13 06:45:05 +00:00
|
|
|
// Sam & Max uses this opcode in script-43, right
|
2004-01-14 14:36:19 +00:00
|
|
|
// before a screensaver is selected.
|
2003-06-13 06:45:05 +00:00
|
|
|
//
|
|
|
|
// Sam & Max uses variable 132 to specify the number of
|
|
|
|
// minutes of inactivity (no mouse movements) before
|
|
|
|
// starting the screensaver, so setting it to 0 will
|
|
|
|
// help in debugging.
|
2004-01-14 10:01:39 +00:00
|
|
|
freezeScripts(0x80);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 119:
|
2002-07-07 13:14:34 +00:00
|
|
|
enqueueObject(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], 0);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 120:
|
2002-04-11 17:19:16 +00:00
|
|
|
swapPalColors(args[1], args[2]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 122:
|
2003-05-08 15:48:50 +00:00
|
|
|
VAR(VAR_SOUNDRESULT) =
|
2003-08-06 18:20:15 +00:00
|
|
|
(short)_imuse->doCommand (num - 1, &args[1]);
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
case 123:
|
2002-09-23 15:43:29 +00:00
|
|
|
copyPalColor(args[2], args[1]);
|
2002-03-07 04:29:24 +00:00
|
|
|
break;
|
2003-05-24 17:04:54 +00:00
|
|
|
case 124:
|
2002-03-07 04:29:24 +00:00
|
|
|
_saveSound = args[1];
|
2002-02-23 23:23:28 +00:00
|
|
|
break;
|
|
|
|
default:
|
2003-05-25 11:18:57 +00:00
|
|
|
error("o6_kernelSetFunctions: default case %d (param count %d)", args[0], num);
|
2003-05-24 17:04:54 +00:00
|
|
|
break;
|
2002-02-23 23:23:28 +00:00
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_kernelGetFunctions() {
|
2002-12-25 14:46:39 +00:00
|
|
|
int args[30];
|
2001-11-26 19:57:57 +00:00
|
|
|
int i;
|
2003-11-08 03:33:21 +00:00
|
|
|
int slot;
|
2001-11-26 19:57:57 +00:00
|
|
|
Actor *a;
|
|
|
|
|
2003-05-18 21:03:57 +00:00
|
|
|
getStackList(args, ARRAYSIZE(args));
|
2002-11-20 00:52:07 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
switch (args[0]) {
|
2004-01-16 04:55:49 +00:00
|
|
|
case 1:
|
|
|
|
// Used to store images when decorating cake in
|
|
|
|
// Fatty Bear's Birthday Surprise
|
|
|
|
warning("o6_kernelGetFunctions: stub1()");
|
|
|
|
push(0);
|
|
|
|
break;
|
2002-03-07 04:29:24 +00:00
|
|
|
case 113:
|
2002-09-23 15:43:29 +00:00
|
|
|
// This is used for the Sam & Max paint-by-numbers mini-game
|
|
|
|
// to find out what color to change. I think that what we have
|
|
|
|
// the virtual mouse coordinates, because that's what used
|
|
|
|
// everywhere else in the script.
|
|
|
|
|
|
|
|
if (args[1] != -1 && args[2] != -1) {
|
|
|
|
VirtScreen *vs = &virtscr[0];
|
|
|
|
push(vs->screenPtr[args[1] + args[2] * vs->width]);
|
|
|
|
} else
|
|
|
|
push(0);
|
2002-03-07 04:29:24 +00:00
|
|
|
break;
|
2001-11-26 19:57:57 +00:00
|
|
|
case 115:
|
2002-04-25 08:53:10 +00:00
|
|
|
push(getSpecialBox(args[1], args[2]));
|
2001-11-26 19:57:57 +00:00
|
|
|
break;
|
|
|
|
case 116:
|
|
|
|
push(checkXYInBoxBounds(args[3], args[1], args[2]));
|
|
|
|
break;
|
|
|
|
case 206:
|
2002-04-11 17:19:16 +00:00
|
|
|
push(remapPaletteColor(args[1], args[2], args[3], (uint) - 1));
|
2001-11-26 19:57:57 +00:00
|
|
|
break;
|
|
|
|
case 207:
|
2002-11-02 12:39:42 +00:00
|
|
|
i = getObjectIndex(args[1]);
|
2001-11-26 19:57:57 +00:00
|
|
|
push(_objs[i].x_pos);
|
|
|
|
break;
|
|
|
|
case 208:
|
2002-11-02 12:39:42 +00:00
|
|
|
i = getObjectIndex(args[1]);
|
2001-11-26 19:57:57 +00:00
|
|
|
push(_objs[i].y_pos);
|
|
|
|
break;
|
|
|
|
case 209:
|
2002-11-02 12:39:42 +00:00
|
|
|
i = getObjectIndex(args[1]);
|
2001-11-26 19:57:57 +00:00
|
|
|
push(_objs[i].width);
|
|
|
|
break;
|
|
|
|
case 210:
|
2002-11-02 12:39:42 +00:00
|
|
|
i = getObjectIndex(args[1]);
|
2001-11-26 19:57:57 +00:00
|
|
|
push(_objs[i].height);
|
|
|
|
break;
|
|
|
|
case 211:
|
2002-04-25 08:53:10 +00:00
|
|
|
/*
|
2002-07-07 13:14:34 +00:00
|
|
|
13 = thrust
|
|
|
|
336 = thrust
|
|
|
|
328 = thrust
|
2003-03-18 19:26:00 +00:00
|
|
|
27 = abort
|
2002-07-07 13:14:34 +00:00
|
|
|
97 = left
|
|
|
|
331 = left
|
|
|
|
115 = right
|
2003-03-18 19:26:00 +00:00
|
|
|
333 = right
|
2002-07-07 13:14:34 +00:00
|
|
|
*/
|
2002-09-21 17:51:52 +00:00
|
|
|
|
2004-01-02 00:36:20 +00:00
|
|
|
push(getKeyState(args[1]));
|
2001-11-26 19:57:57 +00:00
|
|
|
break;
|
|
|
|
case 212:
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(args[1], "o6_kernelGetFunctions:212");
|
2002-12-15 17:28:46 +00:00
|
|
|
// This is used by walk scripts
|
2001-11-26 19:57:57 +00:00
|
|
|
push(a->frame);
|
|
|
|
break;
|
2003-11-08 03:33:21 +00:00
|
|
|
case 213:
|
|
|
|
slot = getVerbSlot(args[1], 0);
|
2004-01-15 19:25:17 +00:00
|
|
|
push(_verbs[slot].curRect.left);
|
2003-11-08 03:33:21 +00:00
|
|
|
break;
|
|
|
|
case 214:
|
|
|
|
slot = getVerbSlot(args[1], 0);
|
2004-01-15 19:25:17 +00:00
|
|
|
push(_verbs[slot].curRect.top);
|
2003-11-08 03:33:21 +00:00
|
|
|
break;
|
2002-03-06 09:40:21 +00:00
|
|
|
case 215:
|
2002-09-07 19:55:16 +00:00
|
|
|
if ((_extraBoxFlags[args[1]] & 0x00FF) == 0x00C0) {
|
2002-03-06 09:40:21 +00:00
|
|
|
push(_extraBoxFlags[args[1]]);
|
2002-04-11 17:19:16 +00:00
|
|
|
} else {
|
2002-12-30 00:40:25 +00:00
|
|
|
push(getBoxFlags(args[1]));
|
2002-03-06 09:40:21 +00:00
|
|
|
}
|
|
|
|
break;
|
2001-11-26 19:57:57 +00:00
|
|
|
default:
|
2003-01-06 01:53:38 +00:00
|
|
|
error("o6_kernelGetFunctions: default case %d", args[0]);
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-12-05 00:02:01 +00:00
|
|
|
// FIXME: check either some warning will trigger. I am not sure that those
|
|
|
|
// keys are queried in scripts at all
|
|
|
|
int ScummEngine::getKeyState(int key) {
|
|
|
|
switch(key) {
|
|
|
|
case 0x145:
|
|
|
|
warning("ScummEngine::getKeyState(%x) 'numlock' is probed", key);
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
case 0x164:
|
|
|
|
warning("ScummEngine::getKeyState(%x) 'left shift' is probed", key);
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
case 0x165:
|
|
|
|
warning("ScummEngine::getKeyState(%x) 'right shift' is probed", key);
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
case 0x166:
|
|
|
|
case 0x167:
|
|
|
|
warning("ScummEngine::getKeyState(%x) 'alt' is probed", key);
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
case 0x168:
|
|
|
|
warning("ScummEngine::getKeyState(%x) 'left ctrl' is probed", key);
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
case 0x202a:
|
|
|
|
warning("ScummEngine::getKeyState(%x) 'gray *' is probed", key);
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
case 0x202d:
|
|
|
|
warning("ScummEngine::getKeyState(%x) 'gray -' is probed", key);
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
case 0x147: // Home
|
|
|
|
return (_keyDownMap[0x107] || _keyDownMap[0x115]) ? 1 : 0;
|
|
|
|
break;
|
|
|
|
case 0x148: // Up
|
|
|
|
return (_keyDownMap[0x108] || _keyDownMap[0x111] ||
|
|
|
|
_keyDownMap[0x38]) ? 1 : 0;
|
|
|
|
break;
|
|
|
|
case 0x149: // PgUp
|
|
|
|
return (_keyDownMap[0x109] || _keyDownMap[0x118]) ? 1 : 0;
|
|
|
|
break;
|
|
|
|
case 0x14A: // Gray-
|
|
|
|
return (_keyDownMap[0x10d] || _keyDownMap[0x2d]) ? 1 : 0;
|
|
|
|
break;
|
|
|
|
case 0x14B: // Left
|
|
|
|
return (_keyDownMap[0x104] || _keyDownMap[0x114] ||
|
|
|
|
_keyDownMap[0x34]) ? 1 : 0;
|
|
|
|
break;
|
|
|
|
case 0x14C: // 5
|
|
|
|
return (_keyDownMap[0x105]) ? 1 : 0;
|
|
|
|
break;
|
|
|
|
case 0x14D: // Right
|
|
|
|
return (_keyDownMap[0x106] || _keyDownMap[0x113] ||
|
|
|
|
_keyDownMap[0x36]) ? 1 : 0;
|
|
|
|
break;
|
|
|
|
case 0x14E: // Gray+
|
|
|
|
return (_keyDownMap[0x10e] ||
|
|
|
|
(_keyDownMap[0x13d] && _keyDownMap[0x12f])) ? 1 : 0;
|
|
|
|
break;
|
|
|
|
case 0x14F: // End
|
|
|
|
return (_keyDownMap[0x101] || _keyDownMap[0x117]) ? 1 : 0;
|
|
|
|
break;
|
|
|
|
case 0x150: // Down
|
|
|
|
return (_keyDownMap[0x102] || _keyDownMap[0x112] ||
|
|
|
|
_keyDownMap[0x32]) ? 1 : 0;
|
|
|
|
break;
|
|
|
|
case 0x151: // PgDn
|
|
|
|
return (_keyDownMap[0x103] || _keyDownMap[0x119]) ? 1 : 0;
|
|
|
|
break;
|
|
|
|
case 0x152: // Ins
|
|
|
|
return (_keyDownMap[0x100] || _keyDownMap[0x115]) ? 1 : 0;
|
|
|
|
break;
|
|
|
|
case 0x153: // Del
|
|
|
|
return (_keyDownMap[0x10a] || _keyDownMap[0x7f]) ? 1 : 0;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (key >= 0x13b && key <= 0x144) { // F1-F10
|
|
|
|
key -= 0x13b - 0x11a;
|
|
|
|
} else if (key >= 0x154 && key <= 0x15d) { // Shift+F1-F10
|
|
|
|
key -= 0x154 - 0x11a; // map it to just F1-F10
|
|
|
|
|
|
|
|
warning("ScummEngine::getKeyState(%x) 'Shift-F%d' is probed", key, key-0x153);
|
|
|
|
} else if (key > 0x8000) { // Alt
|
|
|
|
key -= 0x8000;
|
|
|
|
key += 154; // see ScummEngine::parseEvents()
|
|
|
|
} else if (key > 0x4000) { // Ctrl
|
|
|
|
key -= 0x4000;
|
|
|
|
key -= 0x40;
|
|
|
|
} else if (key > 0x2000) { // Gray keys
|
|
|
|
key -= 0x2000;
|
|
|
|
warning("ScummEngine::getKeyState(%x) 'gray key' is probed", key);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (_keyDownMap[key]) ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_delayFrames() {
|
2001-10-16 10:01:48 +00:00
|
|
|
ScriptSlot *ss = &vm.slot[_currentScript];
|
2003-01-06 13:41:29 +00:00
|
|
|
if (ss->delayFrameCount == 0) {
|
2002-08-25 11:35:13 +00:00
|
|
|
ss->delayFrameCount = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
} else {
|
2002-08-25 11:35:13 +00:00
|
|
|
ss->delayFrameCount--;
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
2002-08-25 11:35:13 +00:00
|
|
|
if (ss->delayFrameCount) {
|
2001-10-16 10:01:48 +00:00
|
|
|
_scriptPointer--;
|
2001-10-23 19:51:50 +00:00
|
|
|
o6_breakHere();
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_pickOneOf() {
|
2002-12-25 14:46:39 +00:00
|
|
|
int args[100];
|
2002-04-11 17:19:16 +00:00
|
|
|
int i, num;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2003-05-18 21:03:57 +00:00
|
|
|
num = getStackList(args, ARRAYSIZE(args));
|
2001-10-16 10:01:48 +00:00
|
|
|
i = pop();
|
2003-05-19 04:29:41 +00:00
|
|
|
if (i < 0 || i > num)
|
|
|
|
error("o6_pickOneOf: %d out of range (0, %d)", i, num - 1);
|
2001-10-16 10:01:48 +00:00
|
|
|
push(args[i]);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_pickOneOfDefault() {
|
2002-12-25 14:46:39 +00:00
|
|
|
int args[100];
|
2002-04-11 17:19:16 +00:00
|
|
|
int i, num, def;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
|
|
|
def = pop();
|
2003-05-18 21:03:57 +00:00
|
|
|
num = getStackList(args, ARRAYSIZE(args));
|
2001-10-16 10:01:48 +00:00
|
|
|
i = pop();
|
2002-04-11 17:19:16 +00:00
|
|
|
if (i < 0 || i >= num)
|
2001-10-16 10:01:48 +00:00
|
|
|
i = def;
|
|
|
|
else
|
|
|
|
i = args[i];
|
|
|
|
push(i);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_stampObject() {
|
2003-02-22 20:57:57 +00:00
|
|
|
int object, x, y, state;
|
2003-09-26 17:55:50 +00:00
|
|
|
|
2003-12-30 07:34:15 +00:00
|
|
|
// dummy opcode in tentacle
|
2003-12-30 06:43:15 +00:00
|
|
|
if (_gameId == GID_TENTACLE)
|
|
|
|
return;
|
|
|
|
|
2003-09-26 17:55:50 +00:00
|
|
|
// V6 version
|
|
|
|
if (_version == 6) {
|
|
|
|
state = pop();
|
|
|
|
if (state == 0) {
|
|
|
|
state = 1;
|
|
|
|
}
|
|
|
|
y = pop();
|
|
|
|
x = pop();
|
|
|
|
object = pop();
|
|
|
|
int objnum = getObjectIndex(object);
|
|
|
|
if (objnum == -1)
|
|
|
|
return;
|
2003-12-30 06:26:52 +00:00
|
|
|
_objs[objnum].x_pos = x * 8;
|
|
|
|
_objs[objnum].y_pos = y * 8;
|
2003-12-30 06:24:47 +00:00
|
|
|
putState(object, state);
|
2003-09-26 17:55:50 +00:00
|
|
|
drawObject(objnum, 0);
|
|
|
|
return;
|
|
|
|
}
|
2003-02-22 20:57:57 +00:00
|
|
|
|
2003-09-26 17:55:50 +00:00
|
|
|
// V7 version
|
2003-02-22 20:57:57 +00:00
|
|
|
state = pop();
|
2003-02-16 14:52:25 +00:00
|
|
|
y = pop();
|
2003-02-22 20:57:57 +00:00
|
|
|
x = pop();
|
|
|
|
object = pop();
|
|
|
|
if (object < 30) {
|
|
|
|
if (state == 0) {
|
|
|
|
state = 255;
|
|
|
|
}
|
|
|
|
warning("o6_stampObject: (%d at (%d,%d) scale %d)", object, x, y, state);
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(object, "o6_stampObject");
|
2003-02-22 20:57:57 +00:00
|
|
|
a->scalex = state;
|
|
|
|
a->scaley = state;
|
|
|
|
a->putActor(x, y, _currentRoom); // TODO
|
2003-07-20 21:01:06 +00:00
|
|
|
a->drawActorCostume();
|
2003-02-22 20:57:57 +00:00
|
|
|
// drawActor(object, maskBufferPtr, x_y, scale_x_y);
|
|
|
|
// drawActor(object, mainBufferPtr, x_y, scale_x_y);
|
|
|
|
return;
|
|
|
|
}
|
2003-07-20 20:42:58 +00:00
|
|
|
|
|
|
|
if (object == 0) {
|
|
|
|
state = 1;
|
|
|
|
}
|
2003-02-22 20:57:57 +00:00
|
|
|
|
2003-07-20 20:42:58 +00:00
|
|
|
if (x != -1) {
|
|
|
|
setObjectState(object, state, x, y);
|
|
|
|
drawObject(getObjectIndex(object), 0);
|
|
|
|
warning("o6_stampObject: (%d at (%d,%d) state %d)", object, x, y, state);
|
|
|
|
}
|
2002-10-16 10:59:29 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_stopTalking() {
|
2003-02-17 10:14:43 +00:00
|
|
|
stopTalk();
|
2003-02-14 08:12:45 +00:00
|
|
|
}
|
|
|
|
|
2004-01-02 15:07:14 +00:00
|
|
|
// Humongous Entertainment games only
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_openFile() {
|
2003-09-13 16:25:33 +00:00
|
|
|
int mode, len, slot, l, r;
|
2003-09-13 12:37:21 +00:00
|
|
|
byte filename[100];
|
|
|
|
|
|
|
|
_msgPtrToAdd = filename;
|
2003-11-11 13:47:53 +00:00
|
|
|
_messagePtr = _scriptPointer;
|
2003-09-13 12:37:21 +00:00
|
|
|
addMessageToStack(_messagePtr);
|
|
|
|
|
2003-02-15 09:39:52 +00:00
|
|
|
len = resStrLen(_scriptPointer);
|
|
|
|
_scriptPointer += len + 1;
|
2003-09-13 16:25:33 +00:00
|
|
|
|
|
|
|
for (r = strlen((char*)filename); r != 0; r--) {
|
|
|
|
if (filename[r - 1] == '\\')
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-09-13 13:41:44 +00:00
|
|
|
mode = pop();
|
|
|
|
slot = -1;
|
2003-09-13 16:25:33 +00:00
|
|
|
for (l = 0; l < 17; l++) {
|
2003-09-13 13:41:44 +00:00
|
|
|
if (_hFileTable[l].isOpen() == false) {
|
|
|
|
slot = l;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (slot != -1) {
|
|
|
|
if (mode == 1)
|
2003-09-13 16:25:33 +00:00
|
|
|
_hFileTable[slot].open((char*)filename + r, getGameDataPath(), File::kFileReadMode);
|
2003-09-13 13:41:44 +00:00
|
|
|
else if (mode == 2)
|
2003-09-13 16:25:33 +00:00
|
|
|
_hFileTable[slot].open((char*)filename + r, getGameDataPath(), File::kFileWriteMode);
|
2003-09-13 13:41:44 +00:00
|
|
|
else
|
|
|
|
error("o6_openFile(): wrong open file mode");
|
|
|
|
|
2003-09-13 18:45:56 +00:00
|
|
|
warning("%d = o6_openFile(\"%s\", %d)", slot, filename + r, mode);
|
2003-09-13 13:41:44 +00:00
|
|
|
}
|
|
|
|
push(slot);
|
2003-02-15 09:39:52 +00:00
|
|
|
}
|
|
|
|
|
2004-01-02 15:07:14 +00:00
|
|
|
// Humongous Entertainment games only
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_closeFile() {
|
2003-09-13 13:41:44 +00:00
|
|
|
int slot = pop();
|
|
|
|
_hFileTable[slot].close();
|
|
|
|
warning("o6_closeFile(%d)", slot);
|
2003-02-15 09:39:52 +00:00
|
|
|
}
|
2003-03-06 17:58:13 +00:00
|
|
|
|
2004-01-02 15:07:14 +00:00
|
|
|
// Humongous Entertainment games only
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_deleteFile() {
|
2003-09-13 18:45:56 +00:00
|
|
|
int len, r;
|
2003-09-13 12:37:21 +00:00
|
|
|
byte filename[100];
|
|
|
|
|
|
|
|
_msgPtrToAdd = filename;
|
2003-11-11 13:47:53 +00:00
|
|
|
_messagePtr = _scriptPointer;
|
2003-09-13 12:37:21 +00:00
|
|
|
addMessageToStack(_messagePtr);
|
|
|
|
|
2003-02-15 09:39:52 +00:00
|
|
|
len = resStrLen(_scriptPointer);
|
|
|
|
_scriptPointer += len + 1;
|
2003-09-13 12:37:21 +00:00
|
|
|
|
2003-09-13 18:45:56 +00:00
|
|
|
for (r = strlen((char*)filename); r != 0; r--) {
|
|
|
|
if (filename[r - 1] == '\\')
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
warning("stub o6_deleteFile(\"%s\")", filename + r);
|
2003-02-15 09:39:52 +00:00
|
|
|
}
|
|
|
|
|
2004-01-02 15:07:14 +00:00
|
|
|
// Humongous Entertainment games only
|
2004-01-02 13:21:13 +00:00
|
|
|
void ScummEngine_v6::o6_rename() {
|
|
|
|
int len, r1, r2;
|
|
|
|
byte filename[100],filename2[100];
|
|
|
|
|
|
|
|
_msgPtrToAdd = filename;
|
|
|
|
_messagePtr = _scriptPointer;
|
|
|
|
addMessageToStack(_messagePtr);
|
|
|
|
|
|
|
|
len = resStrLen(_scriptPointer);
|
|
|
|
_scriptPointer += len + 1;
|
|
|
|
|
|
|
|
for (r1 = strlen((char*)filename); r1 != 0; r1--) {
|
|
|
|
if (filename[r1 - 1] == '\\')
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
_msgPtrToAdd = filename2;
|
|
|
|
_messagePtr = _scriptPointer;
|
|
|
|
addMessageToStack(_messagePtr);
|
|
|
|
|
|
|
|
len = resStrLen(_scriptPointer);
|
|
|
|
_scriptPointer += len + 1;
|
|
|
|
|
|
|
|
for (r2 = strlen((char*)filename2); r2 != 0; r2--) {
|
|
|
|
if (filename2[r2 - 1] == '\\')
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
warning("stub o6_rename(\"%s\" to \"%s\")", filename + r1, filename2 + r2);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
int ScummEngine_v6::readFileToArray(int slot, int32 size) {
|
2003-09-13 18:36:16 +00:00
|
|
|
if (size == 0)
|
|
|
|
size = _hFileTable[slot].size() - _hFileTable[slot].pos();
|
2003-09-13 16:25:33 +00:00
|
|
|
writeVar(0, 0);
|
2003-09-13 18:36:16 +00:00
|
|
|
defineArray(0, 3, 0, size);
|
2003-09-13 16:25:33 +00:00
|
|
|
byte *ptr = getResourceAddress(rtString, readVar(0));
|
2003-09-13 18:36:16 +00:00
|
|
|
_hFileTable[slot].read(ptr, size);
|
2003-09-13 16:25:33 +00:00
|
|
|
return readVar(0);
|
|
|
|
}
|
|
|
|
|
2004-01-02 15:07:14 +00:00
|
|
|
// Humongous Entertainment games only
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_readFile() {
|
2003-09-13 16:25:33 +00:00
|
|
|
int32 size = pop();
|
|
|
|
int slot = pop();
|
|
|
|
|
|
|
|
if (size == -2) {
|
|
|
|
push(_hFileTable[slot].readUint16LE());
|
|
|
|
} else if (size == -1) {
|
|
|
|
push(_hFileTable[slot].readByte());
|
|
|
|
} else {
|
|
|
|
push(readFileToArray(slot, size));
|
|
|
|
}
|
|
|
|
warning("o6_readFile(%d, %d)", slot, size);
|
2003-04-21 00:44:46 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::writeFileFromArray(int slot, int resID) {
|
2003-09-13 20:54:12 +00:00
|
|
|
byte *ptr = getResourceAddress(rtString, resID);
|
|
|
|
// FIXME: hack for proper size: / 2 - 5
|
|
|
|
int32 size = getResourceSize(rtString, resID) / 2 - 5;
|
|
|
|
_hFileTable[slot].write(ptr, size);
|
|
|
|
}
|
|
|
|
|
2004-01-02 15:07:14 +00:00
|
|
|
// Humongous Entertainment games only
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_writeFile() {
|
2003-09-13 20:54:12 +00:00
|
|
|
int32 size = pop();
|
|
|
|
int16 resID = pop();
|
|
|
|
int slot = pop();
|
|
|
|
|
|
|
|
if (size == -2) {
|
|
|
|
_hFileTable[slot].writeUint16LE(resID);
|
|
|
|
} else if (size == -1) {
|
|
|
|
_hFileTable[slot].writeByte(resID);
|
|
|
|
} else {
|
|
|
|
writeFileFromArray(slot, resID);
|
|
|
|
}
|
|
|
|
warning("o6_writeFile(%d, %d)", slot, resID);
|
|
|
|
}
|
|
|
|
|
2004-01-02 15:07:14 +00:00
|
|
|
// Humongous Entertainment games only
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_findAllObjects() {
|
2003-02-17 10:14:43 +00:00
|
|
|
int a = pop();
|
|
|
|
int i = 1;
|
|
|
|
|
|
|
|
if (a != _currentRoom)
|
|
|
|
warning("o6_findAllObjects: current room is not %d", a);
|
|
|
|
writeVar(0, 0);
|
2003-02-22 13:08:54 +00:00
|
|
|
defineArray(0, 5, 0, _numLocalObjects + 1);
|
2003-02-17 10:40:02 +00:00
|
|
|
writeArray(0, 0, 0, _numLocalObjects);
|
2003-02-17 10:14:43 +00:00
|
|
|
|
2003-06-07 00:49:36 +00:00
|
|
|
while (i < _numLocalObjects) {
|
2003-02-17 10:14:43 +00:00
|
|
|
writeArray(0, 0, i, _objs[i].obj_nr);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
push(readVar(0));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::shuffleArray(int num, int minIdx, int maxIdx) {
|
2003-03-07 21:38:46 +00:00
|
|
|
int range = maxIdx - minIdx;
|
|
|
|
int count = range * 2;
|
|
|
|
|
2003-03-07 21:49:06 +00:00
|
|
|
// Shuffle the array 'num'
|
2003-03-07 21:38:46 +00:00
|
|
|
while (count--) {
|
2003-03-07 21:49:06 +00:00
|
|
|
// Determine two random elements...
|
2003-03-07 21:38:46 +00:00
|
|
|
int rand1 = _rnd.getRandomNumber(range) + minIdx;
|
|
|
|
int rand2 = _rnd.getRandomNumber(range) + minIdx;
|
|
|
|
|
2003-03-07 21:49:06 +00:00
|
|
|
// ...and swap them
|
|
|
|
int val1 = readArray(num, 0, rand1);
|
|
|
|
int val2 = readArray(num, 0, rand2);
|
|
|
|
writeArray(num, 0, rand1, val2);
|
2003-03-07 21:54:45 +00:00
|
|
|
writeArray(num, 0, rand2, val1);
|
2003-03-02 12:35:27 +00:00
|
|
|
}
|
2003-02-20 21:05:56 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_shuffle() {
|
2003-03-07 21:38:46 +00:00
|
|
|
shuffleArray(fetchScriptWord(), pop(), pop());
|
2003-02-21 00:42:51 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_pickVarRandom() {
|
2003-02-19 01:42:21 +00:00
|
|
|
int num;
|
2003-02-20 21:05:56 +00:00
|
|
|
int args[100];
|
2003-02-22 11:56:25 +00:00
|
|
|
int var_C, var_A;
|
2003-02-17 21:42:33 +00:00
|
|
|
|
2003-05-18 21:03:57 +00:00
|
|
|
num = getStackList(args, ARRAYSIZE(args));
|
2003-02-22 11:56:25 +00:00
|
|
|
int value = fetchScriptWord();
|
2003-02-20 21:05:56 +00:00
|
|
|
|
|
|
|
if (readVar(value) == 0) {
|
|
|
|
defineArray(value, 5, 0, num);
|
|
|
|
if (num > 0) {
|
|
|
|
int16 counter = 0;
|
|
|
|
do {
|
2003-02-22 11:56:25 +00:00
|
|
|
writeArray(value, 0, counter + 1, args[counter]);
|
2003-02-20 21:05:56 +00:00
|
|
|
} while (++counter < num);
|
|
|
|
}
|
|
|
|
|
2003-03-07 21:38:46 +00:00
|
|
|
shuffleArray(value, 1, num);
|
2003-02-20 21:05:56 +00:00
|
|
|
writeArray(value, 0, 0, 2);
|
|
|
|
push(readArray(value, 0, 1));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
num = readArray(value, 0, 0);
|
2003-03-07 21:38:46 +00:00
|
|
|
|
|
|
|
byte *ptr = getResourceAddress(rtString, num);
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version >= 7) {
|
2003-03-07 21:38:46 +00:00
|
|
|
var_A = READ_LE_UINT32(ptr + 4);
|
|
|
|
var_C = READ_LE_UINT32(ptr + 8);
|
|
|
|
} else {
|
|
|
|
var_A = READ_LE_UINT16(ptr + 2);
|
|
|
|
var_C = READ_LE_UINT16(ptr + 4);
|
|
|
|
}
|
2003-02-20 21:05:56 +00:00
|
|
|
|
2003-03-07 21:51:30 +00:00
|
|
|
if (var_A <= num) {
|
2003-02-20 21:05:56 +00:00
|
|
|
int16 var_2 = readArray(value, 0, num - 1);
|
2003-03-07 21:38:46 +00:00
|
|
|
shuffleArray(value, 1, var_A - 1);
|
2003-02-22 11:56:25 +00:00
|
|
|
if (readArray(value, 0, 1) == var_2) {
|
2003-02-20 21:05:56 +00:00
|
|
|
num = 2;
|
2003-02-22 11:56:25 +00:00
|
|
|
} else {
|
|
|
|
num = 1;
|
2003-02-20 21:05:56 +00:00
|
|
|
}
|
|
|
|
}
|
2003-02-17 21:42:33 +00:00
|
|
|
|
2003-02-20 21:05:56 +00:00
|
|
|
writeArray(value, 0, 0, num + 1);
|
|
|
|
push(readArray(value, 0, num));
|
2003-02-17 21:42:33 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_getDateTime() {
|
2003-02-18 00:13:24 +00:00
|
|
|
struct tm *t;
|
|
|
|
time_t now = time(NULL);
|
|
|
|
|
|
|
|
t = localtime(&now);
|
|
|
|
|
2003-05-08 15:48:50 +00:00
|
|
|
VAR(VAR_TIMEDATE_YEAR) = t->tm_year;
|
|
|
|
VAR(VAR_TIMEDATE_MONTH) = t->tm_mon;
|
|
|
|
VAR(VAR_TIMEDATE_DAY) = t->tm_mday;
|
|
|
|
VAR(VAR_TIMEDATE_HOUR) = t->tm_hour;
|
|
|
|
VAR(VAR_TIMEDATE_MINUTE) = t->tm_min;
|
2003-02-18 00:13:24 +00:00
|
|
|
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version == 8)
|
2003-05-08 15:48:50 +00:00
|
|
|
VAR(VAR_TIMEDATE_SECOND) = t->tm_sec;
|
2003-02-18 00:13:24 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_unknownE1() {
|
2003-03-30 11:04:11 +00:00
|
|
|
// this opcode check ground area in minigame "Asteroid Lander" in the dig
|
2003-03-18 20:32:01 +00:00
|
|
|
int y = pop();
|
2003-03-30 12:34:36 +00:00
|
|
|
int x = pop();
|
2003-03-18 20:32:01 +00:00
|
|
|
|
2003-05-10 21:49:59 +00:00
|
|
|
if (x > _screenWidth - 1) {
|
2003-03-18 20:32:01 +00:00
|
|
|
push(-1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (x < 0) {
|
|
|
|
push(-1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (y < 0) {
|
|
|
|
push(-1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
VirtScreen *vs = findVirtScreen(y);
|
|
|
|
|
|
|
|
if (vs == NULL) {
|
|
|
|
push(-1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-01-04 13:09:02 +00:00
|
|
|
int offset = (y - vs->topline) * vs->width + x + _screenLeft;
|
2003-03-18 20:32:01 +00:00
|
|
|
|
2004-01-04 13:49:03 +00:00
|
|
|
byte area = *(vs->screenPtr + offset);
|
2003-03-18 20:32:01 +00:00
|
|
|
push(area);
|
|
|
|
}
|
|
|
|
|
2004-01-02 15:07:14 +00:00
|
|
|
// Humongous Entertainment games only
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_unknownE0() {
|
2003-02-22 12:27:50 +00:00
|
|
|
int a = fetchScriptByte();
|
|
|
|
a -= 222;
|
|
|
|
if (a != 0) {
|
|
|
|
a -= 2;
|
|
|
|
if (a != 0)
|
|
|
|
return;
|
2003-04-22 14:49:29 +00:00
|
|
|
warning("o6_unknownE0(%d) stub", pop());
|
2003-02-22 12:27:50 +00:00
|
|
|
} else {
|
2003-04-22 14:49:29 +00:00
|
|
|
warning("o6_uknownE0, sound volume %d stub", pop());
|
2003-02-22 12:27:50 +00:00
|
|
|
}
|
2003-02-18 23:59:54 +00:00
|
|
|
}
|
|
|
|
|
2004-01-02 15:07:14 +00:00
|
|
|
// Humongous Entertainment games only
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_unknownE4() {
|
2003-04-20 15:02:58 +00:00
|
|
|
warning("o6_unknownE4(%d) stub", pop());
|
|
|
|
}
|
2003-05-17 01:57:54 +00:00
|
|
|
|
2004-01-02 15:07:14 +00:00
|
|
|
// Humongous Entertainment games only
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_unknownFA() {
|
2003-05-17 01:57:54 +00:00
|
|
|
int len, a = fetchScriptByte();
|
|
|
|
|
|
|
|
len = resStrLen(_scriptPointer);
|
|
|
|
warning("stub o6_unknownFA(%d, \"%s\")", a, _scriptPointer);
|
|
|
|
_scriptPointer += len + 1;
|
|
|
|
}
|
|
|
|
|
2004-01-02 15:07:14 +00:00
|
|
|
// Humongous Entertainment games only
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_unknownEA() {
|
2003-05-19 04:29:41 +00:00
|
|
|
int edi, esi, eax;
|
|
|
|
edi = pop();
|
|
|
|
esi = pop();
|
|
|
|
|
2004-01-04 15:31:34 +00:00
|
|
|
if (edi == 0) {
|
2003-05-19 04:29:41 +00:00
|
|
|
eax = esi;
|
|
|
|
esi = edi;
|
|
|
|
edi = eax;
|
|
|
|
}
|
|
|
|
|
|
|
|
eax = fetchScriptByte();
|
|
|
|
switch (eax) {
|
2004-01-04 15:31:34 +00:00
|
|
|
case 199:
|
2003-09-24 06:33:59 +00:00
|
|
|
unknownEA_func(5, esi, edi, fetchScriptWord(), eax);
|
|
|
|
break;
|
|
|
|
case 202:
|
|
|
|
unknownEA_func(3, esi, edi, fetchScriptWord(), eax);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2003-05-19 04:29:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::unknownEA_func(int a, int b, int c, int d, int e) {
|
2004-01-04 15:31:34 +00:00
|
|
|
// Used in mini game at Cosmic Dust Diner in puttmoon
|
2003-07-13 16:22:17 +00:00
|
|
|
warning("unknownEA_func(%d, %d, %d, %d, %d) stub", a, b, c, d, e);
|
2003-05-19 04:29:41 +00:00
|
|
|
}
|
|
|
|
|
2004-01-02 15:07:14 +00:00
|
|
|
// Humongous Entertainment games only
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_readINI() {
|
2003-08-28 15:23:23 +00:00
|
|
|
int len;
|
|
|
|
|
|
|
|
len = resStrLen(_scriptPointer);
|
|
|
|
warning("stub o6_readINI(\"%s\")", _scriptPointer);
|
|
|
|
_scriptPointer += len + 1;
|
|
|
|
pop();
|
|
|
|
push(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-01-02 15:07:14 +00:00
|
|
|
// Humongous Entertainment games only
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::o6_localizeArray() {
|
2004-01-14 03:50:58 +00:00
|
|
|
int stringID = pop();
|
|
|
|
|
|
|
|
if (stringID < _numArray) {
|
|
|
|
_baseArrays[stringID][0] = (byte)_currentScript;
|
|
|
|
} else {
|
|
|
|
warning("o6_localizeArray(%d): too big scriptID", stringID);
|
|
|
|
}
|
2003-02-21 00:42:51 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v6::decodeParseString(int m, int n) {
|
2001-10-16 10:01:48 +00:00
|
|
|
byte b;
|
|
|
|
|
|
|
|
b = fetchScriptByte();
|
2002-04-11 17:19:16 +00:00
|
|
|
|
|
|
|
switch (b) {
|
2003-11-09 22:12:16 +00:00
|
|
|
case 65: // SO_AT
|
2002-09-22 01:17:53 +00:00
|
|
|
_string[m].ypos = pop();
|
|
|
|
_string[m].xpos = pop();
|
|
|
|
_string[m].overhead = false;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 66: // SO_COLOR
|
2002-09-22 01:17:53 +00:00
|
|
|
_string[m].color = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 67: // SO_CLIPPED
|
2002-09-22 01:17:53 +00:00
|
|
|
_string[m].right = pop();
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 69: // SO_CENTER
|
2002-09-22 01:17:53 +00:00
|
|
|
_string[m].center = true;
|
|
|
|
_string[m].overhead = false;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 71: // SO_LEFT
|
2002-09-22 01:17:53 +00:00
|
|
|
_string[m].center = false;
|
|
|
|
_string[m].overhead = false;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 72: // SO_OVERHEAD
|
2002-09-22 01:17:53 +00:00
|
|
|
_string[m].overhead = true;
|
|
|
|
_string[m].no_talk_anim = false;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 73: // SO_SAY_VOICE
|
2002-12-23 15:46:53 +00:00
|
|
|
error("decodeParseString: case 73");
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 74: // SO_MUMBLE
|
2002-09-22 01:17:53 +00:00
|
|
|
_string[m].no_talk_anim = true;
|
2001-10-16 10:01:48 +00:00
|
|
|
break;
|
2003-11-09 22:12:16 +00:00
|
|
|
case 75: // SO_TEXTSTRING
|
2003-07-15 21:30:53 +00:00
|
|
|
_messagePtr = translateTextAndPlaySpeech(_scriptPointer);
|
2003-05-31 21:42:33 +00:00
|
|
|
_scriptPointer += resStrLen(_scriptPointer)+ 1;
|
|
|
|
|
|
|
|
switch (m) {
|
|
|
|
case 0:
|
|
|
|
actorTalk();
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
drawString(1);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
unkMessage1();
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
unkMessage2();
|
|
|
|
break;
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
2003-05-31 21:42:33 +00:00
|
|
|
return;
|
2003-09-03 08:55:24 +00:00
|
|
|
case 0xF9:
|
|
|
|
error("decodeParseString case 0xF9 stub");
|
|
|
|
return;
|
2001-10-16 10:01:48 +00:00
|
|
|
case 0xFE:
|
|
|
|
setStringVars(m);
|
|
|
|
if (n)
|
|
|
|
_actorToPrintStrFor = pop();
|
|
|
|
return;
|
|
|
|
case 0xFF:
|
2002-09-22 01:17:53 +00:00
|
|
|
_string[m].t_xpos = _string[m].xpos;
|
|
|
|
_string[m].t_ypos = _string[m].ypos;
|
|
|
|
_string[m].t_center = _string[m].center;
|
|
|
|
_string[m].t_overhead = _string[m].overhead;
|
|
|
|
_string[m].t_no_talk_anim = _string[m].no_talk_anim;
|
|
|
|
_string[m].t_right = _string[m].right;
|
|
|
|
_string[m].t_color = _string[m].color;
|
|
|
|
_string[m].t_charset = _string[m].charset;
|
2001-10-16 10:01:48 +00:00
|
|
|
return;
|
|
|
|
default:
|
2003-08-28 15:23:23 +00:00
|
|
|
error("decodeParseString: default case 0x%x", b);
|
2001-10-16 10:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
2003-10-03 18:33:57 +00:00
|
|
|
|
|
|
|
} // End of namespace Scumm
|