2004-09-06 00:58:40 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
|
|
|
* Copyright (C) 2001-2004 The ScummVM project
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
|
|
|
#include "common/config-manager.h"
|
|
|
|
|
|
|
|
#include "scumm/actor.h"
|
|
|
|
#include "scumm/charset.h"
|
|
|
|
#include "scumm/intern.h"
|
|
|
|
#include "scumm/object.h"
|
|
|
|
#include "scumm/resource.h"
|
|
|
|
#include "scumm/resource_v7he.h"
|
|
|
|
#include "scumm/scumm.h"
|
|
|
|
#include "scumm/sound.h"
|
|
|
|
|
|
|
|
#include "sound/mididrv.h"
|
|
|
|
#include "sound/mixer.h"
|
|
|
|
|
|
|
|
namespace Scumm {
|
|
|
|
|
|
|
|
#define OPCODE(x) { &ScummEngine_v90he::x, #x }
|
|
|
|
|
|
|
|
void ScummEngine_v90he::setupOpcodes() {
|
|
|
|
static const OpcodeEntryV90he opcodes[256] = {
|
|
|
|
/* 00 */
|
|
|
|
OPCODE(o6_pushByte),
|
|
|
|
OPCODE(o6_pushWord),
|
|
|
|
OPCODE(o72_pushDWord),
|
|
|
|
OPCODE(o6_pushWordVar),
|
|
|
|
/* 04 */
|
|
|
|
OPCODE(o72_addMessageToStack),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2004-09-20 19:19:57 +00:00
|
|
|
OPCODE(o6_wordArrayRead),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 08 */
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2004-09-23 09:11:52 +00:00
|
|
|
OPCODE(o90_dup),
|
2004-09-20 19:19:57 +00:00
|
|
|
OPCODE(o6_wordArrayIndexedRead),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 0C */
|
|
|
|
OPCODE(o6_dup),
|
|
|
|
OPCODE(o6_not),
|
|
|
|
OPCODE(o6_eq),
|
|
|
|
OPCODE(o6_neq),
|
|
|
|
/* 10 */
|
|
|
|
OPCODE(o6_gt),
|
|
|
|
OPCODE(o6_lt),
|
|
|
|
OPCODE(o6_le),
|
|
|
|
OPCODE(o6_ge),
|
|
|
|
/* 14 */
|
|
|
|
OPCODE(o6_add),
|
|
|
|
OPCODE(o6_sub),
|
|
|
|
OPCODE(o6_mul),
|
|
|
|
OPCODE(o6_div),
|
|
|
|
/* 18 */
|
|
|
|
OPCODE(o6_land),
|
|
|
|
OPCODE(o6_lor),
|
|
|
|
OPCODE(o6_pop),
|
2004-09-17 11:20:37 +00:00
|
|
|
OPCODE(o72_isAnyOf),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 1C */
|
2004-10-02 01:08:31 +00:00
|
|
|
OPCODE(o90_wizImageOps),
|
2004-10-08 17:56:08 +00:00
|
|
|
OPCODE(o90_min),
|
|
|
|
OPCODE(o90_max),
|
2004-10-03 19:57:19 +00:00
|
|
|
OPCODE(o90_sin),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 20 */
|
2004-10-03 19:57:19 +00:00
|
|
|
OPCODE(o90_cos),
|
2004-10-08 17:56:08 +00:00
|
|
|
OPCODE(o90_sqrt),
|
|
|
|
OPCODE(o90_atan2),
|
|
|
|
OPCODE(o90_getSegmentAngle),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 24 */
|
2004-10-10 06:32:02 +00:00
|
|
|
OPCODE(o90_unknown24),
|
2004-09-06 01:19:38 +00:00
|
|
|
OPCODE(o90_unknown25),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o90_unknown26),
|
2004-09-06 08:53:19 +00:00
|
|
|
OPCODE(o90_unknown27),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 28 */
|
2004-09-06 02:39:02 +00:00
|
|
|
OPCODE(o90_unknown28),
|
2004-09-07 03:42:15 +00:00
|
|
|
OPCODE(o90_unknown29),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_invalid),
|
2004-10-10 05:49:30 +00:00
|
|
|
OPCODE(o90_startScriptUnk),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 2C */
|
2004-10-10 05:49:30 +00:00
|
|
|
OPCODE(o90_jumpToScriptUnk),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2004-09-10 14:31:20 +00:00
|
|
|
OPCODE(o90_unknown2F),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 30 */
|
2004-09-12 10:23:20 +00:00
|
|
|
OPCODE(o90_mod),
|
2004-09-30 09:35:02 +00:00
|
|
|
OPCODE(o90_unknown31),
|
|
|
|
OPCODE(o90_unknown32),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
/* 34 */
|
2004-10-03 05:29:31 +00:00
|
|
|
OPCODE(o90_findAllObjectsWithClassOf),
|
2004-10-04 02:23:02 +00:00
|
|
|
OPCODE(o90_getPolygonOverlap),
|
2004-09-12 11:15:26 +00:00
|
|
|
OPCODE(o90_unknown36),
|
2004-10-04 01:34:29 +00:00
|
|
|
OPCODE(o90_dim2dim2Array),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 38 */
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
2004-10-04 02:23:02 +00:00
|
|
|
OPCODE(o90_sortArray),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
/* 3C */
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
/* 40 */
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_writeWordVar),
|
|
|
|
/* 44 */
|
2004-10-04 02:23:02 +00:00
|
|
|
OPCODE(o90_getObjectData),
|
2004-09-11 00:49:22 +00:00
|
|
|
OPCODE(o80_unknown45),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_invalid),
|
2004-09-20 19:19:57 +00:00
|
|
|
OPCODE(o6_wordArrayWrite),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 48 */
|
2004-09-17 05:43:37 +00:00
|
|
|
OPCODE(o80_unknown48),
|
2004-09-06 01:54:24 +00:00
|
|
|
OPCODE(o80_unknown49),
|
2004-10-10 05:49:30 +00:00
|
|
|
OPCODE(o80_localizeArrayToRoom),
|
2004-09-20 19:19:57 +00:00
|
|
|
OPCODE(o6_wordArrayIndexedWrite),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 4C */
|
|
|
|
OPCODE(o6_invalid),
|
2004-09-13 04:45:21 +00:00
|
|
|
OPCODE(o80_readConfigFile),
|
|
|
|
OPCODE(o80_writeConfigFile),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_wordVarInc),
|
|
|
|
/* 50 */
|
|
|
|
OPCODE(o72_unknown50),
|
|
|
|
OPCODE(o6_invalid),
|
2004-09-14 15:06:02 +00:00
|
|
|
OPCODE(o72_findObjectWithClassOf),
|
2004-10-13 10:55:50 +00:00
|
|
|
OPCODE(o6_wordArrayInc),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 54 */
|
2004-10-08 07:13:13 +00:00
|
|
|
OPCODE(o72_getObjectImageX),
|
|
|
|
OPCODE(o72_getObjectImageY),
|
2004-10-08 22:58:49 +00:00
|
|
|
OPCODE(o72_captureWizImage),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_wordVarDec),
|
|
|
|
/* 58 */
|
|
|
|
OPCODE(o72_getTimer),
|
|
|
|
OPCODE(o72_setTimer),
|
|
|
|
OPCODE(o72_unknown5A),
|
2004-10-13 10:55:50 +00:00
|
|
|
OPCODE(o6_wordArrayDec),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 5C */
|
|
|
|
OPCODE(o6_if),
|
|
|
|
OPCODE(o6_ifNot),
|
|
|
|
OPCODE(o72_startScript),
|
|
|
|
OPCODE(o6_startScriptQuick),
|
|
|
|
/* 60 */
|
|
|
|
OPCODE(o72_startObject),
|
|
|
|
OPCODE(o72_drawObject),
|
|
|
|
OPCODE(o72_printWizImage),
|
|
|
|
OPCODE(o72_getArrayDimSize),
|
|
|
|
/* 64 */
|
|
|
|
OPCODE(o72_getNumFreeArrays),
|
|
|
|
OPCODE(o6_stopObjectCode),
|
|
|
|
OPCODE(o6_stopObjectCode),
|
|
|
|
OPCODE(o6_endCutscene),
|
|
|
|
/* 68 */
|
|
|
|
OPCODE(o6_cutscene),
|
2004-09-22 02:07:14 +00:00
|
|
|
OPCODE(o6_invalid),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_freezeUnfreeze),
|
2004-09-09 01:53:23 +00:00
|
|
|
OPCODE(o80_cursorCommand),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 6C */
|
|
|
|
OPCODE(o6_breakHere),
|
|
|
|
OPCODE(o6_ifClassOfIs),
|
|
|
|
OPCODE(o6_setClass),
|
|
|
|
OPCODE(o6_getState),
|
|
|
|
/* 70 */
|
2004-09-06 01:54:24 +00:00
|
|
|
OPCODE(o80_setState),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_setOwner),
|
|
|
|
OPCODE(o6_getOwner),
|
|
|
|
OPCODE(o6_jump),
|
|
|
|
/* 74 */
|
2004-09-21 01:00:30 +00:00
|
|
|
OPCODE(o70_startSound),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_stopSound),
|
2004-10-09 05:15:12 +00:00
|
|
|
OPCODE(o6_invalid),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_stopObjectScript),
|
|
|
|
/* 78 */
|
|
|
|
OPCODE(o6_panCameraTo),
|
|
|
|
OPCODE(o6_actorFollowCamera),
|
|
|
|
OPCODE(o6_setCameraAt),
|
|
|
|
OPCODE(o6_loadRoom),
|
|
|
|
/* 7C */
|
|
|
|
OPCODE(o6_stopScript),
|
|
|
|
OPCODE(o6_walkActorToObj),
|
|
|
|
OPCODE(o6_walkActorTo),
|
|
|
|
OPCODE(o6_putActorAtXY),
|
|
|
|
/* 80 */
|
|
|
|
OPCODE(o6_putActorAtObject),
|
|
|
|
OPCODE(o6_faceActor),
|
|
|
|
OPCODE(o6_animateActor),
|
|
|
|
OPCODE(o6_doSentence),
|
|
|
|
/* 84 */
|
2004-09-21 01:00:30 +00:00
|
|
|
OPCODE(o70_pickupObject),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_loadRoomWithEgo),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_getRandomNumber),
|
|
|
|
/* 88 */
|
|
|
|
OPCODE(o6_getRandomNumberRange),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_getActorMoving),
|
|
|
|
OPCODE(o6_isScriptRunning),
|
|
|
|
/* 8C */
|
2004-09-21 01:00:30 +00:00
|
|
|
OPCODE(o70_getActorRoom),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_getObjectX),
|
|
|
|
OPCODE(o6_getObjectY),
|
|
|
|
OPCODE(o6_getObjectOldDir),
|
|
|
|
/* 90 */
|
|
|
|
OPCODE(o6_getActorWalkBox),
|
|
|
|
OPCODE(o6_getActorCostume),
|
|
|
|
OPCODE(o6_findInventory),
|
|
|
|
OPCODE(o6_getInventoryCount),
|
|
|
|
/* 94 */
|
2004-10-04 02:23:02 +00:00
|
|
|
OPCODE(o90_getPaletteData),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_beginOverride),
|
|
|
|
OPCODE(o6_endOverride),
|
|
|
|
OPCODE(o6_setObjectName),
|
|
|
|
/* 98 */
|
|
|
|
OPCODE(o6_isSoundRunning),
|
|
|
|
OPCODE(o6_setBoxFlags),
|
|
|
|
OPCODE(o6_invalid),
|
2004-09-21 01:00:30 +00:00
|
|
|
OPCODE(o70_resourceRoutines),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 9C */
|
2004-09-29 11:25:21 +00:00
|
|
|
OPCODE(o72_roomOps),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o72_actorOps),
|
2004-10-04 02:23:02 +00:00
|
|
|
OPCODE(o90_paletteOps),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_getActorFromXY),
|
|
|
|
/* A0 */
|
2004-09-14 15:06:02 +00:00
|
|
|
OPCODE(o72_findObject),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_pseudoRoom),
|
|
|
|
OPCODE(o6_getActorElevation),
|
|
|
|
OPCODE(o6_getVerbEntrypoint),
|
|
|
|
/* A4 */
|
|
|
|
OPCODE(o72_arrayOps),
|
2004-10-01 23:56:39 +00:00
|
|
|
OPCODE(o90_unknownA5),
|
2004-10-05 05:52:48 +00:00
|
|
|
OPCODE(o80_drawBox),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_pop),
|
|
|
|
/* A8 */
|
|
|
|
OPCODE(o6_getActorWidth),
|
2004-09-21 01:00:30 +00:00
|
|
|
OPCODE(o60_wait),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_getActorScaleX),
|
2004-09-21 05:59:26 +00:00
|
|
|
OPCODE(o90_getActorAnimProgress),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* AC */
|
2004-09-14 07:59:40 +00:00
|
|
|
OPCODE(o80_drawWizPolygon),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_isAnyOf),
|
2004-09-21 01:00:30 +00:00
|
|
|
OPCODE(o70_quitPauseRestart),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_isActorInBox),
|
|
|
|
/* B0 */
|
|
|
|
OPCODE(o6_delay),
|
|
|
|
OPCODE(o6_delaySeconds),
|
|
|
|
OPCODE(o6_delayMinutes),
|
|
|
|
OPCODE(o6_stopSentence),
|
|
|
|
/* B4 */
|
|
|
|
OPCODE(o6_printLine),
|
|
|
|
OPCODE(o6_printCursor),
|
|
|
|
OPCODE(o6_printDebug),
|
|
|
|
OPCODE(o6_printSystem),
|
|
|
|
/* B8 */
|
|
|
|
OPCODE(o6_printActor),
|
|
|
|
OPCODE(o6_printEgo),
|
|
|
|
OPCODE(o6_talkActor),
|
|
|
|
OPCODE(o6_talkEgo),
|
|
|
|
/* BC */
|
|
|
|
OPCODE(o72_dimArray),
|
2004-09-15 12:40:49 +00:00
|
|
|
OPCODE(o6_stopObjectCode),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_startObjectQuick),
|
|
|
|
OPCODE(o6_startScriptQuick2),
|
|
|
|
/* C0 */
|
|
|
|
OPCODE(o72_dim2dimArray),
|
2004-09-21 01:00:30 +00:00
|
|
|
OPCODE(o72_traceStatus),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
/* C4 */
|
|
|
|
OPCODE(o6_abs),
|
|
|
|
OPCODE(o6_distObjectObject),
|
|
|
|
OPCODE(o6_distObjectPt),
|
|
|
|
OPCODE(o6_distPtPt),
|
|
|
|
/* C8 */
|
2004-10-04 00:01:06 +00:00
|
|
|
OPCODE(o72_kernelGetFunctions),
|
2004-09-21 01:00:30 +00:00
|
|
|
OPCODE(o70_kernelSetFunctions),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_delayFrames),
|
|
|
|
OPCODE(o6_pickOneOf),
|
|
|
|
/* CC */
|
|
|
|
OPCODE(o6_pickOneOfDefault),
|
|
|
|
OPCODE(o6_stampObject),
|
|
|
|
OPCODE(o72_drawWizImage),
|
2004-10-02 00:12:09 +00:00
|
|
|
OPCODE(o72_unknownCF),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* D0 */
|
|
|
|
OPCODE(o6_getDateTime),
|
|
|
|
OPCODE(o6_stopTalking),
|
|
|
|
OPCODE(o6_getAnimateVariable),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
/* D4 */
|
2004-09-20 19:48:08 +00:00
|
|
|
OPCODE(o6_shuffle),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o72_jumpToScript),
|
|
|
|
OPCODE(o6_band),
|
|
|
|
OPCODE(o6_bor),
|
|
|
|
/* D8 */
|
|
|
|
OPCODE(o6_isRoomScriptRunning),
|
2004-09-21 01:00:30 +00:00
|
|
|
OPCODE(o60_closeFile),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o72_openFile),
|
|
|
|
OPCODE(o72_readFile),
|
|
|
|
/* DC */
|
|
|
|
OPCODE(o72_writeFile),
|
|
|
|
OPCODE(o72_findAllObjects),
|
|
|
|
OPCODE(o72_deleteFile),
|
2004-09-21 01:00:30 +00:00
|
|
|
OPCODE(o60_rename),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* E0 */
|
2004-10-03 23:37:34 +00:00
|
|
|
OPCODE(o80_unknownE0),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o72_getPixel),
|
2004-10-10 05:49:30 +00:00
|
|
|
OPCODE(o60_localizeArrayToScript),
|
2004-09-16 23:34:26 +00:00
|
|
|
OPCODE(o80_pickVarRandom),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* E4 */
|
|
|
|
OPCODE(o6_setBoxSet),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
/* E8 */
|
|
|
|
OPCODE(o6_invalid),
|
2004-09-21 01:00:30 +00:00
|
|
|
OPCODE(o60_seekFilePos),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o72_redimArray),
|
2004-09-21 01:00:30 +00:00
|
|
|
OPCODE(o60_readFilePos),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* EC */
|
2004-09-09 04:05:31 +00:00
|
|
|
OPCODE(o72_unknownEC),
|
2004-10-13 10:55:50 +00:00
|
|
|
OPCODE(o70_unknownED),
|
2004-09-21 01:00:30 +00:00
|
|
|
OPCODE(o70_stringLen),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o72_unknownEF),
|
|
|
|
/* F0 */
|
2004-09-09 04:05:31 +00:00
|
|
|
OPCODE(o72_unknownF0),
|
2004-10-13 10:55:50 +00:00
|
|
|
OPCODE(o70_unknownF1),
|
2004-09-07 09:25:37 +00:00
|
|
|
OPCODE(o72_checkGlobQueue),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o72_readINI),
|
|
|
|
/* F4 */
|
|
|
|
OPCODE(o72_writeINI),
|
2004-10-13 10:55:50 +00:00
|
|
|
OPCODE(o70_unknownF5),
|
|
|
|
OPCODE(o70_unknownF6),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
/* F8 */
|
2004-10-03 14:13:05 +00:00
|
|
|
OPCODE(o72_getResourceSize),
|
2004-09-10 10:55:43 +00:00
|
|
|
OPCODE(o72_setFilePath),
|
2004-10-13 09:39:59 +00:00
|
|
|
OPCODE(o72_setWindowCaption),
|
2004-09-21 01:00:30 +00:00
|
|
|
OPCODE(o70_polygonOps),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* FC */
|
2004-09-21 01:00:30 +00:00
|
|
|
OPCODE(o70_polygonHit),
|
2004-09-06 00:58:40 +00:00
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
OPCODE(o6_invalid),
|
|
|
|
};
|
|
|
|
|
|
|
|
_opcodesV90he = opcodes;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v90he::executeOpcode(byte i) {
|
|
|
|
OpcodeProcV90he op = _opcodesV90he[i].proc;
|
|
|
|
(this->*op) ();
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *ScummEngine_v90he::getOpcodeDesc(byte i) {
|
|
|
|
return _opcodesV90he[i].desc;
|
|
|
|
}
|
|
|
|
|
2004-09-23 09:11:52 +00:00
|
|
|
void ScummEngine_v90he::o90_dup() {
|
|
|
|
int a, num;
|
|
|
|
|
|
|
|
num = fetchScriptWord();
|
|
|
|
for (int i = 0; i < num; i++) {
|
|
|
|
a = pop();
|
|
|
|
push(a);
|
|
|
|
push(a);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-10-08 17:56:08 +00:00
|
|
|
void ScummEngine_v90he::o90_min() {
|
2004-09-12 00:48:16 +00:00
|
|
|
int a = pop();
|
|
|
|
int b = pop();
|
|
|
|
|
|
|
|
if (b < a) {
|
|
|
|
push(b);
|
|
|
|
} else {
|
|
|
|
push(a);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-10-08 17:56:08 +00:00
|
|
|
void ScummEngine_v90he::o90_max() {
|
2004-09-12 00:48:16 +00:00
|
|
|
int a = pop();
|
|
|
|
int b = pop();
|
|
|
|
|
|
|
|
if (b > a) {
|
|
|
|
push(b);
|
|
|
|
} else {
|
|
|
|
push(a);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-10-03 19:57:19 +00:00
|
|
|
void ScummEngine_v90he::o90_sin() {
|
2004-10-06 10:14:31 +00:00
|
|
|
double a = pop() * PI / 180.;
|
2004-10-03 19:57:19 +00:00
|
|
|
push((int)(sin(a) * 100000));
|
2004-10-02 01:08:31 +00:00
|
|
|
}
|
|
|
|
|
2004-10-03 19:57:19 +00:00
|
|
|
void ScummEngine_v90he::o90_cos() {
|
2004-10-06 10:14:31 +00:00
|
|
|
double a = pop() * PI / 180.;
|
2004-10-03 19:57:19 +00:00
|
|
|
push((int)(cos(a) * 100000));
|
2004-10-02 01:08:31 +00:00
|
|
|
}
|
|
|
|
|
2004-10-08 17:56:08 +00:00
|
|
|
void ScummEngine_v90he::o90_sqrt() {
|
|
|
|
int i = pop();
|
|
|
|
if (i < 2) {
|
|
|
|
push(i);
|
|
|
|
} else {
|
2004-10-16 20:38:37 +00:00
|
|
|
push((int)sqrt((double)(i + 1)));
|
2004-10-08 17:56:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v90he::o90_atan2() {
|
|
|
|
int y = pop();
|
|
|
|
int x = pop();
|
2004-10-16 20:38:37 +00:00
|
|
|
int a = (int)(atan2((double)y, (double)x) * 180. / PI);
|
2004-10-08 17:56:08 +00:00
|
|
|
if (a < 0) {
|
|
|
|
a += 360;
|
|
|
|
}
|
|
|
|
push(a);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v90he::o90_getSegmentAngle() {
|
|
|
|
int y1 = pop();
|
|
|
|
int x1 = pop();
|
|
|
|
int dy = y1 - pop();
|
|
|
|
int dx = x1 - pop();
|
2004-10-16 20:38:37 +00:00
|
|
|
int a = (int)(atan2((double)dy, (double)dx) * 180. / PI);
|
2004-10-08 17:56:08 +00:00
|
|
|
if (a < 0) {
|
|
|
|
a += 360;
|
|
|
|
}
|
|
|
|
push(a);
|
|
|
|
}
|
|
|
|
|
2004-10-10 05:49:30 +00:00
|
|
|
void ScummEngine_v90he::o90_startScriptUnk() {
|
2004-10-16 05:10:15 +00:00
|
|
|
int args[24];
|
2004-10-10 05:49:30 +00:00
|
|
|
int script, cycle;
|
|
|
|
byte flags;
|
|
|
|
|
|
|
|
getStackList(args, ARRAYSIZE(args));
|
|
|
|
cycle = pop();
|
|
|
|
script = pop();
|
|
|
|
flags = fetchScriptByte();
|
|
|
|
runScript(script, (flags == 199 || flags == 200), (flags == 195 || flags == 200), args);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v90he::o90_jumpToScriptUnk() {
|
2004-10-16 05:10:15 +00:00
|
|
|
int args[24];
|
2004-10-10 05:49:30 +00:00
|
|
|
int script, cycle;
|
|
|
|
byte flags;
|
|
|
|
|
2004-09-12 00:48:16 +00:00
|
|
|
getStackList(args, ARRAYSIZE(args));
|
2004-10-10 05:49:30 +00:00
|
|
|
cycle = pop();
|
2004-09-12 00:48:16 +00:00
|
|
|
script = pop();
|
|
|
|
flags = fetchScriptByte();
|
2004-10-10 05:49:30 +00:00
|
|
|
stopObjectCode();
|
2004-09-12 00:48:16 +00:00
|
|
|
runScript(script, (flags == 199 || flags == 200), (flags == 195 || flags == 200), args);
|
|
|
|
}
|
|
|
|
|
2004-10-08 22:58:49 +00:00
|
|
|
void ScummEngine_v90he::drawWizComplexPolygon(int resnum, int state, int po_x, int po_y, int arg14, int angle, int zoom, const Common::Rect *r) {
|
|
|
|
Common::Point pts[4];
|
2004-10-16 20:38:37 +00:00
|
|
|
int32 w, h;
|
2004-10-08 22:58:49 +00:00
|
|
|
getWizImageDim(resnum, state, w, h);
|
|
|
|
|
|
|
|
pts[1].x = pts[2].x = w / 2 - 1;
|
|
|
|
pts[0].x = pts[0].y = pts[1].y = pts[3].x = -w / 2;
|
|
|
|
pts[2].y = pts[3].y = h / 2 - 1;
|
|
|
|
|
|
|
|
// transform points
|
|
|
|
if (zoom != 256) {
|
|
|
|
for (int i = 0; i < 4; ++i) {
|
|
|
|
pts[i].x = pts[i].x * zoom / 256;
|
|
|
|
pts[i].y = pts[i].y * zoom / 256;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (angle != 0) {
|
|
|
|
double alpha = angle * PI / 180.;
|
|
|
|
double cos_alpha = cos(alpha);
|
|
|
|
double sin_alpha = sin(alpha);
|
|
|
|
for (int i = 0; i < 4; ++i) {
|
|
|
|
int16 x = pts[i].x;
|
|
|
|
int16 y = pts[i].y;
|
|
|
|
pts[i].x = (int16)(x * cos_alpha - y * sin_alpha);
|
|
|
|
pts[i].y = (int16)(y * cos_alpha + x * sin_alpha);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int i = 0; i < 4; ++i) {
|
|
|
|
pts[i].x += po_x;
|
|
|
|
pts[i].y += po_y;
|
|
|
|
}
|
|
|
|
// XXX drawWizPolygonPoints(resnum, state, pts, r, VAR(117));
|
|
|
|
warning("ScummEngine_v90he::drawWizComplexPolygon() partially implemented");
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v90he::displayWizComplexImage(const WizParameters *params) {
|
|
|
|
// XXX merge with ScummEngine_v72he::displayWizImage
|
|
|
|
int zoom = 256;
|
|
|
|
if (params->processFlags & 0x8) {
|
|
|
|
zoom = params->zoom;
|
|
|
|
}
|
|
|
|
int rotationAngle = 0;
|
|
|
|
if (params->processFlags & 0x10) {
|
|
|
|
rotationAngle = params->angle;
|
|
|
|
}
|
|
|
|
int state = 0;
|
|
|
|
if (params->processFlags & 0x400) {
|
|
|
|
state = params->img.state;
|
|
|
|
}
|
|
|
|
int flags = 0;
|
|
|
|
if (params->processFlags & 0x20) {
|
|
|
|
flags = params->img.flags;
|
|
|
|
}
|
|
|
|
int po_x = 0;
|
|
|
|
int po_y = 0;
|
|
|
|
if (params->processFlags & 0x1) {
|
|
|
|
po_x = params->img.x1;
|
|
|
|
po_y = params->img.y1;
|
|
|
|
}
|
|
|
|
int unk = 0;
|
|
|
|
if (params->processFlags & 0x4) {
|
|
|
|
unk = params->unk_15C;
|
|
|
|
}
|
|
|
|
const Common::Rect *r = NULL;
|
|
|
|
if (params->processFlags & 0x200) {
|
|
|
|
r = ¶ms->box;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_fullRedraw) {
|
|
|
|
assert(_wizImagesNum < ARRAYSIZE(_wizImages));
|
|
|
|
WizImage *pwi = &_wizImages[_wizImagesNum];
|
|
|
|
pwi->resNum = params->img.resNum;
|
|
|
|
pwi->x1 = po_x;
|
|
|
|
pwi->y1 = po_y;
|
|
|
|
pwi->state = state;
|
|
|
|
pwi->flags = flags;
|
|
|
|
pwi->unk = unk;
|
|
|
|
++_wizImagesNum;
|
|
|
|
} else if (params->processFlags & 0x18) {
|
|
|
|
drawWizComplexPolygon(params->img.resNum, state, po_x, po_y, unk, rotationAngle, zoom, r);
|
|
|
|
} else if (flags & 0x40) {
|
|
|
|
drawWizPolygon(params->img.resNum, state, po_x, flags); // XXX , VAR(117));
|
|
|
|
} else {
|
|
|
|
// XXX flags 0x200, 0x24
|
|
|
|
WizImage wi;
|
|
|
|
wi.resNum = params->img.resNum;
|
|
|
|
wi.x1 = po_x;
|
|
|
|
wi.y1 = po_y;
|
|
|
|
wi.state = state;
|
|
|
|
wi.flags = flags;
|
|
|
|
wi.unk = unk;
|
|
|
|
drawWizImage(rtImage, &wi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v90he::processWizImage(const WizParameters *params) {
|
|
|
|
debug(1, "ScummEngine_v90he::processWizImage()");
|
|
|
|
switch (params->processMode) {
|
2004-09-26 15:29:58 +00:00
|
|
|
case 1:
|
2004-10-08 22:58:49 +00:00
|
|
|
displayWizComplexImage(params);
|
2004-09-26 15:29:58 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2004-10-09 16:41:35 +00:00
|
|
|
if (params->processFlags & 0x800) {
|
|
|
|
File f;
|
|
|
|
if (!f.open((const char *)params->filename, File::kFileReadMode)) {
|
|
|
|
warning("Unable to open for read '%s'", params->filename);
|
|
|
|
} else {
|
|
|
|
uint32 id = f.readUint32BE();
|
|
|
|
if (id != MKID('AWIZ') && id != MKID('MULT')) {
|
2004-10-10 06:48:00 +00:00
|
|
|
VAR(VAR_GAME_LOADED) = -1;
|
2004-10-09 16:41:35 +00:00
|
|
|
} else {
|
|
|
|
uint32 size = f.readUint32BE();
|
|
|
|
f.seek(0, SEEK_SET);
|
|
|
|
byte *p = createResource(rtImage, params->img.resNum, size);
|
|
|
|
if (f.read(p, size) != size) {
|
|
|
|
nukeResource(rtImage, params->img.resNum);
|
|
|
|
warning("i/o error when reading '%s'", params->filename);
|
2004-10-10 06:48:00 +00:00
|
|
|
VAR(VAR_GAME_LOADED) = -2;
|
2004-10-09 16:41:35 +00:00
|
|
|
} else {
|
2004-10-10 06:48:00 +00:00
|
|
|
VAR(VAR_GAME_LOADED) = 0;
|
2004-10-09 16:41:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
f.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2004-09-26 15:29:58 +00:00
|
|
|
case 4:
|
2004-10-09 16:41:35 +00:00
|
|
|
if (params->processFlags & 0x800) {
|
|
|
|
if (params->unk_14C != 0) {
|
2004-10-10 06:48:00 +00:00
|
|
|
VAR(119) = -1;
|
2004-10-09 16:41:35 +00:00
|
|
|
} else {
|
|
|
|
File f;
|
|
|
|
if (!f.open((const char *)params->filename, File::kFileWriteMode)) {
|
|
|
|
warning("Unable to open for write '%s'", params->filename);
|
2004-10-10 06:48:00 +00:00
|
|
|
VAR(119) = -3;
|
2004-10-09 16:41:35 +00:00
|
|
|
} else {
|
|
|
|
byte *p = getResourceAddress(rtImage, params->img.resNum);
|
|
|
|
uint32 size = READ_BE_UINT32(p + 4);
|
|
|
|
if (f.write(p, size) != size) {
|
|
|
|
warning("i/o error when writing '%s'", params->filename);
|
2004-10-10 06:48:00 +00:00
|
|
|
VAR(119) = -2;
|
2004-10-09 16:41:35 +00:00
|
|
|
} else {
|
2004-10-10 06:48:00 +00:00
|
|
|
VAR(119) = 0;
|
2004-10-09 16:41:35 +00:00
|
|
|
}
|
|
|
|
f.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
2004-10-01 11:14:01 +00:00
|
|
|
case 6:
|
2004-10-04 01:19:05 +00:00
|
|
|
// HE 99+
|
|
|
|
case 7:
|
|
|
|
case 8:
|
|
|
|
case 9:
|
|
|
|
case 10:
|
|
|
|
case 11:
|
|
|
|
case 12:
|
2004-10-08 22:58:49 +00:00
|
|
|
warning("unhandled processWizImage mode %d", params->processMode);
|
2004-09-26 15:29:58 +00:00
|
|
|
break;
|
|
|
|
default:
|
2004-10-08 22:58:49 +00:00
|
|
|
warning("invalid processWizImage mode %d", params->processMode);
|
2004-09-26 15:29:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-10-02 01:08:31 +00:00
|
|
|
void ScummEngine_v90he::o90_wizImageOps() {
|
2004-09-26 15:29:58 +00:00
|
|
|
int a, b;
|
2004-10-10 11:09:23 +00:00
|
|
|
int subOp = fetchScriptByte();
|
2004-09-06 08:53:19 +00:00
|
|
|
subOp -= 46;
|
2004-09-06 00:58:40 +00:00
|
|
|
|
2004-09-06 08:53:19 +00:00
|
|
|
switch (subOp) {
|
2004-09-18 21:44:00 +00:00
|
|
|
case -14: // HE99+
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x20;
|
2004-09-18 21:44:00 +00:00
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case -13: // HE99+
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x40;
|
2004-09-18 21:44:00 +00:00
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 1:
|
2004-09-26 15:29:58 +00:00
|
|
|
_wizParams.box.bottom = pop();
|
|
|
|
_wizParams.box.right = pop();
|
|
|
|
_wizParams.box.top = pop();
|
|
|
|
_wizParams.box.left = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processMode = 1;
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x800;
|
|
|
|
_wizParams.processMode = 3;
|
2004-09-26 15:29:58 +00:00
|
|
|
copyScriptString(_wizParams.filename);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x800;
|
|
|
|
_wizParams.processMode = 4;
|
2004-09-26 15:29:58 +00:00
|
|
|
copyScriptString(_wizParams.filename);
|
|
|
|
_wizParams.unk_14C = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x300;
|
|
|
|
_wizParams.processMode = 2;
|
2004-09-26 15:29:58 +00:00
|
|
|
_wizParams.box.bottom = pop();
|
|
|
|
_wizParams.box.right = pop();
|
|
|
|
_wizParams.box.top = pop();
|
|
|
|
_wizParams.box.left = pop();
|
|
|
|
_wizParams.unk_148 = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x400;
|
2004-09-26 15:29:58 +00:00
|
|
|
_wizParams.img.state = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 7:
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x10;
|
|
|
|
_wizParams.angle = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 8:
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x20;
|
2004-09-26 15:29:58 +00:00
|
|
|
_wizParams.img.flags = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 10:
|
2004-09-26 15:29:58 +00:00
|
|
|
_wizParams.img.flags = pop();
|
|
|
|
_wizParams.img.state = pop();
|
|
|
|
_wizParams.img.y1 = pop();
|
|
|
|
_wizParams.img.x1 = pop();
|
|
|
|
_wizParams.img.resNum = pop();
|
|
|
|
displayWizImage(&_wizParams.img);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 11:
|
2004-09-26 15:29:58 +00:00
|
|
|
_wizParams.img.resNum = pop();
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processMode = 0;
|
|
|
|
_wizParams.processFlags = 0;
|
2004-09-26 15:29:58 +00:00
|
|
|
_wizParams.remapPos = 0;
|
|
|
|
_wizParams.img.flags = 0;
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
2004-10-04 01:19:05 +00:00
|
|
|
case 16: // HE99+
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x80000;
|
2004-10-04 01:19:05 +00:00
|
|
|
pop();
|
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 19:
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 1;
|
2004-09-26 15:29:58 +00:00
|
|
|
_wizParams.img.y1 = pop();
|
|
|
|
_wizParams.img.x1 = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
2004-09-22 02:29:47 +00:00
|
|
|
case 20:
|
2004-10-04 01:19:05 +00:00
|
|
|
case 203: // HE98+
|
2004-09-26 15:29:58 +00:00
|
|
|
b = pop();
|
|
|
|
a = pop();
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x40;
|
|
|
|
_wizParams.processMode = 6;
|
2004-09-26 15:29:58 +00:00
|
|
|
if (_wizParams.remapPos == 0) {
|
|
|
|
memset(_wizParams.remapBuf2, 0, sizeof(_wizParams.remapBuf2));
|
|
|
|
} else {
|
|
|
|
assert(_wizParams.remapPos < ARRAYSIZE(_wizParams.remapBuf2));
|
|
|
|
_wizParams.remapBuf2[_wizParams.remapPos] = a;
|
|
|
|
_wizParams.remapBuf1[a] = b;
|
|
|
|
++_wizParams.remapPos;
|
|
|
|
}
|
2004-09-22 02:29:47 +00:00
|
|
|
break;
|
2004-09-21 01:00:30 +00:00
|
|
|
case 21:
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x200;
|
2004-09-26 15:29:58 +00:00
|
|
|
_wizParams.box.bottom = pop();
|
|
|
|
_wizParams.box.right = pop();
|
|
|
|
_wizParams.box.top = pop();
|
|
|
|
_wizParams.box.left = pop();
|
2004-09-21 01:00:30 +00:00
|
|
|
break;
|
2004-10-04 01:19:05 +00:00
|
|
|
case 31: // HE99+
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 2;
|
2004-10-04 01:19:05 +00:00
|
|
|
break;
|
2004-09-22 09:48:40 +00:00
|
|
|
case 40: // HE99+
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x80;
|
2004-09-22 09:48:40 +00:00
|
|
|
pop();
|
|
|
|
break;
|
2004-09-26 15:29:58 +00:00
|
|
|
case 46:
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 8;
|
|
|
|
_wizParams.zoom = pop();
|
2004-09-26 15:29:58 +00:00
|
|
|
break;
|
|
|
|
case 52:
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 4;
|
2004-09-26 15:29:58 +00:00
|
|
|
_wizParams.unk_15C = pop();
|
|
|
|
break;
|
2004-10-04 01:19:05 +00:00
|
|
|
case 85: // HE99+
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x1102;
|
|
|
|
_wizParams.processMode = 7;
|
2004-10-04 01:19:05 +00:00
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 87: // HE99+
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x60000;
|
|
|
|
_wizParams.processMode = 9;
|
2004-09-18 21:44:00 +00:00
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
2004-10-04 01:19:05 +00:00
|
|
|
case 88: // HE99+
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x60000;
|
|
|
|
_wizParams.processMode = 10;
|
2004-10-04 01:19:05 +00:00
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 89: // HE99+
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x60000;
|
|
|
|
_wizParams.processMode = 11;
|
2004-10-04 01:19:05 +00:00
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 90: // HE99+
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x60000;
|
|
|
|
_wizParams.processMode = 12;
|
2004-10-04 01:19:05 +00:00
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 91: // HE99+
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x10000;
|
2004-09-18 21:44:00 +00:00
|
|
|
pop();
|
|
|
|
break;
|
2004-09-26 15:29:58 +00:00
|
|
|
case 108:
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 1;
|
2004-09-26 15:29:58 +00:00
|
|
|
_wizParams.img.y1 = pop();
|
|
|
|
_wizParams.img.x1 = pop();
|
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 171: // HE99+
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processMode = 8;
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
2004-09-20 09:16:49 +00:00
|
|
|
case 200:
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x23;
|
2004-09-26 15:29:58 +00:00
|
|
|
_wizParams.img.flags |= 0x40;
|
|
|
|
_wizParams.unk_160 = _wizParams.img.y1 = _wizParams.img.x1 = pop();
|
2004-09-20 09:16:49 +00:00
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 209:
|
2004-10-08 22:58:49 +00:00
|
|
|
processWizImage(&_wizParams);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
default:
|
2004-10-02 01:08:31 +00:00
|
|
|
error("o90_wizImageOps: unhandled case %d", subOp);
|
2004-09-06 00:58:40 +00:00
|
|
|
}
|
|
|
|
|
2004-10-02 01:08:31 +00:00
|
|
|
debug(1,"o90_wizImageOps stub (%d)", subOp);
|
2004-09-06 00:58:40 +00:00
|
|
|
}
|
|
|
|
|
2004-10-10 06:32:02 +00:00
|
|
|
void ScummEngine_v90he::o90_unknown24() {
|
|
|
|
byte subOp = fetchScriptByte();
|
|
|
|
|
|
|
|
switch (subOp) {
|
|
|
|
case 28:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 29:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("o90_unknown24: Unknown case %d", subOp);
|
|
|
|
}
|
|
|
|
push(0);
|
|
|
|
debug(1,"o90_unknown24 stub (%d)", subOp);
|
|
|
|
}
|
|
|
|
|
2004-09-06 01:19:38 +00:00
|
|
|
void ScummEngine_v90he::o90_unknown25() {
|
|
|
|
int args[16];
|
2004-10-10 00:24:15 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2004-09-12 00:48:16 +00:00
|
|
|
subOp -= 30;
|
|
|
|
|
|
|
|
debug(1,"o90_unknown25 stub (%d)", subOp);
|
2004-09-06 01:19:38 +00:00
|
|
|
switch (subOp) {
|
2004-09-18 21:44:00 +00:00
|
|
|
case 0:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 13:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 15:
|
|
|
|
if (_heversion == 99) {
|
|
|
|
getStackList(args, ARRAYSIZE(args));
|
2004-09-12 00:48:16 +00:00
|
|
|
pop();
|
|
|
|
pop();
|
2004-09-06 01:19:38 +00:00
|
|
|
pop();
|
|
|
|
pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
} else if (_heversion == 98) {
|
2004-09-06 01:19:38 +00:00
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
} else {
|
2004-09-06 01:19:38 +00:00
|
|
|
pop();
|
2004-09-12 00:48:16 +00:00
|
|
|
pop();
|
|
|
|
pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 22:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 33:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 38:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 52:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 62:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 67:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 68:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 94:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 95:
|
|
|
|
getStackList(args, ARRAYSIZE(args));
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 168:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("o90_unknown25: Unknown case %d", subOp);
|
2004-09-06 01:19:38 +00:00
|
|
|
}
|
|
|
|
push(0);
|
|
|
|
|
2004-09-12 00:48:16 +00:00
|
|
|
|
2004-09-06 01:19:38 +00:00
|
|
|
}
|
|
|
|
|
2004-09-06 00:58:40 +00:00
|
|
|
void ScummEngine_v90he::o90_unknown26() {
|
|
|
|
// Incomplete
|
2004-09-07 12:56:12 +00:00
|
|
|
int args[16];
|
2004-10-10 00:24:15 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2004-09-07 02:53:22 +00:00
|
|
|
subOp -= 34;
|
2004-09-06 00:58:40 +00:00
|
|
|
|
2004-09-07 02:53:22 +00:00
|
|
|
switch (subOp) {
|
2004-09-18 21:44:00 +00:00
|
|
|
case 0:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 18:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 19:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 23:
|
|
|
|
pop();
|
|
|
|
if (_gameId == GID_FREDDI4 || _heversion >= 99)
|
2004-09-07 03:42:15 +00:00
|
|
|
pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 28: // HE99+
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 29:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 31:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 34:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 43:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 48:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 52: // HE 98+
|
|
|
|
pop();
|
|
|
|
break;
|
2004-10-02 07:46:06 +00:00
|
|
|
case 58: // HE 99+
|
|
|
|
pop();
|
|
|
|
break;
|
2004-09-30 09:35:02 +00:00
|
|
|
case 63: // HE 98+
|
|
|
|
pop();
|
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 64:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 90:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 91:
|
|
|
|
getStackList(args, ARRAYSIZE(args));
|
|
|
|
break;
|
2004-10-10 06:32:02 +00:00
|
|
|
case 105: // HE 99+
|
|
|
|
pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
pop();
|
2004-10-10 06:32:02 +00:00
|
|
|
break;
|
|
|
|
case 106: // HE 99+
|
2004-09-18 21:44:00 +00:00
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 124:
|
|
|
|
break;
|
|
|
|
case 164:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 183:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("o90_unknown26: Unknown case %d", subOp);
|
2004-09-06 01:54:24 +00:00
|
|
|
}
|
2004-09-07 03:42:15 +00:00
|
|
|
debug(1,"o90_unknown26 stub (%d)", subOp);
|
2004-09-06 00:58:40 +00:00
|
|
|
}
|
|
|
|
|
2004-09-06 08:53:19 +00:00
|
|
|
void ScummEngine_v90he::o90_unknown27() {
|
2004-10-10 00:24:15 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2004-09-06 08:53:19 +00:00
|
|
|
switch (subOp) {
|
2004-09-30 10:24:26 +00:00
|
|
|
case 8: // HE 99+
|
|
|
|
pop();
|
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 30:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 31:
|
|
|
|
pop();
|
|
|
|
break;
|
2004-09-30 10:24:26 +00:00
|
|
|
case 42: // HE 99+
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 43:
|
|
|
|
pop();
|
|
|
|
break;
|
2004-09-30 10:24:26 +00:00
|
|
|
case 63: // HE 99+
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 139: // HE 99+
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
default:
|
|
|
|
error("o90_unknown27: Unknown case %d", subOp);
|
2004-09-06 08:53:19 +00:00
|
|
|
}
|
|
|
|
push(0);
|
|
|
|
|
|
|
|
debug(1,"o90_unknown27 stub (%d)", subOp);
|
|
|
|
}
|
|
|
|
|
2004-09-06 02:39:02 +00:00
|
|
|
void ScummEngine_v90he::o90_unknown28() {
|
|
|
|
// Incomplete
|
2004-10-10 00:24:15 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2004-09-07 02:53:22 +00:00
|
|
|
subOp -= 37;
|
2004-09-06 02:39:02 +00:00
|
|
|
|
2004-09-07 02:53:22 +00:00
|
|
|
switch (subOp) {
|
2004-10-10 06:32:02 +00:00
|
|
|
case 5:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 6:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 20:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 28:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 30:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 180:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("o90_unknown28: Unknown case %d", subOp);
|
2004-09-06 02:39:02 +00:00
|
|
|
}
|
2004-09-07 03:42:15 +00:00
|
|
|
debug(1,"o90_unknown28 stub (%d)", subOp);
|
|
|
|
}
|
|
|
|
|
2004-10-16 05:10:15 +00:00
|
|
|
int ScummEngine_v90he::getWizImageStates(int resnum) {
|
|
|
|
const uint8 *dataPtr = getResourceAddress(rtImage, resnum);
|
|
|
|
assert(dataPtr);
|
|
|
|
if (READ_UINT32(dataPtr) == MKID('MULT')) {
|
|
|
|
const byte *offs, *wrap;
|
|
|
|
|
|
|
|
wrap = findResource(MKID('WRAP'), dataPtr);
|
|
|
|
if (wrap == NULL)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
offs = findResourceData(MKID('OFFS'), wrap);
|
|
|
|
if (offs == NULL)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return(getResourceDataSize(offs) / 4);
|
|
|
|
} else {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-07 03:42:15 +00:00
|
|
|
void ScummEngine_v90he::o90_unknown29() {
|
2004-09-22 00:22:32 +00:00
|
|
|
int state, resId;
|
2004-10-16 20:38:37 +00:00
|
|
|
int32 w, h;
|
2004-09-26 15:29:58 +00:00
|
|
|
int16 x, y;
|
2004-09-22 00:22:32 +00:00
|
|
|
|
2004-10-10 00:24:15 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2004-09-07 03:42:15 +00:00
|
|
|
subOp -= 30;
|
|
|
|
|
|
|
|
switch (subOp) {
|
2004-09-18 21:44:00 +00:00
|
|
|
case 0:
|
2004-09-22 00:22:32 +00:00
|
|
|
state = pop();
|
|
|
|
resId = pop();
|
2004-09-26 15:29:58 +00:00
|
|
|
loadImgSpot(resId, state, x, y);
|
|
|
|
push(x);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2004-09-22 00:22:32 +00:00
|
|
|
state = pop();
|
|
|
|
resId = pop();
|
2004-09-26 15:29:58 +00:00
|
|
|
loadImgSpot(resId, state, x, y);
|
|
|
|
push(y);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2004-09-22 00:22:32 +00:00
|
|
|
state = pop();
|
|
|
|
resId = pop();
|
|
|
|
getWizImageDim(resId, state, w, h);
|
|
|
|
push(w);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2004-09-22 00:22:32 +00:00
|
|
|
state = pop();
|
|
|
|
resId = pop();
|
|
|
|
getWizImageDim(resId, state, w, h);
|
|
|
|
push(h);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
2004-10-16 05:10:15 +00:00
|
|
|
resId = pop();
|
|
|
|
push(getWizImageStates(resId));
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 15:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
2004-09-22 00:22:32 +00:00
|
|
|
push(0);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 36:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
2004-09-22 00:22:32 +00:00
|
|
|
push(0);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 100:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
2004-09-22 00:22:32 +00:00
|
|
|
push(0);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("o90_unknown29: Unknown case %d", subOp);
|
2004-09-07 03:42:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
debug(1,"o90_unknown29 stub (%d)", subOp);
|
2004-09-06 02:39:02 +00:00
|
|
|
}
|
|
|
|
|
2004-09-10 14:31:20 +00:00
|
|
|
void ScummEngine_v90he::o90_unknown2F() {
|
2004-10-10 00:24:15 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2004-09-10 14:31:20 +00:00
|
|
|
subOp -= 54;
|
|
|
|
|
|
|
|
switch (subOp) {
|
2004-09-18 21:44:00 +00:00
|
|
|
case 0:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 13:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 201:
|
|
|
|
break;
|
|
|
|
default:
|
2004-10-04 01:34:29 +00:00
|
|
|
error("o90_unknown2F: Unknown case %d", subOp);
|
2004-09-10 14:31:20 +00:00
|
|
|
}
|
|
|
|
debug(1,"o90_unknown2F stub (%d)", subOp);
|
|
|
|
}
|
|
|
|
|
2004-09-30 09:35:02 +00:00
|
|
|
void ScummEngine_v90he::o90_unknown31() {
|
|
|
|
int a = pop() << 2;
|
|
|
|
push(pop() << a);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v90he::o90_unknown32() {
|
|
|
|
int a = pop() << 2;
|
|
|
|
push(pop() >> a);
|
|
|
|
}
|
|
|
|
|
2004-09-12 10:23:20 +00:00
|
|
|
void ScummEngine_v90he::o90_mod() {
|
2004-09-10 14:31:20 +00:00
|
|
|
int a = pop();
|
2004-09-12 10:23:20 +00:00
|
|
|
if (a == 0)
|
|
|
|
error("modulus by zero");
|
|
|
|
push(pop() % a);
|
|
|
|
}
|
|
|
|
|
2004-10-03 05:29:31 +00:00
|
|
|
void ScummEngine_v90he::o90_findAllObjectsWithClassOf() {
|
2004-09-12 10:23:20 +00:00
|
|
|
int args[16];
|
2004-10-03 06:07:25 +00:00
|
|
|
int cond, num, cls, tmp;
|
2004-10-03 05:29:31 +00:00
|
|
|
bool b;
|
2004-09-12 10:23:20 +00:00
|
|
|
|
2004-10-03 05:29:31 +00:00
|
|
|
num = getStackList(args, ARRAYSIZE(args));
|
2004-09-12 10:23:20 +00:00
|
|
|
int room = pop();
|
2004-10-03 05:34:48 +00:00
|
|
|
int j = 1;
|
2004-09-12 10:23:20 +00:00
|
|
|
|
|
|
|
if (room != _currentRoom)
|
2004-10-03 05:29:31 +00:00
|
|
|
warning("o90_findAllObjectsWithClassOf: current room is not %d", room);
|
2004-10-03 06:07:25 +00:00
|
|
|
|
2004-09-12 10:23:20 +00:00
|
|
|
writeVar(0, 0);
|
|
|
|
defineArray(0, kDwordArray, 0, 0, 0, _numLocalObjects + 1);
|
2004-10-03 05:34:48 +00:00
|
|
|
for (int i = 1; i < _numLocalObjects; i++) {
|
2004-10-03 05:29:31 +00:00
|
|
|
cond = 1;
|
|
|
|
tmp = num;
|
|
|
|
while (--tmp >= 0) {
|
|
|
|
cls = args[tmp];
|
|
|
|
b = getClass(i, cls);
|
|
|
|
if ((cls & 0x80 && !b) || (!(cls & 0x80) && b))
|
|
|
|
cond = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cond)
|
2004-10-03 05:34:48 +00:00
|
|
|
writeArray(0, 0, j++, _objs[i].obj_nr);
|
2004-09-12 10:23:20 +00:00
|
|
|
}
|
2004-10-03 05:34:48 +00:00
|
|
|
writeArray(0, 0, 0, j);
|
2004-09-12 10:23:20 +00:00
|
|
|
|
|
|
|
push(readVar(0));
|
2004-09-10 14:31:20 +00:00
|
|
|
}
|
|
|
|
|
2004-10-04 02:23:02 +00:00
|
|
|
void ScummEngine_v90he::o90_getPolygonOverlap() {
|
2004-10-09 16:10:53 +00:00
|
|
|
int args1[32];
|
2004-09-30 09:54:45 +00:00
|
|
|
int args2[32];
|
|
|
|
|
2004-10-09 16:10:53 +00:00
|
|
|
int n1 = getStackList(args1, ARRAYSIZE(args1));
|
2004-09-30 09:54:45 +00:00
|
|
|
getStackList(args2, ARRAYSIZE(args2));
|
|
|
|
|
|
|
|
int subOp = pop();
|
|
|
|
|
|
|
|
switch (subOp) {
|
|
|
|
case 1:
|
2004-10-09 16:10:53 +00:00
|
|
|
{
|
|
|
|
Common::Rect r(args1[0], args1[1], args1[2] + 1, args1[3] + 1);
|
|
|
|
Common::Point p(args2[0], args2[1]);
|
|
|
|
push(r.contains(p) ? 1 : 0);
|
|
|
|
}
|
|
|
|
break;
|
2004-09-30 09:54:45 +00:00
|
|
|
case 2:
|
2004-10-09 16:10:53 +00:00
|
|
|
{
|
|
|
|
int dx = args2[0] - args1[0];
|
|
|
|
int dy = args2[1] - args1[1];
|
|
|
|
int dist = dx * dx + dy * dy;
|
|
|
|
if (dist >= 2) {
|
2004-10-16 20:38:37 +00:00
|
|
|
dist = (int)sqrt((double)(dist + 1));
|
2004-10-09 16:10:53 +00:00
|
|
|
}
|
|
|
|
push((dist > args1[2]) ? 1 : 0);
|
|
|
|
}
|
|
|
|
break;
|
2004-09-30 09:54:45 +00:00
|
|
|
case 3:
|
2004-10-09 16:10:53 +00:00
|
|
|
{
|
|
|
|
Common::Rect r1(args1[0], args1[1], args1[2] + 1, args1[3] + 1);
|
|
|
|
Common::Rect r2(args2[0], args2[1], args2[2] + 1, args2[3] + 1);
|
|
|
|
push(r2.intersects(r1) ? 1 : 0);
|
|
|
|
}
|
|
|
|
break;
|
2004-09-30 09:54:45 +00:00
|
|
|
case 4:
|
2004-10-09 16:10:53 +00:00
|
|
|
{
|
|
|
|
int dx = args2[0] - args1[0];
|
|
|
|
int dy = args2[1] - args1[1];
|
|
|
|
int dist = dx * dx + dy * dy;
|
|
|
|
if (dist >= 2) {
|
2004-10-16 20:38:37 +00:00
|
|
|
dist = (int)sqrt((double)(dist + 1));
|
2004-10-09 16:10:53 +00:00
|
|
|
}
|
|
|
|
push((dist < args1[2] && dist < args2[2]) ? 1 : 0);
|
|
|
|
}
|
|
|
|
break;
|
2004-09-30 09:54:45 +00:00
|
|
|
case 5:
|
2004-10-09 16:10:53 +00:00
|
|
|
{
|
|
|
|
assert((n1 & 1) == 0);
|
|
|
|
n1 /= 2;
|
|
|
|
if (n1 == 0) {
|
|
|
|
push(0);
|
|
|
|
} else {
|
|
|
|
WizPolygon wp;
|
|
|
|
memset(&wp, 0, sizeof(wp));
|
|
|
|
wp.numVerts = n1;
|
|
|
|
assert(n1 < ARRAYSIZE(wp.vert));
|
|
|
|
for (int i = 0; i < n1; ++i) {
|
|
|
|
wp.vert[i].x = args1[i * 2 + 0];
|
|
|
|
wp.vert[i].y = args1[i * 2 + 1];
|
|
|
|
}
|
|
|
|
push(polygonContains(wp, args2[0], args2[1]) ? 1 : 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2004-09-30 09:54:45 +00:00
|
|
|
// HE 98+
|
|
|
|
case 6:
|
|
|
|
case 7:
|
|
|
|
case 8:
|
|
|
|
case 9:
|
2004-10-09 16:10:53 +00:00
|
|
|
push(0);
|
2004-09-30 09:54:45 +00:00
|
|
|
break;
|
|
|
|
default:
|
2004-10-04 02:23:02 +00:00
|
|
|
error("o90_getPolygonOverlap: default case %d", subOp);
|
2004-09-30 09:54:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-12 11:15:26 +00:00
|
|
|
void ScummEngine_v90he::o90_unknown36() {
|
|
|
|
int a = pop();
|
|
|
|
int b = pop();
|
|
|
|
int c = pop();
|
|
|
|
|
|
|
|
if (!c)
|
|
|
|
b = a;
|
|
|
|
push(b);
|
|
|
|
}
|
|
|
|
|
2004-10-04 01:34:29 +00:00
|
|
|
void ScummEngine_v90he::o90_dim2dim2Array() {
|
2004-09-07 12:56:12 +00:00
|
|
|
int data, dim1start, dim1end, dim2start, dim2end;
|
|
|
|
int type = fetchScriptByte();
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case 2: // SO_BIT_ARRAY
|
|
|
|
data = kBitArray;
|
|
|
|
break;
|
|
|
|
case 3: // SO_NIBBLE_ARRAY
|
|
|
|
data = kNibbleArray;
|
|
|
|
break;
|
|
|
|
case 4: // SO_BYTE_ARRAY
|
|
|
|
data = kByteArray;
|
|
|
|
break;
|
|
|
|
case 5: // SO_INT_ARRAY
|
|
|
|
data = kIntArray;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
data = kDwordArray;
|
|
|
|
break;
|
|
|
|
case 7: // SO_STRING_ARRAY
|
|
|
|
data = kStringArray;
|
|
|
|
break;
|
|
|
|
default:
|
2004-10-04 01:34:29 +00:00
|
|
|
error("o90_dim2dim2Array: default case %d", type);
|
2004-09-07 12:56:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pop() == 2) {
|
|
|
|
dim1end = pop();
|
|
|
|
dim1start = pop();
|
|
|
|
dim2end = pop();
|
|
|
|
dim2start = pop();
|
|
|
|
} else {
|
|
|
|
dim2end = pop();
|
|
|
|
dim2start = pop();
|
|
|
|
dim1end = pop();
|
|
|
|
dim1start = pop();
|
|
|
|
}
|
|
|
|
|
|
|
|
defineArray(fetchScriptWord(), data, dim2start, dim2end, dim1start, dim1end);
|
|
|
|
}
|
|
|
|
|
2004-10-04 02:23:02 +00:00
|
|
|
void ScummEngine_v90he::o90_sortArray() {
|
2004-09-18 05:15:57 +00:00
|
|
|
// Sorts array via qsort
|
2004-10-10 00:24:15 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2004-09-13 05:25:35 +00:00
|
|
|
|
|
|
|
switch (subOp) {
|
2004-09-18 21:44:00 +00:00
|
|
|
case 129:
|
|
|
|
fetchScriptWord();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
default:
|
2004-10-04 02:23:02 +00:00
|
|
|
error("o90_sortArray: Unknown case %d", subOp);
|
2004-09-13 05:25:35 +00:00
|
|
|
}
|
2004-10-04 02:23:02 +00:00
|
|
|
debug(1,"o90_sortArray stub (%d)", subOp);
|
2004-09-13 05:25:35 +00:00
|
|
|
}
|
|
|
|
|
2004-10-04 02:23:02 +00:00
|
|
|
void ScummEngine_v90he::o90_getObjectData() {
|
2004-10-02 01:40:34 +00:00
|
|
|
// Object releated
|
2004-10-10 00:24:15 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2004-10-02 01:40:34 +00:00
|
|
|
subOp -= 32;
|
|
|
|
|
|
|
|
switch (subOp) {
|
|
|
|
case 0:
|
|
|
|
if (_heObjectNum == -1)
|
|
|
|
push(0);
|
|
|
|
else
|
|
|
|
push(_objs[_heObjectNum].width);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (_heObjectNum == -1)
|
|
|
|
push(0);
|
|
|
|
else
|
|
|
|
push(_objs[_heObjectNum].height);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
push(0);
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
if (_heObjectNum == -1)
|
|
|
|
push(0);
|
|
|
|
else
|
|
|
|
push(_objs[_heObjectNum].x_pos);
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
if (_heObjectNum == -1)
|
|
|
|
push(0);
|
|
|
|
else
|
|
|
|
push(_objs[_heObjectNum].y_pos);
|
|
|
|
break;
|
|
|
|
case 20:
|
|
|
|
push(getState(_heObject));
|
|
|
|
break;
|
|
|
|
case 25:
|
|
|
|
_heObject = pop();
|
|
|
|
_heObjectNum = getObjectIndex(_heObject);
|
|
|
|
break;
|
|
|
|
case 107:
|
|
|
|
// Dummy case
|
|
|
|
pop();
|
|
|
|
push(0);
|
|
|
|
break;
|
|
|
|
default:
|
2004-10-04 02:23:02 +00:00
|
|
|
error("o90_getObjectData: Unknown case %d", subOp);
|
2004-10-02 01:40:34 +00:00
|
|
|
}
|
2004-10-04 02:23:02 +00:00
|
|
|
debug(1,"o90_getObjectData stub (%d)", subOp);
|
2004-10-02 01:40:34 +00:00
|
|
|
}
|
|
|
|
|
2004-10-04 02:23:02 +00:00
|
|
|
void ScummEngine_v90he::o90_getPaletteData() {
|
2004-10-10 00:24:15 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2004-09-18 04:12:14 +00:00
|
|
|
subOp -= 45;
|
|
|
|
|
|
|
|
switch (subOp) {
|
2004-09-18 21:44:00 +00:00
|
|
|
case 0:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 21:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 87:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 172:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
default:
|
2004-10-04 02:23:02 +00:00
|
|
|
error("o90_getPaletteData: Unknown case %d", subOp);
|
2004-09-18 04:12:14 +00:00
|
|
|
}
|
|
|
|
push(0);
|
2004-10-04 02:23:02 +00:00
|
|
|
debug(1,"o90_getPaletteData stub (%d)", subOp);
|
2004-09-18 04:12:14 +00:00
|
|
|
}
|
|
|
|
|
2004-10-04 02:23:02 +00:00
|
|
|
void ScummEngine_v90he::o90_paletteOps() {
|
2004-10-04 04:04:37 +00:00
|
|
|
int idx, state;
|
|
|
|
|
|
|
|
byte subOp = fetchScriptByte();
|
2004-09-12 10:23:20 +00:00
|
|
|
subOp -= 57;
|
|
|
|
|
|
|
|
switch (subOp) {
|
2004-09-18 21:44:00 +00:00
|
|
|
case 0:
|
2004-10-04 04:04:37 +00:00
|
|
|
_hePaletteNum = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
2004-10-04 04:04:37 +00:00
|
|
|
{
|
|
|
|
state = pop();
|
|
|
|
idx = pop();
|
|
|
|
const uint8 *dataPtr = getResourceAddress(rtImage, idx);
|
|
|
|
const uint8 *pal = findWrappedBlock(MKID('RGBS'), dataPtr, state, 0);
|
|
|
|
assert(pal);
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 13:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 19: //HE99+
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 29:
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 118:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 160:
|
|
|
|
break;
|
|
|
|
case 198:
|
2004-10-04 04:04:37 +00:00
|
|
|
_hePaletteNum = 0;
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
default:
|
2004-10-04 02:23:02 +00:00
|
|
|
error("o90_paletteOps: Unknown case %d", subOp);
|
2004-09-12 10:23:20 +00:00
|
|
|
}
|
2004-10-04 04:04:37 +00:00
|
|
|
debug(0,"o90_paletteOps stub (%d)", subOp);
|
2004-09-12 10:23:20 +00:00
|
|
|
}
|
|
|
|
|
2004-10-01 23:56:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
void ScummEngine_v90he::o90_unknownA5() {
|
2004-10-09 23:45:04 +00:00
|
|
|
byte string[80];
|
|
|
|
int a;
|
|
|
|
|
2004-10-10 00:24:15 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2004-10-01 23:56:39 +00:00
|
|
|
|
|
|
|
switch (subOp) {
|
|
|
|
case 42:
|
2004-10-09 23:45:04 +00:00
|
|
|
a = pop();
|
|
|
|
if (a == 2)
|
|
|
|
copyScriptString(string);
|
|
|
|
else if (a == 1)
|
2004-10-01 23:56:39 +00:00
|
|
|
pop();
|
|
|
|
break;
|
|
|
|
case 57:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("o90_unknownA5: Unknown case %d", subOp);
|
|
|
|
}
|
|
|
|
|
|
|
|
push(0);
|
|
|
|
debug(1,"o90_unknownA5 stub (%d)", subOp);
|
|
|
|
}
|
|
|
|
|
2004-09-21 05:59:26 +00:00
|
|
|
void ScummEngine_v90he::o90_getActorAnimProgress() {
|
|
|
|
Actor *a = derefActor(pop(), "o90_getActorAnimProgress");
|
|
|
|
push(a->getAnimProgress());
|
|
|
|
}
|
|
|
|
|
2004-09-06 00:58:40 +00:00
|
|
|
} // End of namespace Scumm
|