2004-09-06 00:58:40 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
2005-01-01 16:09:25 +00:00
|
|
|
* Copyright (C) 2001-2005 The ScummVM project
|
2004-09-06 00:58:40 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
|
|
|
#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"
|
|
|
|
|
|
|
|
namespace Scumm {
|
|
|
|
|
2004-10-19 12:30:42 +00:00
|
|
|
#define OPCODE(x) _OPCODE(ScummEngine_v90he, x)
|
2004-09-06 00:58:40 +00:00
|
|
|
|
|
|
|
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),
|
2005-03-07 06:06:22 +00:00
|
|
|
OPCODE(o90_dup_n),
|
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-11-21 20:55:56 +00:00
|
|
|
OPCODE(o90_getDistanceBetweenPoints),
|
2005-02-20 11:14:50 +00:00
|
|
|
OPCODE(o90_getSpriteInfo),
|
|
|
|
OPCODE(o90_setSpriteInfo),
|
|
|
|
OPCODE(o90_getSpriteGroupInfo),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 28 */
|
2005-02-20 11:14:50 +00:00
|
|
|
OPCODE(o90_setSpriteGroupInfo),
|
2004-11-22 20:34:29 +00:00
|
|
|
OPCODE(o90_getWizData),
|
2005-03-08 05:56:21 +00:00
|
|
|
OPCODE(o90_getActorData),
|
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),
|
2005-02-27 01:20:44 +00:00
|
|
|
OPCODE(o90_floodState),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 30 */
|
2004-09-12 10:23:20 +00:00
|
|
|
OPCODE(o90_mod),
|
2004-11-28 05:33:33 +00:00
|
|
|
OPCODE(o90_shl),
|
|
|
|
OPCODE(o90_shr),
|
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-11-26 20:17:02 +00:00
|
|
|
OPCODE(o90_cond),
|
2004-10-04 01:34:29 +00:00
|
|
|
OPCODE(o90_dim2dim2Array),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 38 */
|
2005-03-07 10:21:23 +00:00
|
|
|
OPCODE(o90_redim2dimArray),
|
2004-09-06 00:58:40 +00:00
|
|
|
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-11-23 19:47:54 +00:00
|
|
|
OPCODE(o80_loadSBNG),
|
2005-02-14 07:15:16 +00:00
|
|
|
OPCODE(o80_getFileSize),
|
2004-09-20 19:19:57 +00:00
|
|
|
OPCODE(o6_wordArrayWrite),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 48 */
|
2004-11-23 19:47:54 +00:00
|
|
|
OPCODE(o80_stringToInt),
|
2004-10-17 06:32:58 +00:00
|
|
|
OPCODE(o80_getSoundVar),
|
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 */
|
2004-11-26 20:17:02 +00:00
|
|
|
OPCODE(o72_resetCutscene),
|
2004-09-06 00:58:40 +00:00
|
|
|
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),
|
2005-01-30 11:03:49 +00:00
|
|
|
OPCODE(o72_getSoundElapsedTimeOfSound),
|
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-10-17 11:47:12 +00:00
|
|
|
OPCODE(o70_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),
|
2005-03-17 10:53:29 +00:00
|
|
|
OPCODE(o72_talkActor),
|
|
|
|
OPCODE(o72_talkEgo),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* 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 */
|
2005-03-23 00:16:51 +00:00
|
|
|
OPCODE(o90_kernelGetFunctions),
|
|
|
|
OPCODE(o90_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),
|
2005-03-17 11:06:43 +00:00
|
|
|
OPCODE(o72_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 */
|
2005-02-02 12:05:00 +00:00
|
|
|
OPCODE(o70_copyString),
|
2004-11-23 19:47:54 +00:00
|
|
|
OPCODE(o70_getStringWidth),
|
|
|
|
OPCODE(o70_getStringLen),
|
2005-02-02 12:05:00 +00:00
|
|
|
OPCODE(o70_appendString),
|
2004-09-06 00:58:40 +00:00
|
|
|
/* F0 */
|
2005-02-02 12:05:00 +00:00
|
|
|
OPCODE(o70_concatString),
|
2004-11-26 20:17:02 +00:00
|
|
|
OPCODE(o70_compareString),
|
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-11-26 20:17:02 +00:00
|
|
|
OPCODE(o70_getStringLenForWidth),
|
|
|
|
OPCODE(o70_getCharIndexInString),
|
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;
|
|
|
|
}
|
|
|
|
|
2005-03-07 06:06:22 +00:00
|
|
|
void ScummEngine_v90he::o90_dup_n() {
|
|
|
|
int num;
|
|
|
|
int args[16];
|
2004-09-23 09:11:52 +00:00
|
|
|
|
2005-03-07 06:06:22 +00:00
|
|
|
push(fetchScriptWord());
|
|
|
|
num = getStackList(args, ARRAYSIZE(args));
|
|
|
|
|
|
|
|
for (int i = 0; i < 2; i++) {
|
|
|
|
for (int j = 0; j < num; j++)
|
|
|
|
push(args[j]);
|
2004-09-23 09:11:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2005-03-08 05:56:21 +00:00
|
|
|
void ScummEngine_v90he::o90_getActorData() {
|
|
|
|
Actor *a;
|
|
|
|
|
|
|
|
int subOp = pop();
|
|
|
|
int val = pop();
|
|
|
|
int act = pop();
|
|
|
|
|
|
|
|
a = derefActorSafe(act, "o90_getActorData");
|
|
|
|
|
|
|
|
switch (subOp) {
|
|
|
|
case 1:
|
|
|
|
push(a->isUserConditionSet(val));
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
// Get actor limb?
|
|
|
|
checkRange(15, 0, val, "Limb %d out of range");
|
|
|
|
push(0);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
push(a->getAnimSpeed());
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
push(a->_shadowMode);
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
push(a->_layer);
|
|
|
|
break;
|
|
|
|
case 6:
|
2005-03-11 01:10:06 +00:00
|
|
|
push(a->_hePaletteNum);
|
2005-03-08 05:56:21 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("o90_getActorData: Unknown actor property %d", subOp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-10-10 05:49:30 +00:00
|
|
|
void ScummEngine_v90he::o90_startScriptUnk() {
|
2004-12-19 09:27:08 +00:00
|
|
|
int args[25];
|
2004-10-10 05:49:30 +00:00
|
|
|
int script, cycle;
|
|
|
|
byte flags;
|
|
|
|
|
|
|
|
getStackList(args, ARRAYSIZE(args));
|
|
|
|
cycle = pop();
|
|
|
|
script = pop();
|
|
|
|
flags = fetchScriptByte();
|
2005-02-28 13:23:10 +00:00
|
|
|
runScript(script, (flags == 199 || flags == 200), (flags == 195 || flags == 200), args, cycle);
|
2004-10-10 05:49:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v90he::o90_jumpToScriptUnk() {
|
2004-12-19 09:27:08 +00:00
|
|
|
int args[25];
|
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();
|
2005-02-28 13:23:10 +00:00
|
|
|
runScript(script, (flags == 199 || flags == 200), (flags == 195 || flags == 200), args, cycle);
|
2004-09-12 00:48:16 +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+
|
2005-02-27 02:55:13 +00:00
|
|
|
_wizParams.processFlags |= kWPFUseDefImgWidth;
|
2005-03-04 05:31:22 +00:00
|
|
|
_wizParams.resDefImgW = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case -13: // HE99+
|
2005-02-27 02:55:13 +00:00
|
|
|
_wizParams.processFlags |= kWPFUseDefImgHeight;
|
2005-03-04 05:31:22 +00:00
|
|
|
_wizParams.resDefImgH = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 0:
|
2005-03-04 05:31:22 +00:00
|
|
|
// Dummy case
|
2004-09-18 21:44:00 +00:00
|
|
|
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:
|
2005-02-24 20:20:35 +00:00
|
|
|
_wizParams.processFlags |= kWPFUseFile;
|
2004-10-08 22:58:49 +00:00
|
|
|
_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:
|
2005-02-24 20:20:35 +00:00
|
|
|
_wizParams.processFlags |= kWPFUseFile;
|
2004-10-08 22:58:49 +00:00
|
|
|
_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();
|
2004-10-17 04:35:36 +00:00
|
|
|
_wizParams.compType = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
2005-02-24 20:20:35 +00:00
|
|
|
_wizParams.processFlags |= kWPFNewState;
|
2004-09-26 15:29:58 +00:00
|
|
|
_wizParams.img.state = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 7:
|
2005-02-24 20:20:35 +00:00
|
|
|
_wizParams.processFlags |= kWPFRotate;
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.angle = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 8:
|
2005-02-24 20:20:35 +00:00
|
|
|
_wizParams.processFlags |= kWPFNewFlags;
|
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-10-17 04:35:36 +00:00
|
|
|
_wizParams.remapNum = 0;
|
2004-09-26 15:29:58 +00:00
|
|
|
_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;
|
2005-03-04 05:31:22 +00:00
|
|
|
_wizParams.unk_178 = pop();
|
2004-10-04 01:19:05 +00:00
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 19:
|
2005-03-24 03:59:00 +00:00
|
|
|
_wizParams.processFlags |= kWPFSetPos;
|
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();
|
2005-03-24 03:59:00 +00:00
|
|
|
_wizParams.processFlags |= kWPFRemapPalette;
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processMode = 6;
|
2004-10-17 04:35:36 +00:00
|
|
|
if (_wizParams.remapNum == 0) {
|
|
|
|
memset(_wizParams.remapIndex, 0, sizeof(_wizParams.remapIndex));
|
2004-09-26 15:29:58 +00:00
|
|
|
} else {
|
2004-10-17 04:35:36 +00:00
|
|
|
assert(_wizParams.remapNum < ARRAYSIZE(_wizParams.remapIndex));
|
|
|
|
_wizParams.remapIndex[_wizParams.remapNum] = a;
|
|
|
|
_wizParams.remapColor[a] = b;
|
|
|
|
++_wizParams.remapNum;
|
2004-09-26 15:29:58 +00:00
|
|
|
}
|
2004-09-22 02:29:47 +00:00
|
|
|
break;
|
2004-09-21 01:00:30 +00:00
|
|
|
case 21:
|
2005-02-24 20:20:35 +00:00
|
|
|
_wizParams.processFlags |= kWPFClipBox;
|
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-09-22 09:48:40 +00:00
|
|
|
case 40: // HE99+
|
2005-01-30 07:00:50 +00:00
|
|
|
_wizParams.processFlags |= 0x8000;
|
2005-03-04 05:31:22 +00:00
|
|
|
_wizParams.unk_174 = pop();
|
2004-09-22 09:48:40 +00:00
|
|
|
break;
|
2004-09-26 15:29:58 +00:00
|
|
|
case 46:
|
2005-02-24 20:20:35 +00:00
|
|
|
_wizParams.processFlags |= kWPFZoom;
|
2004-10-08 22:58:49 +00:00
|
|
|
_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;
|
2005-03-04 05:31:22 +00:00
|
|
|
_wizParams.unk_164 = pop();
|
|
|
|
_wizParams.unk_160 = pop();
|
2004-10-17 08:02:42 +00:00
|
|
|
_wizParams.compType = pop();
|
2004-10-04 01:19:05 +00:00
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 87: // HE99+
|
2005-03-24 03:59:00 +00:00
|
|
|
_wizParams.processFlags |= kWPFFillColor | kWPFClipBox2;
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processMode = 9;
|
2005-03-04 05:31:22 +00:00
|
|
|
_wizParams.fillColor = pop();
|
|
|
|
_wizParams.box2.bottom = pop();
|
|
|
|
_wizParams.box2.right = pop();
|
|
|
|
_wizParams.box2.top = pop();
|
|
|
|
_wizParams.box2.left = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
2004-10-04 01:19:05 +00:00
|
|
|
case 88: // HE99+
|
2005-03-24 03:59:00 +00:00
|
|
|
_wizParams.processFlags |= kWPFFillColor | kWPFClipBox2;
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processMode = 10;
|
2005-03-04 05:31:22 +00:00
|
|
|
_wizParams.fillColor = pop();
|
|
|
|
_wizParams.box2.bottom = pop();
|
|
|
|
_wizParams.box2.right = pop();
|
|
|
|
_wizParams.box2.top = pop();
|
|
|
|
_wizParams.box2.left = pop();
|
2004-10-04 01:19:05 +00:00
|
|
|
break;
|
|
|
|
case 89: // HE99+
|
2005-03-24 03:59:00 +00:00
|
|
|
_wizParams.processFlags |= kWPFFillColor | kWPFClipBox2;
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processMode = 11;
|
2005-03-04 05:31:22 +00:00
|
|
|
_wizParams.fillColor = pop();
|
|
|
|
_wizParams.box2.top = _wizParams.box2.bottom = pop();
|
|
|
|
_wizParams.box2.left = _wizParams.box2.right = pop();
|
2004-10-04 01:19:05 +00:00
|
|
|
break;
|
|
|
|
case 90: // HE99+
|
2005-03-24 03:59:00 +00:00
|
|
|
_wizParams.processFlags |= kWPFFillColor | kWPFClipBox2;
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processMode = 12;
|
2005-03-04 05:31:22 +00:00
|
|
|
_wizParams.fillColor = pop();
|
|
|
|
_wizParams.box2.top = _wizParams.box2.bottom = pop();
|
|
|
|
_wizParams.box2.left = _wizParams.box2.right = pop();
|
2004-10-04 01:19:05 +00:00
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 91: // HE99+
|
2004-10-08 22:58:49 +00:00
|
|
|
_wizParams.processFlags |= 0x10000;
|
2005-03-04 05:31:22 +00:00
|
|
|
_wizParams.unk_380 = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
2004-09-26 15:29:58 +00:00
|
|
|
case 108:
|
2005-03-04 05:31:22 +00:00
|
|
|
_wizParams.processFlags |= kWPFSetPos;
|
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:
|
2005-02-24 20:20:35 +00:00
|
|
|
_wizParams.processFlags |= kWPFNewFlags | kWPFSetPos | 2;
|
|
|
|
_wizParams.img.flags |= kWIFIsPolygon;
|
2004-09-26 15:29:58 +00:00
|
|
|
_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:
|
2005-03-04 05:34:56 +00:00
|
|
|
if (_wizParams.img.resNum)
|
|
|
|
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-11-21 20:55:56 +00:00
|
|
|
void ScummEngine_v90he::o90_getDistanceBetweenPoints() {
|
2004-10-10 06:32:02 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2004-11-21 20:55:56 +00:00
|
|
|
int x1, y1, z1, x2, y2, z2, dx, dy, dz, d;
|
2004-10-10 06:32:02 +00:00
|
|
|
|
|
|
|
switch (subOp) {
|
2005-03-08 03:52:02 +00:00
|
|
|
case 23: // HE100
|
2004-10-10 06:32:02 +00:00
|
|
|
case 28:
|
2004-11-21 20:55:56 +00:00
|
|
|
y2 = pop();
|
|
|
|
x2 = pop();
|
|
|
|
y1 = pop();
|
|
|
|
x1 = pop();
|
|
|
|
dx = x2 - x1;
|
|
|
|
dy = y2 - y1;
|
|
|
|
d = dx * dx + dy * dy;
|
|
|
|
if (d < 2) {
|
|
|
|
push(d);
|
|
|
|
} else {
|
|
|
|
push((int)sqrt((double)(d + 1)));
|
|
|
|
}
|
2004-10-10 06:32:02 +00:00
|
|
|
break;
|
2005-03-08 03:52:02 +00:00
|
|
|
case 24: // HE100
|
2004-10-10 06:32:02 +00:00
|
|
|
case 29:
|
2004-11-21 20:55:56 +00:00
|
|
|
z2 = pop();
|
|
|
|
y2 = pop();
|
|
|
|
x2 = pop();
|
|
|
|
z1 = pop();
|
|
|
|
y1 = pop();
|
|
|
|
x1 = pop();
|
|
|
|
dx = x2 - x1;
|
|
|
|
dy = y2 - y1;
|
|
|
|
dz = z2 - z1;
|
|
|
|
d = dx * dx + dy * dy + dz * dz;
|
|
|
|
if (d < 2) {
|
|
|
|
push(d);
|
|
|
|
} else {
|
|
|
|
push((int)sqrt((double)(d + 1)));
|
|
|
|
}
|
2004-10-10 06:32:02 +00:00
|
|
|
break;
|
|
|
|
default:
|
2004-11-21 20:55:56 +00:00
|
|
|
error("o90_getDistanceBetweenPoints: Unknown case %d", subOp);
|
2004-10-10 06:32:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-02-20 11:14:50 +00:00
|
|
|
void ScummEngine_v90he::o90_getSpriteInfo() {
|
2004-09-06 01:19:38 +00:00
|
|
|
int args[16];
|
2005-02-22 01:25:53 +00:00
|
|
|
int spriteId, flags, c, d, e, f;
|
2005-02-21 00:25:30 +00:00
|
|
|
int32 a, b;
|
2005-02-22 01:25:53 +00:00
|
|
|
|
2004-10-10 00:24:15 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2004-09-12 00:48:16 +00:00
|
|
|
subOp -= 30;
|
|
|
|
|
2005-03-08 03:52:02 +00:00
|
|
|
debug(0,"o90_getSpriteInfo (%d)", subOp);
|
2004-09-06 01:19:38 +00:00
|
|
|
switch (subOp) {
|
2004-09-18 21:44:00 +00:00
|
|
|
case 0:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId) {
|
|
|
|
spriteInfoGet_tx_ty(spriteId, a, b);
|
2005-02-21 00:25:30 +00:00
|
|
|
push(a);
|
|
|
|
} else {
|
|
|
|
push(0);
|
|
|
|
}
|
2005-02-21 00:38:13 +00:00
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 1:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId) {
|
|
|
|
spriteInfoGet_tx_ty(spriteId, a, b);
|
2005-02-21 00:25:30 +00:00
|
|
|
push(b);
|
|
|
|
} else {
|
|
|
|
push(0);
|
|
|
|
}
|
2005-02-21 00:38:13 +00:00
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 2:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId) {
|
|
|
|
getSpriteImageDim(spriteId, a, b);
|
2005-02-21 00:25:30 +00:00
|
|
|
push(a);
|
2005-02-20 23:55:11 +00:00
|
|
|
} else {
|
|
|
|
push(0);
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId) {
|
|
|
|
getSpriteImageDim(spriteId, a, b);
|
2005-02-21 00:25:30 +00:00
|
|
|
push(b);
|
2005-02-20 23:55:11 +00:00
|
|
|
} else {
|
|
|
|
push(0);
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId) {
|
2005-02-23 04:05:22 +00:00
|
|
|
spriteInfoGet_dx_dy(spriteId, a, b);
|
2005-02-21 00:25:30 +00:00
|
|
|
push(a);
|
|
|
|
} else {
|
|
|
|
push(0);
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId) {
|
2005-02-23 04:05:22 +00:00
|
|
|
spriteInfoGet_dx_dy(spriteId, a, b);
|
2005-02-21 00:25:30 +00:00
|
|
|
push(b);
|
|
|
|
} else {
|
|
|
|
push(0);
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId)
|
|
|
|
push(spriteInfoGet_wizSize(spriteId));
|
2005-02-20 23:30:37 +00:00
|
|
|
else
|
|
|
|
push(0);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 7:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId)
|
|
|
|
push(spriteInfoGet_groupNum(spriteId));
|
2005-02-20 23:30:37 +00:00
|
|
|
else
|
|
|
|
push(0);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 8:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId)
|
|
|
|
push(spriteInfoGet_grp_tx(spriteId));
|
2005-02-20 23:30:37 +00:00
|
|
|
else
|
|
|
|
push(0);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 9:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId)
|
|
|
|
push(spriteInfoGet_grp_ty(spriteId));
|
2005-02-20 23:30:37 +00:00
|
|
|
else
|
|
|
|
push(0);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 12:
|
2005-02-21 00:34:00 +00:00
|
|
|
flags = pop();
|
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId) {
|
|
|
|
switch(flags) {
|
2005-02-20 13:26:30 +00:00
|
|
|
case 0:
|
2005-03-13 13:10:39 +00:00
|
|
|
push(spriteInfoGet_flagXFlipped(spriteId));
|
2005-02-20 13:26:30 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2005-03-13 13:10:39 +00:00
|
|
|
push(spriteInfoGet_flagYFlipped(spriteId));
|
2005-02-20 13:26:30 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2005-02-24 21:05:29 +00:00
|
|
|
push(spriteInfoGet_flagActive(spriteId));
|
2005-02-20 13:26:30 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2005-02-24 06:47:12 +00:00
|
|
|
push(spriteInfoGet_flags_13(spriteId));
|
2005-02-20 13:26:30 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2005-02-24 06:47:12 +00:00
|
|
|
push(spriteInfoGet_flags_20(spriteId));
|
2005-02-20 13:26:30 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
push(0);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
push(0);
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 13:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId)
|
2005-03-14 12:54:24 +00:00
|
|
|
push(spriteInfoGet_zorderPriority(spriteId));
|
2005-02-20 23:30:37 +00:00
|
|
|
else
|
|
|
|
push(0);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 15:
|
|
|
|
if (_heversion == 99) {
|
2005-02-22 01:25:53 +00:00
|
|
|
flags = getStackList(args, ARRAYSIZE(args));
|
|
|
|
c = pop();
|
|
|
|
d = pop();
|
|
|
|
e = pop();
|
|
|
|
f = pop();
|
2005-02-25 15:19:03 +00:00
|
|
|
push(findSpriteWithClassOf(f, e, d, c, flags, args));
|
2004-09-18 21:44:00 +00:00
|
|
|
} else if (_heversion == 98) {
|
2005-02-25 15:19:03 +00:00
|
|
|
c = pop();
|
|
|
|
d = pop();
|
|
|
|
e = pop();
|
|
|
|
f = pop();
|
|
|
|
push(findSpriteWithClassOf(f, e, d, c, 0, 0));
|
2004-09-18 21:44:00 +00:00
|
|
|
} else {
|
2005-02-25 15:19:03 +00:00
|
|
|
d = pop();
|
|
|
|
e = pop();
|
|
|
|
f = pop();
|
|
|
|
push(findSpriteWithClassOf(f, e, d, 0, 0, 0));
|
2004-09-18 21:44:00 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 22:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId)
|
|
|
|
push(spriteInfoGet_resState(spriteId));
|
2005-02-20 23:30:37 +00:00
|
|
|
else
|
|
|
|
push(0);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
2005-02-21 04:53:34 +00:00
|
|
|
case 32:
|
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId)
|
|
|
|
push(spriteInfoGet_field_7C(spriteId));
|
|
|
|
else
|
|
|
|
push(0);
|
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 33:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId)
|
|
|
|
push(spriteInfoGet_resId(spriteId));
|
2005-02-20 23:30:37 +00:00
|
|
|
else
|
|
|
|
push(0);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 38:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId)
|
2005-02-26 11:05:13 +00:00
|
|
|
push(spriteInfoGet_flagHasImage(spriteId));
|
2005-02-20 23:30:37 +00:00
|
|
|
else
|
|
|
|
push(1);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 52:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId)
|
2005-03-13 12:59:25 +00:00
|
|
|
push(spriteInfoGet_flags_22(spriteId));
|
2005-02-20 13:26:30 +00:00
|
|
|
else
|
|
|
|
push(0);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
2005-02-21 04:53:34 +00:00
|
|
|
case 56:
|
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId)
|
|
|
|
push(spriteInfoGet_field_14(spriteId));
|
|
|
|
else
|
|
|
|
push(0);
|
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 62:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId)
|
|
|
|
push(spriteInfoGet_zoom(spriteId));
|
2005-02-20 23:30:37 +00:00
|
|
|
else
|
|
|
|
push(0);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 67:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId)
|
2005-03-14 12:54:24 +00:00
|
|
|
push(spriteInfoGet_delayAmount(spriteId));
|
2005-02-20 23:30:37 +00:00
|
|
|
else
|
2005-02-21 04:53:34 +00:00
|
|
|
push(1);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 68:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId)
|
|
|
|
push(spriteInfoGet_field_54(spriteId));
|
2005-02-20 23:30:37 +00:00
|
|
|
else
|
|
|
|
push(0);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 94:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId)
|
2005-03-13 12:59:25 +00:00
|
|
|
push(spriteInfoGet_flags_23(spriteId));
|
2005-02-20 13:26:30 +00:00
|
|
|
else
|
|
|
|
push(0);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 95:
|
2005-02-22 01:25:53 +00:00
|
|
|
flags = getStackList(args, ARRAYSIZE(args));
|
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId) {
|
|
|
|
if (flags)
|
2005-02-23 12:26:17 +00:00
|
|
|
push(spriteInfoGet_classFlagsAnd(spriteId, flags, args));
|
2005-02-22 01:25:53 +00:00
|
|
|
else
|
|
|
|
push(spriteInfoGet_classFlags(spriteId, -1));
|
|
|
|
} else {
|
|
|
|
push(0);
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
2005-02-20 23:30:37 +00:00
|
|
|
case 109:
|
2005-02-23 09:55:34 +00:00
|
|
|
flags = pop();
|
2005-02-23 10:00:12 +00:00
|
|
|
spriteId = pop();
|
2005-02-23 09:55:34 +00:00
|
|
|
if (spriteId)
|
|
|
|
push(spriteInfoGet_field_88(spriteId, flags));
|
|
|
|
else
|
|
|
|
push(0);
|
2005-02-20 23:30:37 +00:00
|
|
|
break;
|
|
|
|
case 110:
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId)
|
|
|
|
push(spriteInfoGet_field_80(spriteId));
|
2005-02-20 23:30:37 +00:00
|
|
|
else
|
|
|
|
push(0);
|
|
|
|
break;
|
|
|
|
case 168:
|
2004-09-18 21:44:00 +00:00
|
|
|
pop();
|
2005-02-21 00:34:00 +00:00
|
|
|
spriteId = pop();
|
|
|
|
if (spriteId)
|
|
|
|
push(spriteInfoGet_field_44(spriteId));
|
2005-02-20 23:30:37 +00:00
|
|
|
else
|
|
|
|
push(0);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
default:
|
2005-02-20 11:14:50 +00:00
|
|
|
error("o90_getSpriteInfo: Unknown case %d", subOp);
|
2004-09-06 01:19:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-02-20 11:14:50 +00:00
|
|
|
void ScummEngine_v90he::o90_setSpriteInfo() {
|
2004-09-07 12:56:12 +00:00
|
|
|
int args[16];
|
2005-02-25 20:15:01 +00:00
|
|
|
int spriteId;
|
|
|
|
int32 tmp[2];
|
2005-02-21 02:02:32 +00:00
|
|
|
static int storedFields[2];
|
2005-02-22 22:23:10 +00:00
|
|
|
int n;
|
2005-02-22 01:37:57 +00:00
|
|
|
|
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
|
|
|
|
2005-03-08 03:52:02 +00:00
|
|
|
debug(0,"o90_setSpriteInfo (%d)", subOp);
|
2004-09-07 02:53:22 +00:00
|
|
|
switch (subOp) {
|
2004-09-18 21:44:00 +00:00
|
|
|
case 0:
|
2005-02-21 02:02:32 +00:00
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++) {
|
2005-02-23 04:05:22 +00:00
|
|
|
spriteInfoGet_dx_dy(spriteId, tmp[0], tmp[1]);
|
2005-02-21 02:02:32 +00:00
|
|
|
storedFields[0] = tmp[0];
|
2005-02-23 04:05:22 +00:00
|
|
|
spriteInfoSet_dx_dy(spriteId, args[0], tmp[1]);
|
2005-02-21 02:02:32 +00:00
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2005-02-21 02:02:32 +00:00
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++) {
|
2005-02-23 04:05:22 +00:00
|
|
|
spriteInfoGet_dx_dy(spriteId, tmp[0], tmp[1]);
|
2005-02-21 02:02:32 +00:00
|
|
|
storedFields[1] = tmp[1];
|
2005-02-23 04:05:22 +00:00
|
|
|
spriteInfoSet_dx_dy(spriteId, tmp[0], args[0]);
|
2005-02-21 02:02:32 +00:00
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2005-02-21 00:59:50 +00:00
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
|
|
|
spriteInfoSet_groupNum(spriteId, args[0]);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 8:
|
2005-02-21 02:02:32 +00:00
|
|
|
args[1] = pop();
|
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
|
|
|
switch(args[1]) {
|
|
|
|
case 0:
|
2005-03-17 09:42:31 +00:00
|
|
|
spriteInfoSet_flagXFlipped(spriteId, args[0]);
|
2005-02-21 02:02:32 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2005-03-17 09:42:31 +00:00
|
|
|
spriteInfoSet_flagYFlipped(spriteId, args[0]);
|
2005-02-21 02:02:32 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2005-02-24 21:05:29 +00:00
|
|
|
spriteInfoSet_flagActive(spriteId, args[0]);
|
2005-02-21 02:02:32 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2005-02-24 06:47:12 +00:00
|
|
|
spriteInfoSet_flag13(spriteId, args[0]);
|
2005-02-21 02:02:32 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
spriteInfoSet_flag20(spriteId, args[0]);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 9:
|
2005-02-21 00:59:50 +00:00
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
2005-03-14 12:54:24 +00:00
|
|
|
spriteInfoSet_zorderPriority(spriteId, args[0]);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 10:
|
2005-02-21 00:59:50 +00:00
|
|
|
args[1] = pop();
|
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
|
|
|
spriteInfoSet_Inc_tx_ty(spriteId, args[0], args[1]);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 18:
|
2005-02-21 00:59:50 +00:00
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
|
|
|
spriteInfoSet_resState(spriteId, args[0]);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 19:
|
2005-02-21 02:02:32 +00:00
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
|
|
|
spriteInfoSet_rotAngle(spriteId, args[0]);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 23:
|
2005-02-21 00:02:44 +00:00
|
|
|
if (_gameId == GID_FREDDI4 || _heversion >= 99) {
|
|
|
|
_curMaxSpriteId = pop();
|
|
|
|
_curSpriteId = pop();
|
|
|
|
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
SWAP(_curSpriteId, _curMaxSpriteId);
|
|
|
|
} else {
|
|
|
|
_curSpriteId = pop();
|
|
|
|
_curMaxSpriteId = _curSpriteId; // to make all functions happy
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 28: // HE99+
|
2005-02-21 00:02:44 +00:00
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
|
|
|
spriteInfoSet_field_7C(spriteId, args[0]);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 29:
|
2005-02-21 00:59:50 +00:00
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
2005-02-24 21:05:29 +00:00
|
|
|
spriteAddImageToList(spriteId, 1, &args[0]);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 31:
|
2005-02-21 00:59:50 +00:00
|
|
|
args[1] = pop();
|
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
|
|
|
spriteInfoSet_tx_ty(spriteId, args[0], args[1]);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 34:
|
2005-02-21 02:02:32 +00:00
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
2005-02-26 11:05:13 +00:00
|
|
|
spriteInfoSet_flagHasImage(spriteId, args[0]);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 43:
|
2005-02-21 00:59:50 +00:00
|
|
|
args[1] = pop();
|
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
2005-02-23 04:05:22 +00:00
|
|
|
spriteInfoSet_dx_dy(spriteId, args[0], args[1]);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 48:
|
2005-02-21 02:02:32 +00:00
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
2005-03-17 09:42:31 +00:00
|
|
|
spriteInfoSet_flag22(spriteId, args[0]);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 52: // HE 98+
|
2005-02-21 00:02:44 +00:00
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
|
|
|
spriteInfoSet_field_14(spriteId, args[0]);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
2004-10-02 07:46:06 +00:00
|
|
|
case 58: // HE 99+
|
2005-02-21 00:59:50 +00:00
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
|
|
|
spriteInfoSet_zoom(spriteId, args[0]);
|
2004-10-02 07:46:06 +00:00
|
|
|
break;
|
2004-09-30 09:35:02 +00:00
|
|
|
case 63: // HE 98+
|
2005-02-21 02:02:32 +00:00
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
2005-03-14 12:54:24 +00:00
|
|
|
spriteInfoSet_delay(spriteId, args[0]);
|
2004-09-30 09:35:02 +00:00
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 64:
|
2005-02-21 00:59:50 +00:00
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
|
|
|
spriteInfoSet_field_54(spriteId, args[0]);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 90:
|
2005-02-21 02:02:32 +00:00
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
2005-03-17 09:42:31 +00:00
|
|
|
spriteInfoSet_flag23(spriteId, args[0]);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 91:
|
2005-02-22 22:23:10 +00:00
|
|
|
n = getStackList(args, ARRAYSIZE(args));
|
|
|
|
if (_curSpriteId != 0 && _curMaxSpriteId != 0 && n != 0) {
|
|
|
|
int *p = &args[n - 1];
|
|
|
|
do {
|
|
|
|
int code = *p;
|
|
|
|
if (code == 0) {
|
|
|
|
for (int i = _curSpriteId; i <= _curMaxSpriteId; ++i) {
|
2005-02-22 22:52:35 +00:00
|
|
|
spriteInfoSet_resetClassFlags(i);
|
2005-02-22 22:23:10 +00:00
|
|
|
}
|
|
|
|
} else if (code & 0x80) {
|
|
|
|
for (int i = _curSpriteId; i <= _curMaxSpriteId; ++i) {
|
2005-02-23 11:15:41 +00:00
|
|
|
spriteInfoSet_setClassFlag(i, code & 0x7F, 1);
|
2005-02-22 22:23:10 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (int i = _curSpriteId; i <= _curMaxSpriteId; ++i) {
|
2005-02-23 11:15:41 +00:00
|
|
|
spriteInfoSet_setClassFlag(i, code & 0x7F, 0);
|
2005-02-22 22:23:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
--p;
|
|
|
|
} while (--n);
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
2004-10-10 06:32:02 +00:00
|
|
|
case 105: // HE 99+
|
2005-02-23 09:23:54 +00:00
|
|
|
args[1] = pop();
|
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
|
|
|
spriteInfoSet_field_88(spriteId, args[0], args[1]);
|
2004-10-10 06:32:02 +00:00
|
|
|
break;
|
|
|
|
case 106: // HE 99+
|
2005-02-21 00:02:44 +00:00
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
|
|
|
spriteInfoSet_field_80(spriteId, args[0]);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 124:
|
2005-02-21 02:02:32 +00:00
|
|
|
spritesResetTables(true);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 164:
|
2005-02-21 00:59:50 +00:00
|
|
|
args[1] = pop();
|
|
|
|
args[0] = pop();
|
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
|
|
|
spriteInfoSet_field_44(spriteId, args[0], args[1]);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 183:
|
2005-02-21 00:02:44 +00:00
|
|
|
if (_curSpriteId > _curMaxSpriteId)
|
|
|
|
break;
|
|
|
|
spriteId = _curSpriteId;
|
|
|
|
if (!spriteId)
|
|
|
|
spriteId++;
|
|
|
|
|
|
|
|
for (; spriteId <= _curMaxSpriteId; spriteId++)
|
2005-02-23 02:35:59 +00:00
|
|
|
spriteInfoSet_resetSprite(spriteId);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
default:
|
2005-02-20 11:14:50 +00:00
|
|
|
error("o90_setSpriteInfo: Unknown case %d", subOp);
|
2004-09-06 01:54:24 +00:00
|
|
|
}
|
2004-09-06 00:58:40 +00:00
|
|
|
}
|
|
|
|
|
2005-02-20 11:14:50 +00:00
|
|
|
void ScummEngine_v90he::o90_getSpriteGroupInfo() {
|
2005-02-21 01:08:48 +00:00
|
|
|
int32 tx, ty;
|
2005-02-21 02:37:05 +00:00
|
|
|
int spriteGroupId, type;
|
2005-02-21 01:08:48 +00:00
|
|
|
|
2004-10-10 00:24:15 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
2005-02-22 01:37:57 +00:00
|
|
|
|
2005-03-08 03:52:02 +00:00
|
|
|
debug(0,"o90_getSpriteGroupInfo (%d)", subOp);
|
2004-09-06 08:53:19 +00:00
|
|
|
switch (subOp) {
|
2004-09-30 10:24:26 +00:00
|
|
|
case 8: // HE 99+
|
2005-02-21 02:37:05 +00:00
|
|
|
spriteGroupId = pop();
|
|
|
|
if (spriteGroupId)
|
|
|
|
push(spriteGroupGet_allocateGroupSpritesList(spriteGroupId));
|
|
|
|
else
|
|
|
|
push(0);
|
2004-09-30 10:24:26 +00:00
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 30:
|
2005-02-21 02:37:05 +00:00
|
|
|
spriteGroupId = pop();
|
|
|
|
if (spriteGroupId) {
|
|
|
|
spriteGroupGet_tx_ty(spriteGroupId, tx, ty);
|
2005-02-21 01:08:48 +00:00
|
|
|
push(tx);
|
|
|
|
} else {
|
|
|
|
push(0);
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 31:
|
2005-02-21 02:37:05 +00:00
|
|
|
spriteGroupId = pop();
|
|
|
|
if (spriteGroupId) {
|
|
|
|
spriteGroupGet_tx_ty(spriteGroupId, tx, ty);
|
2005-02-21 01:08:48 +00:00
|
|
|
push(ty);
|
|
|
|
} else {
|
|
|
|
push(0);
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
2004-09-30 10:24:26 +00:00
|
|
|
case 42: // HE 99+
|
2005-02-21 01:08:48 +00:00
|
|
|
type = pop();
|
2005-02-21 02:37:05 +00:00
|
|
|
spriteGroupId = pop();
|
|
|
|
if (spriteGroupId) {
|
2005-02-21 01:08:48 +00:00
|
|
|
switch(type) {
|
|
|
|
case 0:
|
2005-02-26 11:22:00 +00:00
|
|
|
push(spriteGroupGet_scale_x_ratio_mul(spriteGroupId));
|
2005-02-21 01:08:48 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2005-02-26 11:22:00 +00:00
|
|
|
push(spriteGroupGet_scale_x_ratio_div(spriteGroupId));
|
2005-02-21 01:08:48 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2005-02-26 11:22:00 +00:00
|
|
|
push(spriteGroupGet_scale_y_ratio_mul(spriteGroupId));
|
2005-02-21 01:08:48 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2005-02-26 11:22:00 +00:00
|
|
|
push(spriteGroupGet_scale_y_ratio_div(spriteGroupId));
|
2005-02-21 01:08:48 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
push(0);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
push(0);
|
|
|
|
}
|
2004-09-30 10:24:26 +00:00
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 43:
|
2005-02-21 02:37:05 +00:00
|
|
|
spriteGroupId = pop();
|
2005-02-21 04:53:34 +00:00
|
|
|
if (spriteGroupId)
|
2005-02-26 11:22:00 +00:00
|
|
|
push(spriteGroupGet_zorderPriority(spriteGroupId));
|
2005-02-21 04:53:34 +00:00
|
|
|
else
|
2005-02-21 01:08:48 +00:00
|
|
|
push(0);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
2004-09-30 10:24:26 +00:00
|
|
|
case 63: // HE 99+
|
2005-02-21 02:37:05 +00:00
|
|
|
spriteGroupId = pop();
|
2005-02-21 04:53:34 +00:00
|
|
|
if (spriteGroupId)
|
2005-02-21 02:37:05 +00:00
|
|
|
push(spriteGroupGet_field_20(spriteGroupId));
|
2005-02-21 04:53:34 +00:00
|
|
|
else
|
2005-02-21 01:08:48 +00:00
|
|
|
push(0);
|
2004-09-30 10:24:26 +00:00
|
|
|
break;
|
|
|
|
case 139: // HE 99+
|
2005-02-21 01:08:48 +00:00
|
|
|
// dummy case
|
2004-09-30 10:24:26 +00:00
|
|
|
pop();
|
|
|
|
pop();
|
2005-02-21 01:08:48 +00:00
|
|
|
push(0);
|
2004-09-30 10:24:26 +00:00
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
default:
|
2005-02-20 11:14:50 +00:00
|
|
|
error("o90_getSpriteGroupInfo: Unknown case %d", subOp);
|
2004-09-06 08:53:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-02-20 11:14:50 +00:00
|
|
|
void ScummEngine_v90he::o90_setSpriteGroupInfo() {
|
2005-02-23 01:08:29 +00:00
|
|
|
int type, value1, value2, value3, value4;
|
|
|
|
|
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
|
|
|
|
2005-03-08 03:52:02 +00:00
|
|
|
debug(0,"o90_setSpriteGroupInfo (%d)", subOp);
|
2004-09-07 02:53:22 +00:00
|
|
|
switch (subOp) {
|
2004-10-17 09:17:32 +00:00
|
|
|
case 0:
|
2005-02-23 01:08:29 +00:00
|
|
|
type = pop() - 1;
|
|
|
|
switch (type) {
|
|
|
|
case 0:
|
|
|
|
value2 = pop();
|
|
|
|
value1 = pop();
|
|
|
|
if (!_curSpriteGroupId)
|
|
|
|
break;
|
|
|
|
|
|
|
|
spriteGroupSet_case0_0(_curSpriteGroupId, value1, value2);
|
|
|
|
break;
|
2004-10-17 09:17:32 +00:00
|
|
|
case 1:
|
2005-02-23 01:08:29 +00:00
|
|
|
value1 = pop();
|
|
|
|
if (!_curSpriteGroupId)
|
|
|
|
break;
|
|
|
|
|
|
|
|
spriteGroupSet_case0_1(_curSpriteGroupId, value1);
|
2004-10-17 09:17:32 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2005-02-23 01:08:29 +00:00
|
|
|
value1 = pop();
|
|
|
|
if (!_curSpriteGroupId)
|
|
|
|
break;
|
|
|
|
|
|
|
|
spriteGroupSet_case0_2(_curSpriteGroupId, value1);
|
2004-10-17 09:17:32 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2005-02-23 01:08:29 +00:00
|
|
|
value1 = pop();
|
|
|
|
if (!_curSpriteGroupId)
|
|
|
|
break;
|
|
|
|
|
|
|
|
spriteGroupSet_case0_3(_curSpriteGroupId, value1);
|
2004-10-17 09:17:32 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2005-02-23 01:08:29 +00:00
|
|
|
if (!_curSpriteGroupId)
|
|
|
|
break;
|
|
|
|
|
|
|
|
spriteGroupSet_case0_4(_curSpriteGroupId);
|
2004-10-17 09:17:32 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2005-02-23 01:08:29 +00:00
|
|
|
value1 = pop();
|
|
|
|
if (!_curSpriteGroupId)
|
|
|
|
break;
|
|
|
|
|
|
|
|
spriteGroupSet_case0_5(_curSpriteGroupId, value1);
|
2004-10-17 09:17:32 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
2005-02-23 01:08:29 +00:00
|
|
|
value1 = pop();
|
|
|
|
if (!_curSpriteGroupId)
|
|
|
|
break;
|
|
|
|
|
|
|
|
spriteGroupSet_case0_6(_curSpriteGroupId, value1);
|
2004-10-17 09:17:32 +00:00
|
|
|
break;
|
|
|
|
case 7:
|
2005-02-23 01:08:29 +00:00
|
|
|
value1 = pop();
|
|
|
|
if (!_curSpriteGroupId)
|
|
|
|
break;
|
|
|
|
|
|
|
|
spriteGroupSet_case0_7(_curSpriteGroupId, value1);
|
2004-10-17 09:17:32 +00:00
|
|
|
break;
|
|
|
|
default:
|
2005-02-20 11:14:50 +00:00
|
|
|
error("o90_setSpriteGroupInfo subOp 0: Unknown case %d", subOp);
|
2004-10-17 09:17:32 +00:00
|
|
|
}
|
|
|
|
break;
|
2004-10-10 06:32:02 +00:00
|
|
|
case 5:
|
2005-02-23 01:08:29 +00:00
|
|
|
type = pop();
|
|
|
|
value1 = pop();
|
|
|
|
if (!_curSpriteGroupId)
|
|
|
|
break;
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case 0:
|
2005-02-28 04:17:17 +00:00
|
|
|
spriteGroupSet_scale_x_ratio_mul(_curSpriteGroupId, value1);
|
2005-02-23 01:08:29 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2005-02-28 04:17:17 +00:00
|
|
|
spriteGroupSet_scale_x_ratio_div(_curSpriteGroupId, value1);
|
2005-02-23 01:08:29 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2005-02-28 04:17:17 +00:00
|
|
|
spriteGroupSet_scale_y_ratio_mul(_curSpriteGroupId, value1);
|
2005-02-23 01:08:29 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2005-02-28 04:17:17 +00:00
|
|
|
spriteGroupSet_scale_y_ratio_div(_curSpriteGroupId, value1);
|
2005-02-23 01:08:29 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("o90_setSpriteGroupInfo subOp 5: Unknown case %d", subOp);
|
|
|
|
}
|
2004-10-10 06:32:02 +00:00
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 6:
|
2005-02-23 01:08:29 +00:00
|
|
|
value1 = pop();
|
|
|
|
if (!_curSpriteGroupId)
|
|
|
|
break;
|
|
|
|
|
2005-02-26 11:22:00 +00:00
|
|
|
spriteGroupSet_zorderPriority(_curSpriteGroupId, value1);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 7:
|
2005-02-23 01:08:29 +00:00
|
|
|
value2 = pop();
|
|
|
|
value1 = pop();
|
|
|
|
if (!_curSpriteGroupId)
|
|
|
|
break;
|
|
|
|
|
2005-02-28 04:17:17 +00:00
|
|
|
spriteGroupSet_inc_tx_ty(_curSpriteGroupId, value1, value2);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 20:
|
2005-02-23 01:08:29 +00:00
|
|
|
_curSpriteGroupId = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
2004-10-17 09:17:32 +00:00
|
|
|
case 26:
|
2005-02-23 01:08:29 +00:00
|
|
|
value1 = pop();
|
|
|
|
if (!_curSpriteGroupId)
|
|
|
|
break;
|
|
|
|
|
2005-02-28 04:17:17 +00:00
|
|
|
spriteGroupSet_field_20(_curSpriteGroupId, value1);
|
2004-10-17 09:17:32 +00:00
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 28:
|
2005-02-23 01:08:29 +00:00
|
|
|
value2 = pop();
|
|
|
|
value1 = pop();
|
|
|
|
if (!_curSpriteGroupId)
|
|
|
|
break;
|
|
|
|
|
2005-02-28 04:17:17 +00:00
|
|
|
spriteGroupSet_tx_ty(_curSpriteGroupId, value1, value2);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 30:
|
2005-02-23 01:08:29 +00:00
|
|
|
value4 = pop();
|
|
|
|
value3 = pop();
|
|
|
|
value2 = pop();
|
|
|
|
value1 = pop();
|
|
|
|
if (!_curSpriteGroupId)
|
|
|
|
break;
|
|
|
|
|
2005-02-26 03:57:11 +00:00
|
|
|
spriteGroupSet_bbox(_curSpriteGroupId, value1, value2, value3, value4);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
2004-10-17 09:17:32 +00:00
|
|
|
case 56:
|
2005-02-23 01:08:29 +00:00
|
|
|
if (!_curSpriteGroupId)
|
|
|
|
break;
|
|
|
|
|
2005-03-17 09:28:36 +00:00
|
|
|
spriteGroupSet_flagClipBoxAnd(_curSpriteGroupId);
|
2004-10-17 09:17:32 +00:00
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
case 180:
|
2005-02-23 01:08:29 +00:00
|
|
|
if (!_curSpriteGroupId)
|
|
|
|
break;
|
|
|
|
|
2005-02-26 04:20:47 +00:00
|
|
|
spritesResetGroup(_curSpriteGroupId);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
default:
|
2005-02-20 11:14:50 +00:00
|
|
|
error("o90_setSpriteGroupInfo: Unknown case %d", subOp);
|
2004-09-06 02:39:02 +00:00
|
|
|
}
|
2004-09-07 03:42:15 +00:00
|
|
|
}
|
|
|
|
|
2004-11-22 20:34:29 +00:00
|
|
|
void ScummEngine_v90he::o90_getWizData() {
|
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:
|
2004-11-21 21:31:28 +00:00
|
|
|
y = pop();
|
|
|
|
x = pop();
|
|
|
|
state = pop();
|
|
|
|
resId = pop();
|
|
|
|
push(isWizPixelNonTransparent(rtImage, resId, state, x, y, 0));
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 36:
|
2004-11-21 21:31:28 +00:00
|
|
|
y = pop();
|
|
|
|
x = pop();
|
|
|
|
state = pop();
|
|
|
|
resId = pop();
|
|
|
|
push(getWizPixelColor(rtImage, resId, state, x, y, 0));
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
2004-11-22 20:34:29 +00:00
|
|
|
case 100:
|
|
|
|
h = pop();
|
|
|
|
w = pop();
|
|
|
|
y = pop();
|
|
|
|
x = pop();
|
|
|
|
state = pop();
|
|
|
|
resId = pop();
|
|
|
|
if (x == -1 && y == -1 && w == -1 && h == -1) {
|
|
|
|
getWizImageDim(resId, state, w, h);
|
|
|
|
x = 0;
|
|
|
|
y = 0;
|
|
|
|
}
|
|
|
|
push(computeWizHistogram(resId, state, x, y, w, h));
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
2004-11-13 04:05:35 +00:00
|
|
|
case 109:
|
|
|
|
pop();
|
|
|
|
pop();
|
|
|
|
push(0);
|
|
|
|
break;
|
2004-09-18 21:44:00 +00:00
|
|
|
default:
|
2004-11-22 20:34:29 +00:00
|
|
|
error("o90_getWizData: Unknown case %d", subOp);
|
2004-09-07 03:42:15 +00:00
|
|
|
}
|
2004-09-06 02:39:02 +00:00
|
|
|
}
|
|
|
|
|
2005-02-27 01:20:44 +00:00
|
|
|
void ScummEngine_v90he::o90_floodState() {
|
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:
|
2005-02-27 02:29:54 +00:00
|
|
|
_floodStateParams.field_1C = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2005-02-27 02:29:54 +00:00
|
|
|
memset(&_floodStateParams, 0, sizeof(_floodStateParams));
|
|
|
|
_floodStateParams.box.left = 0;
|
|
|
|
_floodStateParams.box.top = 0;
|
|
|
|
_floodStateParams.box.right = 640;
|
|
|
|
_floodStateParams.box.bottom = 480;
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 11:
|
2005-02-27 02:29:54 +00:00
|
|
|
_floodStateParams.field_14 = pop();
|
|
|
|
_floodStateParams.field_10 = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 12:
|
2005-02-27 02:29:54 +00:00
|
|
|
_floodStateParams.field_18 = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 13:
|
2005-02-27 02:29:54 +00:00
|
|
|
_floodStateParams.box.bottom = pop();
|
|
|
|
_floodStateParams.box.right = pop();
|
|
|
|
_floodStateParams.box.top = pop();
|
|
|
|
_floodStateParams.box.left = pop();
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 201:
|
2005-02-27 02:29:54 +00:00
|
|
|
//floodState(_floodStateParams);
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
default:
|
2005-02-27 01:20:44 +00:00
|
|
|
error("o90_floodState: Unknown case %d", subOp);
|
2004-09-10 14:31:20 +00:00
|
|
|
}
|
2005-02-27 01:20:44 +00:00
|
|
|
debug(1,"o90_floodState stub (%d)", subOp);
|
2004-09-10 14:31:20 +00:00
|
|
|
}
|
|
|
|
|
2004-11-28 05:33:33 +00:00
|
|
|
void ScummEngine_v90he::o90_shl() {
|
|
|
|
int a = pop();
|
2004-09-30 09:35:02 +00:00
|
|
|
push(pop() << a);
|
|
|
|
}
|
|
|
|
|
2004-11-28 05:33:33 +00:00
|
|
|
void ScummEngine_v90he::o90_shr() {
|
|
|
|
int a = pop();
|
2004-09-30 09:35:02 +00:00
|
|
|
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];
|
|
|
|
}
|
2004-11-27 17:50:23 +00:00
|
|
|
push(_wiz.polygonContains(wp, args2[0], args2[1]) ? 1 : 0);
|
2004-10-09 16:10:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2004-09-30 09:54:45 +00:00
|
|
|
// HE 98+
|
|
|
|
case 6:
|
|
|
|
case 7:
|
|
|
|
case 8:
|
|
|
|
case 9:
|
2005-02-24 11:49:07 +00:00
|
|
|
case 10:
|
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-11-26 20:17:02 +00:00
|
|
|
void ScummEngine_v90he::o90_cond() {
|
2004-09-12 11:15:26 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2005-03-07 10:21:23 +00:00
|
|
|
void ScummEngine_v90he::o90_redim2dimArray() {
|
|
|
|
int a, b, c, d;
|
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
|
|
|
|
byte subOp = fetchScriptByte();
|
|
|
|
|
|
|
|
switch (subOp) {
|
|
|
|
case 4:
|
|
|
|
redimArray(fetchScriptWord(), a, b, c, d, kByteArray);
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
redimArray(fetchScriptWord(), a, b, c, d, kIntArray);
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
redimArray(fetchScriptWord(), a, b, c, d, kDwordArray);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("o90_redim2dimArray: default type %d", subOp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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:
|
2005-02-01 04:58:14 +00:00
|
|
|
case 134: // HE100
|
2004-09-18 21:44:00 +00:00
|
|
|
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:
|
2005-03-12 23:59:14 +00:00
|
|
|
push(getObjectImageCount(_heObject));
|
2004-10-02 01:40:34 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2005-03-02 20:02:59 +00:00
|
|
|
uint8 *ScummEngine_v90he::getHEPalette(int palSlot) {
|
2005-03-03 02:51:15 +00:00
|
|
|
assert(palSlot >= 1 && palSlot <= _numPalettes);
|
2005-03-02 20:02:59 +00:00
|
|
|
if (palSlot == 1) {
|
|
|
|
return _currentPalette; // XXX won't work, as size == 768
|
|
|
|
} else {
|
|
|
|
return _hePalettes + (palSlot - 2) * 1024;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v90he::setHEPaletteColor(int palSlot, uint8 color, uint8 r, uint8 g, uint8 b) {
|
2005-03-03 02:51:15 +00:00
|
|
|
assert(palSlot >= 1 && palSlot <= _numPalettes);
|
2005-03-02 20:02:59 +00:00
|
|
|
uint8 *p = _hePalettes + palSlot * 1024 + color * 3;
|
|
|
|
*(p + 0) = r;
|
|
|
|
*(p + 1) = g;
|
|
|
|
*(p + 2) = b;
|
|
|
|
*(_hePalettes + palSlot * 1024 + 768 + color) = color;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v90he::setHEPaletteFromPtr(int palSlot, const uint8 *palData) {
|
2005-03-03 02:51:15 +00:00
|
|
|
assert(palSlot >= 1 && palSlot <= _numPalettes);
|
2005-03-02 20:02:59 +00:00
|
|
|
uint8 *pc = _hePalettes + palSlot * 1024;
|
|
|
|
uint8 *pi = pc + 768;
|
|
|
|
for (int i = 0; i < 256; ++i) {
|
|
|
|
*pc++ = *palData++;
|
|
|
|
*pc++ = *palData++;
|
|
|
|
*pc++ = *palData++;
|
|
|
|
*pi++ = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v90he::setHEPaletteFromCostume(int palSlot, int resId) {
|
2005-03-03 02:51:15 +00:00
|
|
|
assert(palSlot >= 1 && palSlot <= _numPalettes);
|
2005-03-02 20:02:59 +00:00
|
|
|
const uint8 *data = getResourceAddress(rtCostume, resId);
|
|
|
|
assert(data);
|
|
|
|
const uint8 *rgbs = findResourceData(MKID('RGBS'), data);
|
|
|
|
assert(rgbs);
|
|
|
|
setHEPaletteFromPtr(palSlot, rgbs);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v90he::setHEPaletteFromImage(int palSlot, int resId, int state) {
|
2005-03-03 02:51:15 +00:00
|
|
|
assert(palSlot >= 1 && palSlot <= _numPalettes);
|
2005-03-10 11:06:37 +00:00
|
|
|
uint8 *data = getResourceAddress(rtImage, resId);
|
2005-03-02 20:02:59 +00:00
|
|
|
assert(data);
|
2005-03-10 11:06:37 +00:00
|
|
|
uint8 *rgbs = findWrappedBlock(MKID('RGBS'), data, state, 0);
|
2005-03-02 20:02:59 +00:00
|
|
|
assert(rgbs);
|
|
|
|
setHEPaletteFromPtr(palSlot, rgbs);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v90he::setHEPaletteFromRoom(int palSlot, int resId, int state) {
|
2005-03-03 02:51:15 +00:00
|
|
|
assert(palSlot >= 1 && palSlot <= _numPalettes);
|
2005-03-10 11:06:37 +00:00
|
|
|
uint8 *data = getResourceAddress(rtRoom, resId);
|
2005-03-02 20:02:59 +00:00
|
|
|
assert(data);
|
2005-03-10 11:06:37 +00:00
|
|
|
uint8 *rgbs = findWrappedBlock(MKID('PALS'), data, state, 0);
|
2005-03-02 20:02:59 +00:00
|
|
|
assert(rgbs);
|
|
|
|
setHEPaletteFromPtr(palSlot, rgbs);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v90he::restoreHEPalette(int palSlot) {
|
2005-03-03 02:51:15 +00:00
|
|
|
assert(palSlot >= 1 && palSlot <= _numPalettes);
|
2005-03-02 20:02:59 +00:00
|
|
|
if (palSlot != 1) {
|
|
|
|
memcpy(_hePalettes + palSlot * 1024, _hePalettes + 1024, 1024);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v90he::copyHEPalette(int dstPalSlot, int srcPalSlot) {
|
2005-03-03 02:51:15 +00:00
|
|
|
assert(dstPalSlot >= 1 && dstPalSlot <= _numPalettes);
|
|
|
|
assert(srcPalSlot >= 1 && srcPalSlot <= _numPalettes);
|
2005-03-02 20:02:59 +00:00
|
|
|
if (dstPalSlot != srcPalSlot) {
|
|
|
|
memcpy(_hePalettes + srcPalSlot * 1024, _hePalettes + dstPalSlot * 1024, 1024);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v90he::copyHEPaletteColor(int palSlot, uint8 dstColor, uint8 srcColor) {
|
2005-03-03 02:51:15 +00:00
|
|
|
assert(palSlot >= 1 && palSlot <= _numPalettes);
|
2005-03-02 20:02:59 +00:00
|
|
|
uint8 *dstPal = _hePalettes + palSlot * 1024 + dstColor * 3;
|
|
|
|
uint8 *srcPal = _hePalettes + (palSlot + 1) * 1024 + srcColor * 3;
|
|
|
|
memcpy(dstPal, srcPal, 3);
|
|
|
|
*(_hePalettes + palSlot * 1024 + 768 + dstColor) = srcColor;
|
|
|
|
}
|
|
|
|
|
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:
|
|
|
|
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() {
|
2005-03-02 23:57:20 +00:00
|
|
|
int a, b, c, d, e;
|
2004-10-04 04:04:37 +00:00
|
|
|
|
|
|
|
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:
|
2005-03-02 23:57:20 +00:00
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
if (_hePaletteNum != 0) {
|
|
|
|
setHEPaletteFromImage(_hePaletteNum, a, b);
|
2004-10-04 04:04:37 +00:00
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 9:
|
2005-03-02 23:57:20 +00:00
|
|
|
e = pop();
|
|
|
|
d = pop();
|
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
if (_hePaletteNum != 0) {
|
|
|
|
for (; a <= b; ++a) {
|
|
|
|
setHEPaletteColor(_hePaletteNum, a, c, d, e);
|
|
|
|
}
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 13:
|
2005-03-02 23:57:20 +00:00
|
|
|
c = pop();
|
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
if (_hePaletteNum) {
|
|
|
|
for (; a <= b; ++a) {
|
|
|
|
copyHEPaletteColor(_hePaletteNum, a, c);
|
|
|
|
}
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 19: //HE99+
|
2005-03-02 23:57:20 +00:00
|
|
|
a = pop();
|
|
|
|
if (_hePaletteNum != 0) {
|
|
|
|
setHEPaletteFromCostume(_hePaletteNum, a);
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 29:
|
2005-03-02 23:57:20 +00:00
|
|
|
a = pop();
|
|
|
|
if (_hePaletteNum != 0) {
|
|
|
|
copyHEPalette(_hePaletteNum, a);
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 118:
|
2005-03-02 23:57:20 +00:00
|
|
|
b = pop();
|
|
|
|
a = pop();
|
|
|
|
if (_hePaletteNum != 0) {
|
|
|
|
setHEPaletteFromRoom(_hePaletteNum, a, b);
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
break;
|
|
|
|
case 160:
|
2005-03-02 23:57:20 +00:00
|
|
|
if (_hePaletteNum != 0) {
|
|
|
|
restoreHEPalette(_hePaletteNum);
|
|
|
|
}
|
2004-09-18 21:44:00 +00:00
|
|
|
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
|
|
|
}
|
2005-01-31 00:27:31 +00:00
|
|
|
debug(1,"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-24 13:43:36 +00:00
|
|
|
// Font related
|
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();
|
2004-10-24 13:43:36 +00:00
|
|
|
if (a == 2) {
|
2004-10-09 23:45:04 +00:00
|
|
|
copyScriptString(string);
|
2004-10-24 13:43:36 +00:00
|
|
|
push(-1);
|
|
|
|
} else if (a == 1) {
|
2004-10-01 23:56:39 +00:00
|
|
|
pop();
|
2004-10-24 13:43:36 +00:00
|
|
|
writeVar(0, 0);
|
|
|
|
defineArray(0, kStringArray, 0, 0, 0, 0);
|
|
|
|
writeArray(0, 0, 0, 0);
|
|
|
|
push(readVar(0));
|
|
|
|
}
|
2004-10-01 23:56:39 +00:00
|
|
|
break;
|
|
|
|
case 57:
|
2004-10-24 13:43:36 +00:00
|
|
|
push(1);
|
2004-10-01 23:56:39 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("o90_unknownA5: Unknown case %d", subOp);
|
|
|
|
}
|
|
|
|
|
|
|
|
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());
|
|
|
|
}
|
|
|
|
|
2005-03-23 00:16:51 +00:00
|
|
|
void ScummEngine_v90he::o90_kernelGetFunctions() {
|
|
|
|
int args[29];
|
|
|
|
int num;
|
|
|
|
|
|
|
|
num = getStackList(args, ARRAYSIZE(args));
|
|
|
|
|
|
|
|
switch (args[0]) {
|
|
|
|
case 1001:
|
|
|
|
{
|
|
|
|
double a = args[1] * PI / 180.;
|
|
|
|
push((int)(sin(a) * 100000));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1002:
|
|
|
|
{
|
|
|
|
double a = args[1] * PI / 180.;
|
|
|
|
push((int)(cos(a) * 100000));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2001:
|
|
|
|
// Used in football
|
|
|
|
warning("o90_kernelGetFunctions: U32 code (Num %d, args1 %d args 2 %d)", num, args[1], args[2]);
|
|
|
|
push(0);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("o90_kernelGetFunctions: default case %d", args[0]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v90he::o90_kernelSetFunctions() {
|
|
|
|
int args[29];
|
|
|
|
int num;
|
|
|
|
Actor *a;
|
|
|
|
|
|
|
|
num = getStackList(args, ARRAYSIZE(args));
|
|
|
|
|
|
|
|
debug(1, "o90_kernelSetFunctions: case %d (param count %d)", args[0], num);
|
|
|
|
switch (args[0]) {
|
|
|
|
case 20:
|
|
|
|
a = derefActor(args[1], "o90_kernelSetFunctions: 20");
|
|
|
|
queueAuxBlock(a);
|
|
|
|
break;
|
|
|
|
case 21:
|
|
|
|
_skipDrawObject = 1;
|
|
|
|
break;
|
|
|
|
case 22:
|
|
|
|
_skipDrawObject = 0;
|
|
|
|
break;
|
|
|
|
case 23:
|
|
|
|
_charset->clearCharsetMask();
|
|
|
|
_fullRedraw = 1;
|
|
|
|
break;
|
|
|
|
case 24:
|
|
|
|
_skipProcessActors = 1;
|
|
|
|
_fullRedraw = 1;
|
|
|
|
break;
|
|
|
|
case 25:
|
|
|
|
_skipProcessActors = 0;
|
|
|
|
_fullRedraw = 1;
|
|
|
|
break;
|
|
|
|
case 42:
|
|
|
|
// drawWizImage related
|
|
|
|
warning("o90_kernelSetFunctions: unhandled case 42");
|
|
|
|
break;
|
|
|
|
case 43:
|
|
|
|
// drawWizImage related
|
|
|
|
warning("o90_kernelSetFunctions: unhandled case 43");
|
|
|
|
break;
|
|
|
|
case 714:
|
|
|
|
break;
|
|
|
|
case 1492:
|
|
|
|
spriteInfoSet_flag13(args[1], args[2]);
|
|
|
|
break;
|
|
|
|
case 2001:
|
|
|
|
// Used in SoccerMLS/Soccer2004
|
|
|
|
warning("o90_kernelSetFunctions: U32 code (Num %d, args1 %d args 2 %d)", num, args[1], args[2]);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("o90_kernelSetFunctions: default case %d (param count %d)", args[0], num);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-06 00:58:40 +00:00
|
|
|
} // End of namespace Scumm
|