2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2002-12-12 16:29:21 +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.
|
2014-02-18 01:34:24 +00:00
|
|
|
*
|
2002-12-12 16:29:21 +00:00
|
|
|
* 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.
|
2014-02-18 01:34:24 +00:00
|
|
|
*
|
2002-12-12 16:29:21 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-12-12 16:29:21 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2003-09-11 10:32:15 +00:00
|
|
|
#include "scumm/actor.h"
|
|
|
|
#include "scumm/charset.h"
|
|
|
|
#include "scumm/object.h"
|
2011-05-11 14:03:50 +00:00
|
|
|
#include "scumm/resource.h"
|
2009-03-20 16:33:58 +00:00
|
|
|
#include "scumm/scumm_v3.h"
|
|
|
|
#include "scumm/scumm_v5.h"
|
2003-09-11 10:32:15 +00:00
|
|
|
#include "scumm/sound.h"
|
2013-11-01 12:53:43 +00:00
|
|
|
#include "scumm/players/player_towns.h"
|
2005-04-10 12:59:17 +00:00
|
|
|
#include "scumm/util.h"
|
2003-09-11 10:32:15 +00:00
|
|
|
#include "scumm/verbs.h"
|
2005-04-10 12:59:17 +00:00
|
|
|
|
2005-01-10 22:06:49 +00:00
|
|
|
#include "common/savefile.h"
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2003-10-03 18:33:57 +00:00
|
|
|
namespace Scumm {
|
|
|
|
|
2009-04-16 09:26:37 +00:00
|
|
|
#define OPCODE(i, x) _opcodes[i]._OPCODE(ScummEngine_v5, x)
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::setupOpcodes() {
|
2009-04-16 09:26:37 +00:00
|
|
|
/* 00 */
|
|
|
|
OPCODE(0x00, o5_stopObjectCode);
|
|
|
|
OPCODE(0x01, o5_putActor);
|
|
|
|
OPCODE(0x02, o5_startMusic);
|
|
|
|
OPCODE(0x03, o5_getActorRoom);
|
|
|
|
/* 04 */
|
|
|
|
OPCODE(0x04, o5_isGreaterEqual);
|
|
|
|
OPCODE(0x05, o5_drawObject);
|
|
|
|
OPCODE(0x06, o5_getActorElevation);
|
|
|
|
OPCODE(0x07, o5_setState);
|
|
|
|
/* 08 */
|
|
|
|
OPCODE(0x08, o5_isNotEqual);
|
|
|
|
OPCODE(0x09, o5_faceActor);
|
|
|
|
OPCODE(0x0a, o5_startScript);
|
|
|
|
OPCODE(0x0b, o5_getVerbEntrypoint);
|
|
|
|
/* 0C */
|
|
|
|
OPCODE(0x0c, o5_resourceRoutines);
|
|
|
|
OPCODE(0x0d, o5_walkActorToActor);
|
|
|
|
OPCODE(0x0e, o5_putActorAtObject);
|
|
|
|
OPCODE(0x0f, o5_getObjectState);
|
|
|
|
/* 10 */
|
|
|
|
OPCODE(0x10, o5_getObjectOwner);
|
|
|
|
OPCODE(0x11, o5_animateActor);
|
|
|
|
OPCODE(0x12, o5_panCameraTo);
|
|
|
|
OPCODE(0x13, o5_actorOps);
|
|
|
|
/* 14 */
|
|
|
|
OPCODE(0x14, o5_print);
|
|
|
|
OPCODE(0x15, o5_actorFromPos);
|
|
|
|
OPCODE(0x16, o5_getRandomNr);
|
|
|
|
OPCODE(0x17, o5_and);
|
|
|
|
/* 18 */
|
|
|
|
OPCODE(0x18, o5_jumpRelative);
|
|
|
|
OPCODE(0x19, o5_doSentence);
|
|
|
|
OPCODE(0x1a, o5_move);
|
|
|
|
OPCODE(0x1b, o5_multiply);
|
|
|
|
/* 1C */
|
|
|
|
OPCODE(0x1c, o5_startSound);
|
|
|
|
OPCODE(0x1d, o5_ifClassOfIs);
|
|
|
|
OPCODE(0x1e, o5_walkActorTo);
|
|
|
|
OPCODE(0x1f, o5_isActorInBox);
|
|
|
|
/* 20 */
|
|
|
|
OPCODE(0x20, o5_stopMusic);
|
|
|
|
OPCODE(0x21, o5_putActor);
|
|
|
|
OPCODE(0x22, o5_getAnimCounter);
|
|
|
|
OPCODE(0x23, o5_getActorY);
|
|
|
|
/* 24 */
|
|
|
|
OPCODE(0x24, o5_loadRoomWithEgo);
|
|
|
|
OPCODE(0x25, o5_pickupObject);
|
|
|
|
OPCODE(0x26, o5_setVarRange);
|
|
|
|
OPCODE(0x27, o5_stringOps);
|
|
|
|
/* 28 */
|
|
|
|
OPCODE(0x28, o5_equalZero);
|
|
|
|
OPCODE(0x29, o5_setOwnerOf);
|
|
|
|
OPCODE(0x2a, o5_startScript);
|
|
|
|
OPCODE(0x2b, o5_delayVariable);
|
|
|
|
/* 2C */
|
|
|
|
OPCODE(0x2c, o5_cursorCommand);
|
|
|
|
OPCODE(0x2d, o5_putActorInRoom);
|
|
|
|
OPCODE(0x2e, o5_delay);
|
2009-04-19 01:01:28 +00:00
|
|
|
// OPCODE(0x2f, o5_ifNotState);
|
2009-04-16 09:26:37 +00:00
|
|
|
/* 30 */
|
|
|
|
OPCODE(0x30, o5_matrixOps);
|
|
|
|
OPCODE(0x31, o5_getInventoryCount);
|
|
|
|
OPCODE(0x32, o5_setCameraAt);
|
|
|
|
OPCODE(0x33, o5_roomOps);
|
|
|
|
/* 34 */
|
|
|
|
OPCODE(0x34, o5_getDist);
|
|
|
|
OPCODE(0x35, o5_findObject);
|
|
|
|
OPCODE(0x36, o5_walkActorToObject);
|
|
|
|
OPCODE(0x37, o5_startObject);
|
|
|
|
/* 38 */
|
2009-04-20 12:35:17 +00:00
|
|
|
OPCODE(0x38, o5_isLessEqual);
|
2009-04-16 09:26:37 +00:00
|
|
|
OPCODE(0x39, o5_doSentence);
|
|
|
|
OPCODE(0x3a, o5_subtract);
|
|
|
|
OPCODE(0x3b, o5_getActorScale);
|
|
|
|
/* 3C */
|
|
|
|
OPCODE(0x3c, o5_stopSound);
|
|
|
|
OPCODE(0x3d, o5_findInventory);
|
|
|
|
OPCODE(0x3e, o5_walkActorTo);
|
|
|
|
OPCODE(0x3f, o5_drawBox);
|
|
|
|
/* 40 */
|
|
|
|
OPCODE(0x40, o5_cutscene);
|
|
|
|
OPCODE(0x41, o5_putActor);
|
|
|
|
OPCODE(0x42, o5_chainScript);
|
|
|
|
OPCODE(0x43, o5_getActorX);
|
|
|
|
/* 44 */
|
|
|
|
OPCODE(0x44, o5_isLess);
|
2009-04-19 01:00:49 +00:00
|
|
|
// OPCODE(0x45, o5_drawObject);
|
2009-04-16 09:26:37 +00:00
|
|
|
OPCODE(0x46, o5_increment);
|
|
|
|
OPCODE(0x47, o5_setState);
|
|
|
|
/* 48 */
|
|
|
|
OPCODE(0x48, o5_isEqual);
|
|
|
|
OPCODE(0x49, o5_faceActor);
|
|
|
|
OPCODE(0x4a, o5_startScript);
|
|
|
|
OPCODE(0x4b, o5_getVerbEntrypoint);
|
|
|
|
/* 4C */
|
|
|
|
OPCODE(0x4c, o5_soundKludge);
|
|
|
|
OPCODE(0x4d, o5_walkActorToActor);
|
|
|
|
OPCODE(0x4e, o5_putActorAtObject);
|
2009-04-19 01:01:28 +00:00
|
|
|
// OPCODE(0x4f, o5_ifState);
|
2009-04-16 09:26:37 +00:00
|
|
|
/* 50 */
|
2009-04-19 01:00:11 +00:00
|
|
|
// OPCODE(0x50, o5_pickupObjectOld);
|
2009-04-16 09:26:37 +00:00
|
|
|
OPCODE(0x51, o5_animateActor);
|
|
|
|
OPCODE(0x52, o5_actorFollowCamera);
|
|
|
|
OPCODE(0x53, o5_actorOps);
|
|
|
|
/* 54 */
|
|
|
|
OPCODE(0x54, o5_setObjectName);
|
|
|
|
OPCODE(0x55, o5_actorFromPos);
|
|
|
|
OPCODE(0x56, o5_getActorMoving);
|
|
|
|
OPCODE(0x57, o5_or);
|
|
|
|
/* 58 */
|
|
|
|
OPCODE(0x58, o5_beginOverride);
|
|
|
|
OPCODE(0x59, o5_doSentence);
|
|
|
|
OPCODE(0x5a, o5_add);
|
|
|
|
OPCODE(0x5b, o5_divide);
|
|
|
|
/* 5C */
|
2009-04-19 01:01:09 +00:00
|
|
|
// OPCODE(0x5c, o5_oldRoomEffect);
|
2009-04-16 09:26:37 +00:00
|
|
|
OPCODE(0x5d, o5_setClass);
|
|
|
|
OPCODE(0x5e, o5_walkActorTo);
|
|
|
|
OPCODE(0x5f, o5_isActorInBox);
|
|
|
|
/* 60 */
|
|
|
|
OPCODE(0x60, o5_freezeScripts);
|
|
|
|
OPCODE(0x61, o5_putActor);
|
|
|
|
OPCODE(0x62, o5_stopScript);
|
|
|
|
OPCODE(0x63, o5_getActorFacing);
|
|
|
|
/* 64 */
|
|
|
|
OPCODE(0x64, o5_loadRoomWithEgo);
|
|
|
|
OPCODE(0x65, o5_pickupObject);
|
|
|
|
OPCODE(0x66, o5_getClosestObjActor);
|
|
|
|
OPCODE(0x67, o5_getStringWidth);
|
|
|
|
/* 68 */
|
|
|
|
OPCODE(0x68, o5_isScriptRunning);
|
|
|
|
OPCODE(0x69, o5_setOwnerOf);
|
|
|
|
OPCODE(0x6a, o5_startScript);
|
|
|
|
OPCODE(0x6b, o5_debug);
|
|
|
|
/* 6C */
|
|
|
|
OPCODE(0x6c, o5_getActorWidth);
|
|
|
|
OPCODE(0x6d, o5_putActorInRoom);
|
|
|
|
OPCODE(0x6e, o5_stopObjectScript);
|
2009-04-19 01:01:28 +00:00
|
|
|
// OPCODE(0x6f, o5_ifNotState);
|
2009-04-16 09:26:37 +00:00
|
|
|
/* 70 */
|
|
|
|
OPCODE(0x70, o5_lights);
|
|
|
|
OPCODE(0x71, o5_getActorCostume);
|
|
|
|
OPCODE(0x72, o5_loadRoom);
|
|
|
|
OPCODE(0x73, o5_roomOps);
|
|
|
|
/* 74 */
|
|
|
|
OPCODE(0x74, o5_getDist);
|
|
|
|
OPCODE(0x75, o5_findObject);
|
|
|
|
OPCODE(0x76, o5_walkActorToObject);
|
|
|
|
OPCODE(0x77, o5_startObject);
|
|
|
|
/* 78 */
|
|
|
|
OPCODE(0x78, o5_isGreater);
|
|
|
|
OPCODE(0x79, o5_doSentence);
|
|
|
|
OPCODE(0x7a, o5_verbOps);
|
|
|
|
OPCODE(0x7b, o5_getActorWalkBox);
|
|
|
|
/* 7C */
|
|
|
|
OPCODE(0x7c, o5_isSoundRunning);
|
|
|
|
OPCODE(0x7d, o5_findInventory);
|
|
|
|
OPCODE(0x7e, o5_walkActorTo);
|
|
|
|
OPCODE(0x7f, o5_drawBox);
|
|
|
|
/* 80 */
|
|
|
|
OPCODE(0x80, o5_breakHere);
|
|
|
|
OPCODE(0x81, o5_putActor);
|
|
|
|
OPCODE(0x82, o5_startMusic);
|
|
|
|
OPCODE(0x83, o5_getActorRoom);
|
|
|
|
/* 84 */
|
|
|
|
OPCODE(0x84, o5_isGreaterEqual);
|
|
|
|
OPCODE(0x85, o5_drawObject);
|
|
|
|
OPCODE(0x86, o5_getActorElevation);
|
|
|
|
OPCODE(0x87, o5_setState);
|
|
|
|
/* 88 */
|
|
|
|
OPCODE(0x88, o5_isNotEqual);
|
|
|
|
OPCODE(0x89, o5_faceActor);
|
|
|
|
OPCODE(0x8a, o5_startScript);
|
|
|
|
OPCODE(0x8b, o5_getVerbEntrypoint);
|
|
|
|
/* 8C */
|
|
|
|
OPCODE(0x8c, o5_resourceRoutines);
|
|
|
|
OPCODE(0x8d, o5_walkActorToActor);
|
|
|
|
OPCODE(0x8e, o5_putActorAtObject);
|
|
|
|
OPCODE(0x8f, o5_getObjectState);
|
|
|
|
/* 90 */
|
|
|
|
OPCODE(0x90, o5_getObjectOwner);
|
|
|
|
OPCODE(0x91, o5_animateActor);
|
|
|
|
OPCODE(0x92, o5_panCameraTo);
|
|
|
|
OPCODE(0x93, o5_actorOps);
|
|
|
|
/* 94 */
|
|
|
|
OPCODE(0x94, o5_print);
|
|
|
|
OPCODE(0x95, o5_actorFromPos);
|
|
|
|
OPCODE(0x96, o5_getRandomNr);
|
|
|
|
OPCODE(0x97, o5_and);
|
|
|
|
/* 98 */
|
|
|
|
OPCODE(0x98, o5_systemOps);
|
|
|
|
OPCODE(0x99, o5_doSentence);
|
|
|
|
OPCODE(0x9a, o5_move);
|
|
|
|
OPCODE(0x9b, o5_multiply);
|
|
|
|
/* 9C */
|
|
|
|
OPCODE(0x9c, o5_startSound);
|
|
|
|
OPCODE(0x9d, o5_ifClassOfIs);
|
|
|
|
OPCODE(0x9e, o5_walkActorTo);
|
|
|
|
OPCODE(0x9f, o5_isActorInBox);
|
|
|
|
/* A0 */
|
|
|
|
OPCODE(0xa0, o5_stopObjectCode);
|
|
|
|
OPCODE(0xa1, o5_putActor);
|
|
|
|
OPCODE(0xa2, o5_getAnimCounter);
|
|
|
|
OPCODE(0xa3, o5_getActorY);
|
|
|
|
/* A4 */
|
|
|
|
OPCODE(0xa4, o5_loadRoomWithEgo);
|
|
|
|
OPCODE(0xa5, o5_pickupObject);
|
|
|
|
OPCODE(0xa6, o5_setVarRange);
|
2009-04-19 01:01:54 +00:00
|
|
|
OPCODE(0xa7, o5_dummy);
|
2009-04-16 09:26:37 +00:00
|
|
|
/* A8 */
|
|
|
|
OPCODE(0xa8, o5_notEqualZero);
|
|
|
|
OPCODE(0xa9, o5_setOwnerOf);
|
|
|
|
OPCODE(0xaa, o5_startScript);
|
|
|
|
OPCODE(0xab, o5_saveRestoreVerbs);
|
|
|
|
/* AC */
|
|
|
|
OPCODE(0xac, o5_expression);
|
|
|
|
OPCODE(0xad, o5_putActorInRoom);
|
|
|
|
OPCODE(0xae, o5_wait);
|
2009-04-19 01:01:28 +00:00
|
|
|
// OPCODE(0xaf, o5_ifNotState);
|
2009-04-16 09:26:37 +00:00
|
|
|
/* B0 */
|
|
|
|
OPCODE(0xb0, o5_matrixOps);
|
|
|
|
OPCODE(0xb1, o5_getInventoryCount);
|
|
|
|
OPCODE(0xb2, o5_setCameraAt);
|
|
|
|
OPCODE(0xb3, o5_roomOps);
|
|
|
|
/* B4 */
|
|
|
|
OPCODE(0xb4, o5_getDist);
|
|
|
|
OPCODE(0xb5, o5_findObject);
|
|
|
|
OPCODE(0xb6, o5_walkActorToObject);
|
|
|
|
OPCODE(0xb7, o5_startObject);
|
|
|
|
/* B8 */
|
2009-04-20 12:35:17 +00:00
|
|
|
OPCODE(0xb8, o5_isLessEqual);
|
2009-04-16 09:26:37 +00:00
|
|
|
OPCODE(0xb9, o5_doSentence);
|
|
|
|
OPCODE(0xba, o5_subtract);
|
|
|
|
OPCODE(0xbb, o5_getActorScale);
|
|
|
|
/* BC */
|
|
|
|
OPCODE(0xbc, o5_stopSound);
|
|
|
|
OPCODE(0xbd, o5_findInventory);
|
|
|
|
OPCODE(0xbe, o5_walkActorTo);
|
|
|
|
OPCODE(0xbf, o5_drawBox);
|
|
|
|
/* C0 */
|
|
|
|
OPCODE(0xc0, o5_endCutscene);
|
|
|
|
OPCODE(0xc1, o5_putActor);
|
|
|
|
OPCODE(0xc2, o5_chainScript);
|
|
|
|
OPCODE(0xc3, o5_getActorX);
|
|
|
|
/* C4 */
|
|
|
|
OPCODE(0xc4, o5_isLess);
|
2009-04-19 01:00:49 +00:00
|
|
|
// OPCODE(0xc5, o5_drawObject);
|
2009-04-16 09:26:37 +00:00
|
|
|
OPCODE(0xc6, o5_decrement);
|
|
|
|
OPCODE(0xc7, o5_setState);
|
|
|
|
/* C8 */
|
|
|
|
OPCODE(0xc8, o5_isEqual);
|
|
|
|
OPCODE(0xc9, o5_faceActor);
|
|
|
|
OPCODE(0xca, o5_startScript);
|
|
|
|
OPCODE(0xcb, o5_getVerbEntrypoint);
|
|
|
|
/* CC */
|
|
|
|
OPCODE(0xcc, o5_pseudoRoom);
|
|
|
|
OPCODE(0xcd, o5_walkActorToActor);
|
|
|
|
OPCODE(0xce, o5_putActorAtObject);
|
2009-04-19 01:01:28 +00:00
|
|
|
// OPCODE(0xcf, o5_ifState);
|
2009-04-16 09:26:37 +00:00
|
|
|
/* D0 */
|
2009-04-19 01:00:11 +00:00
|
|
|
// OPCODE(0xd0, o5_pickupObjectOld);
|
2009-04-16 09:26:37 +00:00
|
|
|
OPCODE(0xd1, o5_animateActor);
|
|
|
|
OPCODE(0xd2, o5_actorFollowCamera);
|
|
|
|
OPCODE(0xd3, o5_actorOps);
|
|
|
|
/* D4 */
|
|
|
|
OPCODE(0xd4, o5_setObjectName);
|
|
|
|
OPCODE(0xd5, o5_actorFromPos);
|
|
|
|
OPCODE(0xd6, o5_getActorMoving);
|
|
|
|
OPCODE(0xd7, o5_or);
|
|
|
|
/* D8 */
|
|
|
|
OPCODE(0xd8, o5_printEgo);
|
|
|
|
OPCODE(0xd9, o5_doSentence);
|
|
|
|
OPCODE(0xda, o5_add);
|
|
|
|
OPCODE(0xdb, o5_divide);
|
|
|
|
/* DC */
|
2009-04-19 01:01:09 +00:00
|
|
|
// OPCODE(0xdc, o5_oldRoomEffect);
|
2009-04-16 09:26:37 +00:00
|
|
|
OPCODE(0xdd, o5_setClass);
|
|
|
|
OPCODE(0xde, o5_walkActorTo);
|
|
|
|
OPCODE(0xdf, o5_isActorInBox);
|
|
|
|
/* E0 */
|
|
|
|
OPCODE(0xe0, o5_freezeScripts);
|
|
|
|
OPCODE(0xe1, o5_putActor);
|
|
|
|
OPCODE(0xe2, o5_stopScript);
|
|
|
|
OPCODE(0xe3, o5_getActorFacing);
|
|
|
|
/* E4 */
|
|
|
|
OPCODE(0xe4, o5_loadRoomWithEgo);
|
|
|
|
OPCODE(0xe5, o5_pickupObject);
|
|
|
|
OPCODE(0xe6, o5_getClosestObjActor);
|
|
|
|
OPCODE(0xe7, o5_getStringWidth);
|
|
|
|
/* E8 */
|
|
|
|
OPCODE(0xe8, o5_isScriptRunning);
|
|
|
|
OPCODE(0xe9, o5_setOwnerOf);
|
|
|
|
OPCODE(0xea, o5_startScript);
|
|
|
|
OPCODE(0xeb, o5_debug);
|
|
|
|
/* EC */
|
|
|
|
OPCODE(0xec, o5_getActorWidth);
|
|
|
|
OPCODE(0xed, o5_putActorInRoom);
|
|
|
|
OPCODE(0xee, o5_stopObjectScript);
|
2009-04-19 01:01:28 +00:00
|
|
|
// OPCODE(0xef, o5_ifNotState);
|
2009-04-16 09:26:37 +00:00
|
|
|
/* F0 */
|
|
|
|
OPCODE(0xf0, o5_lights);
|
|
|
|
OPCODE(0xf1, o5_getActorCostume);
|
|
|
|
OPCODE(0xf2, o5_loadRoom);
|
|
|
|
OPCODE(0xf3, o5_roomOps);
|
|
|
|
/* F4 */
|
|
|
|
OPCODE(0xf4, o5_getDist);
|
|
|
|
OPCODE(0xf5, o5_findObject);
|
|
|
|
OPCODE(0xf6, o5_walkActorToObject);
|
|
|
|
OPCODE(0xf7, o5_startObject);
|
|
|
|
/* F8 */
|
|
|
|
OPCODE(0xf8, o5_isGreater);
|
|
|
|
OPCODE(0xf9, o5_doSentence);
|
|
|
|
OPCODE(0xfa, o5_verbOps);
|
|
|
|
OPCODE(0xfb, o5_getActorWalkBox);
|
|
|
|
/* FC */
|
|
|
|
OPCODE(0xfc, o5_isSoundRunning);
|
|
|
|
OPCODE(0xfd, o5_findInventory);
|
|
|
|
OPCODE(0xfe, o5_walkActorTo);
|
|
|
|
OPCODE(0xff, o5_drawBox);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
int ScummEngine_v5::getVar() {
|
2003-05-05 09:19:15 +00:00
|
|
|
return readVar(fetchScriptWord());
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
int ScummEngine_v5::getVarOrDirectByte(byte mask) {
|
2003-05-05 09:19:15 +00:00
|
|
|
if (_opcode & mask)
|
|
|
|
return getVar();
|
|
|
|
return fetchScriptByte();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
int ScummEngine_v5::getVarOrDirectWord(byte mask) {
|
2003-05-05 09:19:15 +00:00
|
|
|
if (_opcode & mask)
|
|
|
|
return getVar();
|
2009-04-20 12:35:17 +00:00
|
|
|
return fetchScriptWordSigned();
|
|
|
|
}
|
|
|
|
|
2010-08-16 19:57:35 +00:00
|
|
|
void ScummEngine_v5::getResultPos() {
|
|
|
|
int a;
|
|
|
|
|
|
|
|
_resultVarNumber = fetchScriptWord();
|
|
|
|
if (_resultVarNumber & 0x2000) {
|
|
|
|
a = fetchScriptWord();
|
|
|
|
if (a & 0x2000) {
|
|
|
|
_resultVarNumber += readVar(a & ~0x2000);
|
|
|
|
} else {
|
|
|
|
_resultVarNumber += a & 0xFFF;
|
|
|
|
}
|
|
|
|
_resultVarNumber &= ~0x2000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v5::setResult(int value) {
|
|
|
|
writeVar(_resultVarNumber, value);
|
|
|
|
}
|
|
|
|
|
2009-04-20 12:35:17 +00:00
|
|
|
void ScummEngine_v5::jumpRelative(bool cond) {
|
2009-04-21 04:48:50 +00:00
|
|
|
// We explicitly call ScummEngine::fetchScriptWord()
|
|
|
|
// to make this method work also in v0, which overloads
|
|
|
|
// fetchScriptWord to only read bytes (which is the right thing
|
|
|
|
// to do for most opcodes, but not for jump offsets).
|
2009-04-21 04:42:45 +00:00
|
|
|
int16 offset = ScummEngine::fetchScriptWord();
|
2009-04-20 12:35:17 +00:00
|
|
|
if (!cond)
|
|
|
|
_scriptPointer += offset;
|
2003-05-05 09:19:15 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_actorFollowCamera() {
|
2002-12-12 16:29:21 +00:00
|
|
|
actorFollowCamera(getVarOrDirectByte(0x80));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_actorFromPos() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int x, y;
|
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
x = getVarOrDirectWord(PARAM_1);
|
|
|
|
y = getVarOrDirectWord(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
setResult(getActorFromPos(x, y));
|
|
|
|
}
|
|
|
|
|
2003-11-10 00:05:17 +00:00
|
|
|
void ScummEngine_v5::o5_actorOps() {
|
2002-12-12 16:29:21 +00:00
|
|
|
static const byte convertTable[20] =
|
2003-04-10 20:42:50 +00:00
|
|
|
{ 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 20 };
|
2018-09-23 13:58:45 +00:00
|
|
|
// Fix for bug #2233 "MI2 FM-TOWNS: Elaine's mappiece directly flies to treehouse"
|
|
|
|
// There's extra code inserted in script 45 from room 45 that caused that behaviour,
|
|
|
|
// the code below just skips the extra script code.
|
|
|
|
if (_game.id == GID_MONKEY2 && _game.platform == Common::kPlatformFMTowns &&
|
|
|
|
vm.slot[_currentScript].number == 45 && _currentRoom == 45 &&
|
|
|
|
(_scriptPointer - _scriptOrgPointer == 0xA9)) {
|
|
|
|
_scriptPointer += 0xCF - 0xA1;
|
|
|
|
writeVar(32811, 0); // clear bit 43
|
|
|
|
return;
|
|
|
|
}
|
2003-11-16 18:34:33 +00:00
|
|
|
int act = getVarOrDirectByte(PARAM_1);
|
2003-11-10 00:05:17 +00:00
|
|
|
Actor *a = derefActor(act, "o5_actorOps");
|
2002-12-12 16:29:21 +00:00
|
|
|
int i, j;
|
|
|
|
|
|
|
|
while ((_opcode = fetchScriptByte()) != 0xFF) {
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.features & GF_SMALL_HEADER)
|
2002-12-12 16:29:21 +00:00
|
|
|
_opcode = (_opcode & 0xE0) | convertTable[(_opcode & 0x1F) - 1];
|
|
|
|
|
|
|
|
switch (_opcode & 0x1F) {
|
|
|
|
case 0: /* dummy case */
|
2003-11-16 18:34:33 +00:00
|
|
|
getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 1: // SO_COSTUME
|
2003-11-16 18:34:33 +00:00
|
|
|
a->setActorCostume(getVarOrDirectByte(PARAM_1));
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 2: // SO_STEP_DIST
|
2003-11-16 18:34:33 +00:00
|
|
|
i = getVarOrDirectByte(PARAM_1);
|
|
|
|
j = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
a->setActorWalkSpeed(i, j);
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 3: // SO_SOUND
|
2005-03-11 01:10:06 +00:00
|
|
|
a->_sound[0] = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 4: // SO_WALK_ANIMATION
|
2004-09-28 19:28:59 +00:00
|
|
|
a->_walkFrame = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 5: // SO_TALK_ANIMATION
|
2004-09-28 19:28:59 +00:00
|
|
|
a->_talkStartFrame = getVarOrDirectByte(PARAM_1);
|
|
|
|
a->_talkStopFrame = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 6: // SO_STAND_ANIMATION
|
2004-09-28 19:28:59 +00:00
|
|
|
a->_standFrame = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 7: // SO_ANIMATION
|
2003-11-16 18:34:33 +00:00
|
|
|
getVarOrDirectByte(PARAM_1);
|
|
|
|
getVarOrDirectByte(PARAM_2);
|
|
|
|
getVarOrDirectByte(PARAM_3);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 8: // SO_DEFAULT
|
2002-12-12 16:29:21 +00:00
|
|
|
a->initActor(0);
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 9: // SO_ELEVATION
|
2004-01-05 16:19:14 +00:00
|
|
|
a->setElevation(getVarOrDirectWord(PARAM_1));
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 10: // SO_ANIMATION_DEFAULT
|
2004-09-28 19:28:59 +00:00
|
|
|
a->_initFrame = 1;
|
|
|
|
a->_walkFrame = 2;
|
|
|
|
a->_standFrame = 3;
|
|
|
|
a->_talkStartFrame = 4;
|
|
|
|
a->_talkStopFrame = 5;
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 11: // SO_PALETTE
|
2003-11-16 18:34:33 +00:00
|
|
|
i = getVarOrDirectByte(PARAM_1);
|
|
|
|
j = getVarOrDirectByte(PARAM_2);
|
2006-09-16 13:38:43 +00:00
|
|
|
assertRange(0, i, 31, "o5_actorOps: palette slot");
|
2004-01-05 16:30:00 +00:00
|
|
|
a->setPalette(i, j);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 12: // SO_TALK_COLOR
|
2006-02-28 01:14:02 +00:00
|
|
|
a->_talkColor = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 13: // SO_ACTOR_NAME
|
2005-03-11 01:10:06 +00:00
|
|
|
loadPtrToResource(rtActorName, a->_number, NULL);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 14: // SO_INIT_ANIMATION
|
2004-09-28 19:28:59 +00:00
|
|
|
a->_initFrame = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 16: // SO_ACTOR_WIDTH
|
2005-03-11 01:10:06 +00:00
|
|
|
a->_width = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 17: // SO_ACTOR_SCALE
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.version == 4) {
|
2004-01-05 16:30:00 +00:00
|
|
|
i = j = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
} else {
|
2004-01-05 16:30:00 +00:00
|
|
|
i = getVarOrDirectByte(PARAM_1);
|
|
|
|
j = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2005-03-11 01:10:06 +00:00
|
|
|
a->_boxscale = i;
|
2004-01-05 16:30:00 +00:00
|
|
|
a->setScale(i, j);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 18: // SO_NEVER_ZCLIP
|
2005-03-11 01:10:06 +00:00
|
|
|
a->_forceClip = 0;
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 19: // SO_ALWAYS_ZCLIP
|
2005-03-11 01:10:06 +00:00
|
|
|
a->_forceClip = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 20: // SO_IGNORE_BOXES
|
|
|
|
case 21: // SO_FOLLOW_BOXES
|
2005-03-11 01:10:06 +00:00
|
|
|
a->_ignoreBoxes = !(_opcode & 1);
|
|
|
|
a->_forceClip = 0;
|
2002-12-12 16:29:21 +00:00
|
|
|
if (a->isInCurrentRoom())
|
2006-11-19 00:39:48 +00:00
|
|
|
a->putActor();
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
|
2003-11-10 00:05:17 +00:00
|
|
|
case 22: // SO_ANIMATION_SPEED
|
2003-11-16 18:34:33 +00:00
|
|
|
a->setAnimSpeed(getVarOrDirectByte(PARAM_1));
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 23: // SO_SHADOW
|
2004-09-28 19:28:59 +00:00
|
|
|
a->_shadowMode = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
default:
|
2005-08-14 01:41:52 +00:00
|
|
|
error("o5_actorOps: default case %d", _opcode & 0x1F);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_setClass() {
|
2003-11-16 18:34:33 +00:00
|
|
|
int obj = getVarOrDirectWord(PARAM_1);
|
2011-04-04 11:02:12 +00:00
|
|
|
int cls;
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
while ((_opcode = fetchScriptByte()) != 0xFF) {
|
2011-04-04 11:02:12 +00:00
|
|
|
cls = getVarOrDirectWord(PARAM_1);
|
|
|
|
|
|
|
|
// WORKAROUND bug #1668393: Due to a script bug, the wrong opcode is
|
|
|
|
// used to test and set the state of various objects (e.g. the inside
|
|
|
|
// door (object 465) of the of the Hostel on Mars), when opening the
|
|
|
|
// Hostel door from the outside.
|
|
|
|
if (_game.id == GID_ZAK && _game.platform == Common::kPlatformFMTowns &&
|
|
|
|
vm.slot[_currentScript].number == 205 && _currentRoom == 185 &&
|
|
|
|
(cls == 0 || cls == 1)) {
|
|
|
|
putState(obj, cls);
|
|
|
|
} else if (cls == 0) {
|
2003-05-20 23:05:34 +00:00
|
|
|
// Class '0' means: clean all class data
|
2002-12-12 16:29:21 +00:00
|
|
|
_classData[obj] = 0;
|
2014-07-12 08:44:37 +00:00
|
|
|
if ((_game.features & GF_SMALL_HEADER) && objIsActor(obj)) {
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(obj, "o5_setClass");
|
2005-03-11 01:10:06 +00:00
|
|
|
a->_ignoreBoxes = false;
|
|
|
|
a->_forceClip = 0;
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
2003-05-20 23:05:34 +00:00
|
|
|
} else
|
2011-04-04 11:02:12 +00:00
|
|
|
putClass(obj, cls, (cls & 0x80) ? true : false);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_add() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int a;
|
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
2003-09-08 13:28:56 +00:00
|
|
|
|
|
|
|
// WORKAROUND bug #770065: This works around a script bug in LoomCD. To
|
|
|
|
// understand the reasoning behind this, compare script 210 and 218 in
|
|
|
|
// room 20. Apparently they made a mistake when converting the absolute
|
|
|
|
// delays into relative ones.
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.id == GID_LOOM && _game.version == 4 && vm.slot[_currentScript].number == 210 && _currentRoom == 20 && _resultVarNumber == 0x4000) {
|
2003-09-08 13:28:56 +00:00
|
|
|
switch (a) {
|
|
|
|
// Fix for the Var[250] == 11 case
|
|
|
|
case 138:
|
|
|
|
a = 145;
|
|
|
|
break;
|
|
|
|
case 324:
|
|
|
|
a = 324 - 138;
|
|
|
|
break;
|
|
|
|
// Fixes for the Var[250] == 14 case
|
|
|
|
case 130:
|
|
|
|
a = 170;
|
|
|
|
break;
|
|
|
|
case 342:
|
|
|
|
a = 342 - 130 + 15; // Small extra adjustment for the "OUCH"
|
|
|
|
break;
|
|
|
|
case 384:
|
|
|
|
a -= 342;
|
|
|
|
break;
|
|
|
|
case 564:
|
|
|
|
a -= 384;
|
|
|
|
break;
|
2019-12-23 11:56:16 +00:00
|
|
|
default:
|
|
|
|
break;
|
2003-09-08 13:28:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-12-12 16:29:21 +00:00
|
|
|
setResult(readVar(_resultVarNumber) + a);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_and() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int a;
|
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
setResult(readVar(_resultVarNumber) & a);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_animateActor() {
|
2003-11-16 18:34:33 +00:00
|
|
|
int act = getVarOrDirectByte(PARAM_1);
|
|
|
|
int anim = getVarOrDirectByte(PARAM_2);
|
|
|
|
|
2003-10-26 12:09:08 +00:00
|
|
|
// WORKAROUND bug #820357: This seems to be yet another script bug which
|
|
|
|
// the original engine let slip by. For details, refer to the tracker item.
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.id == GID_INDY4 && vm.slot[_currentScript].number == 206 && _currentRoom == 17 && (act == 31 || act == 86)) {
|
2003-10-26 12:09:08 +00:00
|
|
|
return;
|
|
|
|
}
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-10-04 20:22:47 +00:00
|
|
|
// WORKAROUND bug #859513: While on mars, going outside without your helmet
|
|
|
|
// (or missing some other part of your "space suite" will cause your
|
2007-09-19 08:40:12 +00:00
|
|
|
// character to complain ("I can't breathe."). Unfortunately, this is
|
2006-10-04 20:22:47 +00:00
|
|
|
// coupled with an animate command, making it very difficult to return to
|
|
|
|
// safety (from where you came). The following hack works around this by
|
|
|
|
// ignoring that particular turn command.
|
|
|
|
if (_game.id == GID_ZAK && _currentRoom == 182 && anim == 246 &&
|
|
|
|
((_game.version < 3 && vm.slot[_currentScript].number == 82)
|
|
|
|
|| (_game.version == 3 && vm.slot[_currentScript].number == 131))) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(act, "o5_animateActor");
|
2002-12-12 16:29:21 +00:00
|
|
|
a->animateActor(anim);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_breakHere() {
|
2002-12-12 16:29:21 +00:00
|
|
|
updateScriptPtr();
|
|
|
|
_currentScript = 0xFF;
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_chainScript() {
|
2013-05-01 05:47:56 +00:00
|
|
|
int vars[NUM_SCRIPT_LOCAL];
|
2003-06-02 01:45:03 +00:00
|
|
|
int script;
|
2002-12-12 16:29:21 +00:00
|
|
|
int cur;
|
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
script = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
getWordVararg(vars);
|
|
|
|
|
|
|
|
cur = _currentScript;
|
|
|
|
|
2003-07-31 18:46:31 +00:00
|
|
|
// WORKAROUND bug #743314: Work around a bug in script 33 in Indy3 VGA.
|
2003-09-08 13:28:56 +00:00
|
|
|
// That script is used for the fist fights in the Zeppelin. It uses
|
2003-07-31 18:46:31 +00:00
|
|
|
// Local[5], even though that is never set to any value. But script 33 is
|
2008-11-06 14:03:38 +00:00
|
|
|
// called via chainScript by script 32, and in there Local[5] is set to
|
|
|
|
// the actor ID of the opposing soldier. So, we copy that value over to
|
|
|
|
// the Local[5] variable of script 33.
|
2007-02-23 01:49:20 +00:00
|
|
|
// FIXME: This workaround is meant for Indy3 VGA, but we make no checks
|
2008-11-06 14:03:38 +00:00
|
|
|
// to exclude the EGA/Mac/FM-TOWNS versions. We need to check whether
|
|
|
|
// those need the same workaround; if they don't, or if they need it in
|
|
|
|
// modified form, adjust this workaround accordingly.
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.id == GID_INDY3 && vm.slot[cur].number == 32 && script == 33) {
|
2003-06-02 01:45:03 +00:00
|
|
|
vars[5] = vm.localvar[cur][5];
|
|
|
|
}
|
|
|
|
|
2002-12-12 16:29:21 +00:00
|
|
|
vm.slot[cur].number = 0;
|
2003-09-11 10:32:15 +00:00
|
|
|
vm.slot[cur].status = ssDead;
|
2002-12-12 16:29:21 +00:00
|
|
|
_currentScript = 0xFF;
|
|
|
|
|
2003-06-02 01:45:03 +00:00
|
|
|
runScript(script, vm.slot[cur].freezeResistant, vm.slot[cur].recursive, vars);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_cursorCommand() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int i, j, k;
|
2013-05-01 05:47:56 +00:00
|
|
|
int table[NUM_SCRIPT_LOCAL];
|
2002-12-12 16:29:21 +00:00
|
|
|
switch ((_opcode = fetchScriptByte()) & 0x1F) {
|
2003-11-10 00:05:17 +00:00
|
|
|
case 1: // SO_CURSOR_ON
|
2002-12-12 16:29:21 +00:00
|
|
|
_cursor.state = 1;
|
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 2: // SO_CURSOR_OFF
|
2002-12-12 16:29:21 +00:00
|
|
|
_cursor.state = 0;
|
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 3: // SO_USERPUT_ON
|
2002-12-12 16:29:21 +00:00
|
|
|
_userPut = 1;
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 4: // SO_USERPUT_OFF
|
2002-12-12 16:29:21 +00:00
|
|
|
_userPut = 0;
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 5: // SO_CURSOR_SOFT_ON
|
2002-12-12 16:29:21 +00:00
|
|
|
_cursor.state++;
|
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 6: // SO_CURSOR_SOFT_OFF
|
2002-12-12 16:29:21 +00:00
|
|
|
_cursor.state--;
|
|
|
|
verbMouseOver(0);
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 7: // SO_USERPUT_SOFT_ON
|
2002-12-12 16:29:21 +00:00
|
|
|
_userPut++;
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 8: // SO_USERPUT_SOFT_OFF
|
2002-12-12 16:29:21 +00:00
|
|
|
_userPut--;
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 10: // SO_CURSOR_IMAGE
|
2004-08-22 23:38:00 +00:00
|
|
|
i = getVarOrDirectByte(PARAM_1); // Cursor number
|
|
|
|
j = getVarOrDirectByte(PARAM_2); // Charset letter to use
|
2004-08-23 08:37:55 +00:00
|
|
|
redefineBuiltinCursorFromChar(i, j);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 11: // SO_CURSOR_HOTSPOT
|
2003-11-16 18:34:33 +00:00
|
|
|
i = getVarOrDirectByte(PARAM_1);
|
|
|
|
j = getVarOrDirectByte(PARAM_2);
|
|
|
|
k = getVarOrDirectByte(PARAM_3);
|
2004-08-24 06:36:12 +00:00
|
|
|
redefineBuiltinCursorHotspot(i, j, k);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 12: // SO_CURSOR_SET
|
2004-08-23 08:37:55 +00:00
|
|
|
i = getVarOrDirectByte(PARAM_1);
|
|
|
|
if (i >= 0 && i <= 3)
|
|
|
|
_currentCursor = i;
|
|
|
|
else
|
|
|
|
error("SO_CURSOR_SET: unsupported cursor id %d", i);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 13: // SO_CHARSET_SET
|
2003-11-16 18:34:33 +00:00
|
|
|
initCharset(getVarOrDirectByte(PARAM_1));
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
case 14: /* unk */
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.version == 3) {
|
2003-11-16 18:34:33 +00:00
|
|
|
/*int a = */ getVarOrDirectByte(PARAM_1);
|
|
|
|
/*int b = */ getVarOrDirectByte(PARAM_2);
|
2003-08-03 18:26:46 +00:00
|
|
|
// This is some kind of "init charset" opcode. However, we don't have to do anything
|
|
|
|
// in here, as our initCharset automatically calls loadCharset for GF_SMALL_HEADER,
|
|
|
|
// games if needed.
|
2003-04-29 09:14:05 +00:00
|
|
|
} else {
|
|
|
|
getWordVararg(table);
|
|
|
|
for (i = 0; i < 16; i++)
|
2004-04-05 23:54:58 +00:00
|
|
|
_charsetColorMap[i] = _charsetData[_string[1]._default.charset][i] = (unsigned char)table[i];
|
2003-04-29 09:14:05 +00:00
|
|
|
}
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2019-12-23 11:56:16 +00:00
|
|
|
default:
|
|
|
|
break;
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.version >= 4) {
|
2003-05-08 15:48:50 +00:00
|
|
|
VAR(VAR_CURSORSTATE) = _cursor.state;
|
|
|
|
VAR(VAR_USERPUT) = _userPut;
|
2003-04-30 05:55:06 +00:00
|
|
|
}
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_cutscene() {
|
2013-05-01 05:47:56 +00:00
|
|
|
int args[NUM_SCRIPT_LOCAL];
|
2002-12-12 16:29:21 +00:00
|
|
|
getWordVararg(args);
|
2003-05-20 20:58:26 +00:00
|
|
|
beginCutscene(args);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_endCutscene() {
|
2002-12-12 16:29:21 +00:00
|
|
|
endCutscene();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_debug() {
|
2003-11-16 18:34:33 +00:00
|
|
|
int a = getVarOrDirectWord(PARAM_1);
|
2004-08-22 09:30:08 +00:00
|
|
|
debugC(DEBUG_GENERAL, "o5_debug(%d)", a);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_decrement() {
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
|
|
|
setResult(readVar(_resultVarNumber) - 1);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_delay() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int delay = fetchScriptByte();
|
|
|
|
delay |= fetchScriptByte() << 8;
|
|
|
|
delay |= fetchScriptByte() << 16;
|
|
|
|
vm.slot[_currentScript].delay = delay;
|
2003-09-11 10:32:15 +00:00
|
|
|
vm.slot[_currentScript].status = ssPaused;
|
2002-12-12 16:29:21 +00:00
|
|
|
o5_breakHere();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_delayVariable() {
|
2003-05-05 09:19:15 +00:00
|
|
|
vm.slot[_currentScript].delay = getVar();
|
2003-09-11 10:32:15 +00:00
|
|
|
vm.slot[_currentScript].status = ssPaused;
|
2002-12-12 16:29:21 +00:00
|
|
|
o5_breakHere();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_divide() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int a;
|
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
if (a == 0) {
|
|
|
|
error("Divide by zero");
|
|
|
|
setResult(0);
|
|
|
|
} else
|
|
|
|
setResult(readVar(_resultVarNumber) / a);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_doSentence() {
|
2003-05-24 16:11:47 +00:00
|
|
|
int verb;
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
verb = getVarOrDirectByte(PARAM_1);
|
2003-05-24 16:11:47 +00:00
|
|
|
if (verb == 0xFE) {
|
2002-12-12 16:29:21 +00:00
|
|
|
_sentenceNum = 0;
|
2003-05-20 20:58:26 +00:00
|
|
|
stopScript(VAR(VAR_SENTENCE_SCRIPT));
|
2002-12-12 16:29:21 +00:00
|
|
|
clearClickedStatus();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-08-21 10:04:04 +00:00
|
|
|
int objectA = getVarOrDirectWord(PARAM_2);
|
|
|
|
int objectB = getVarOrDirectWord(PARAM_3);
|
|
|
|
doSentence(verb, objectA, objectB);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_drawBox() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int x, y, x2, y2, color;
|
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
x = getVarOrDirectWord(PARAM_1);
|
|
|
|
y = getVarOrDirectWord(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
_opcode = fetchScriptByte();
|
2003-11-16 18:34:33 +00:00
|
|
|
x2 = getVarOrDirectWord(PARAM_1);
|
|
|
|
y2 = getVarOrDirectWord(PARAM_2);
|
|
|
|
color = getVarOrDirectByte(PARAM_3);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
drawBox(x, y, x2, y2, color);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_drawObject() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int state, obj, idx, i;
|
|
|
|
ObjectData *od;
|
|
|
|
uint16 x, y, w, h;
|
|
|
|
int xpos, ypos;
|
|
|
|
|
|
|
|
state = 1;
|
|
|
|
xpos = ypos = 255;
|
2003-11-16 18:34:33 +00:00
|
|
|
obj = getVarOrDirectWord(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.features & GF_SMALL_HEADER) {
|
2003-11-16 18:34:33 +00:00
|
|
|
xpos = getVarOrDirectWord(PARAM_2);
|
|
|
|
ypos = getVarOrDirectWord(PARAM_3);
|
2002-12-12 16:29:21 +00:00
|
|
|
} else {
|
2003-09-05 20:47:23 +00:00
|
|
|
_opcode = fetchScriptByte();
|
|
|
|
switch (_opcode & 0x1F) {
|
2002-12-12 16:29:21 +00:00
|
|
|
case 1: /* draw at */
|
2003-11-16 18:34:33 +00:00
|
|
|
xpos = getVarOrDirectWord(PARAM_1);
|
|
|
|
ypos = getVarOrDirectWord(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
case 2: /* set state */
|
2003-11-16 18:34:33 +00:00
|
|
|
state = getVarOrDirectWord(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
case 0x1F: /* neither */
|
|
|
|
break;
|
|
|
|
default:
|
2003-09-05 20:47:23 +00:00
|
|
|
error("o5_drawObject: unknown subopcode %d", _opcode & 0x1F);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
idx = getObjectIndex(obj);
|
|
|
|
if (idx == -1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
od = &_objs[idx];
|
|
|
|
if (xpos != 0xFF) {
|
2003-11-16 20:52:57 +00:00
|
|
|
od->walk_x += (xpos * 8) - od->x_pos;
|
|
|
|
od->x_pos = xpos * 8;
|
|
|
|
od->walk_y += (ypos * 8) - od->y_pos;
|
|
|
|
od->y_pos = ypos * 8;
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
addObjectToDrawQue(idx);
|
|
|
|
|
|
|
|
x = od->x_pos;
|
|
|
|
y = od->y_pos;
|
|
|
|
w = od->width;
|
|
|
|
h = od->height;
|
|
|
|
|
2003-05-01 13:45:45 +00:00
|
|
|
i = _numLocalObjects - 1;
|
2002-12-12 16:29:21 +00:00
|
|
|
do {
|
2003-01-12 07:30:17 +00:00
|
|
|
if (_objs[i].obj_nr && _objs[i].x_pos == x && _objs[i].y_pos == y && _objs[i].width == w && _objs[i].height == h)
|
2002-12-12 16:29:21 +00:00
|
|
|
putState(_objs[i].obj_nr, 0);
|
|
|
|
} while (--i);
|
|
|
|
|
|
|
|
putState(obj, state);
|
|
|
|
}
|
|
|
|
|
2009-04-19 01:01:54 +00:00
|
|
|
void ScummEngine_v5::o5_dummy() {
|
|
|
|
// The KIXX XL release of Monkey Island 2 (Amiga disk) used opcode 0xa7
|
|
|
|
// as dummy, in order to remove copy protection and keep level selection.
|
|
|
|
if (_opcode != 0xa7 || _game.id == GID_MONKEY2)
|
|
|
|
warning("o5_dummy invoked (opcode %d)", _opcode);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getStringWidth() {
|
2003-08-03 18:23:54 +00:00
|
|
|
int string, width = 0;
|
|
|
|
byte *ptr;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2003-08-03 18:23:54 +00:00
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
string = getVarOrDirectByte(PARAM_1);
|
2003-08-03 18:23:54 +00:00
|
|
|
ptr = getResourceAddress(rtString, string);
|
|
|
|
assert(ptr);
|
|
|
|
|
|
|
|
width = _charset->getStringWidth(0, ptr);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2003-04-28 14:46:55 +00:00
|
|
|
setResult(width);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_expression() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int dst, i;
|
|
|
|
|
|
|
|
_scummStackPos = 0;
|
|
|
|
getResultPos();
|
|
|
|
dst = _resultVarNumber;
|
|
|
|
|
|
|
|
while ((_opcode = fetchScriptByte()) != 0xFF) {
|
|
|
|
switch (_opcode & 0x1F) {
|
|
|
|
case 1: /* varordirect */
|
2003-11-16 18:34:33 +00:00
|
|
|
push(getVarOrDirectWord(PARAM_1));
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
case 2: /* add */
|
|
|
|
i = pop();
|
|
|
|
push(i + pop());
|
|
|
|
break;
|
|
|
|
case 3: /* sub */
|
|
|
|
i = pop();
|
|
|
|
push(pop() - i);
|
|
|
|
break;
|
|
|
|
case 4: /* mul */
|
|
|
|
i = pop();
|
|
|
|
push(i * pop());
|
|
|
|
break;
|
|
|
|
case 5: /* div */
|
|
|
|
i = pop();
|
|
|
|
if (i == 0)
|
|
|
|
error("Divide by zero");
|
|
|
|
push(pop() / i);
|
|
|
|
break;
|
|
|
|
case 6: /* normal opcode */
|
|
|
|
_opcode = fetchScriptByte();
|
2002-12-16 12:12:31 +00:00
|
|
|
executeOpcode(_opcode);
|
2003-05-08 15:48:50 +00:00
|
|
|
push(_scummVars[0]);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2019-12-23 11:56:16 +00:00
|
|
|
default:
|
|
|
|
break;
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_resultVarNumber = dst;
|
|
|
|
setResult(pop());
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_faceActor() {
|
2003-11-16 18:34:33 +00:00
|
|
|
int act = getVarOrDirectByte(PARAM_1);
|
|
|
|
int obj = getVarOrDirectWord(PARAM_2);
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(act, "o5_faceActor");
|
2003-04-20 17:11:13 +00:00
|
|
|
a->faceToObject(obj);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_findInventory() {
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
int x = getVarOrDirectByte(PARAM_1);
|
|
|
|
int y = getVarOrDirectByte(PARAM_2);
|
2003-04-30 11:15:11 +00:00
|
|
|
setResult(findInventory(x, y));
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_findObject() {
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
int x = getVarOrDirectByte(PARAM_1);
|
|
|
|
int y = getVarOrDirectByte(PARAM_2);
|
2003-04-30 11:15:11 +00:00
|
|
|
setResult(findObject(x, y));
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_freezeScripts() {
|
2003-11-16 18:34:33 +00:00
|
|
|
int scr = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
if (scr != 0)
|
|
|
|
freezeScripts(scr);
|
|
|
|
else
|
|
|
|
unfreezeScripts();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getActorCostume() {
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
int act = getVarOrDirectByte(PARAM_1);
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(act, "o5_getActorCostume");
|
2005-03-11 01:10:06 +00:00
|
|
|
setResult(a->_costume);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getActorElevation() {
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
int act = getVarOrDirectByte(PARAM_1);
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(act, "o5_getActorElevation");
|
2004-01-05 16:19:14 +00:00
|
|
|
setResult(a->getElevation());
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getActorFacing() {
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
int act = getVarOrDirectByte(PARAM_1);
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(act, "o5_getActorFacing");
|
2003-07-24 17:44:00 +00:00
|
|
|
setResult(newDirToOldDir(a->getFacing()));
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getActorMoving() {
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
int act = getVarOrDirectByte(PARAM_1);
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(act, "o5_getActorMoving");
|
2005-03-11 01:10:06 +00:00
|
|
|
setResult(a->_moving);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getActorRoom() {
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
int act = getVarOrDirectByte(PARAM_1);
|
2003-07-31 18:46:31 +00:00
|
|
|
// WORKAROUND bug #746349. This is a really odd bug in either the script
|
|
|
|
// or in our script engine. Might be a good idea to investigate this
|
|
|
|
// further by e.g. looking at the FOA engine a bit closer.
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.id == GID_INDY4 && _roomResource == 94 && vm.slot[_currentScript].number == 206 && !isValidActor(act)) {
|
2003-05-30 22:22:51 +00:00
|
|
|
setResult(0);
|
|
|
|
return;
|
|
|
|
}
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(act, "o5_getActorRoom");
|
2005-03-11 01:10:06 +00:00
|
|
|
setResult(a->_room);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getActorScale() {
|
2003-05-23 01:32:15 +00:00
|
|
|
Actor *a;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
int act = getVarOrDirectByte(PARAM_1);
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(act, "o5_getActorScale");
|
2005-03-11 01:10:06 +00:00
|
|
|
setResult(a->_scalex);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getActorWalkBox() {
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
int act = getVarOrDirectByte(PARAM_1);
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(act, "o5_getActorWalkBox");
|
2004-09-28 19:28:59 +00:00
|
|
|
setResult(a->_walkbox);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getActorWidth() {
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
int act = getVarOrDirectByte(PARAM_1);
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(act, "o5_getActorWidth");
|
2005-03-11 01:10:06 +00:00
|
|
|
setResult(a->_width);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getActorX() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int a;
|
|
|
|
getResultPos();
|
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if ((_game.id == GID_INDY3) && !(_game.platform == Common::kPlatformMacintosh))
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
else
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
setResult(getObjX(a));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getActorY() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int a;
|
|
|
|
getResultPos();
|
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if ((_game.id == GID_INDY3) && !(_game.platform == Common::kPlatformMacintosh)) {
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2003-12-06 14:17:07 +00:00
|
|
|
// WORKAROUND bug #636433 (can't get into Zeppelin)
|
2003-04-27 15:58:36 +00:00
|
|
|
if (_roomResource == 36) {
|
|
|
|
setResult(getObjY(a) - 1);
|
|
|
|
return;
|
|
|
|
}
|
2002-12-12 16:29:21 +00:00
|
|
|
} else
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
setResult(getObjY(a));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getAnimCounter() {
|
2003-08-31 15:39:27 +00:00
|
|
|
getResultPos();
|
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
int act = getVarOrDirectByte(PARAM_1);
|
2003-08-31 15:39:27 +00:00
|
|
|
Actor *a = derefActor(act, "o5_getAnimCounter");
|
2005-03-11 01:10:06 +00:00
|
|
|
setResult(a->_cost.animCounter);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getClosestObjActor() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int obj;
|
|
|
|
int act;
|
|
|
|
int dist;
|
|
|
|
|
2003-12-06 14:17:07 +00:00
|
|
|
// This code can't detect any actors farther away than 255 units
|
|
|
|
// (pixels in newer games, characters in older ones.) But this is
|
|
|
|
// perfectly OK, as it is exactly how the original behaved.
|
2003-06-01 16:40:15 +00:00
|
|
|
|
|
|
|
int closest_obj = 0xFF, closest_dist = 0xFF;
|
|
|
|
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
act = getVarOrDirectWord(PARAM_1);
|
2003-05-08 15:48:50 +00:00
|
|
|
obj = VAR(VAR_ACTOR_RANGE_MAX);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
do {
|
|
|
|
dist = getObjActToObjActDist(act, obj);
|
|
|
|
if (dist < closest_dist) {
|
|
|
|
closest_dist = dist;
|
|
|
|
closest_obj = obj;
|
|
|
|
}
|
2003-05-08 15:48:50 +00:00
|
|
|
} while (--obj >= VAR(VAR_ACTOR_RANGE_MIN));
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2003-05-18 02:22:26 +00:00
|
|
|
setResult(closest_obj);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getDist() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int o1, o2;
|
|
|
|
int r;
|
2012-01-22 21:58:10 +00:00
|
|
|
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
2012-09-26 02:17:31 +00:00
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
o1 = getVarOrDirectWord(PARAM_1);
|
|
|
|
o2 = getVarOrDirectWord(PARAM_2);
|
2012-01-22 21:58:10 +00:00
|
|
|
|
|
|
|
if (_game.version == 0) // in v0 both parameters are always actor IDs, never objects
|
|
|
|
r = getObjActToObjActDist(actorToObj(o1), actorToObj(o2));
|
|
|
|
else
|
|
|
|
r = getObjActToObjActDist(o1, o2);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2006-01-22 20:46:51 +00:00
|
|
|
// FIXME: MI2 race workaround, see bug #597022. We never quite figured out
|
|
|
|
// what the real cause of this, or if it maybe occurs in the original, too...
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.id == GID_MONKEY2 && vm.slot[_currentScript].number == 40 && r < 60)
|
2003-12-06 14:17:07 +00:00
|
|
|
r = 60;
|
|
|
|
|
2006-01-22 20:46:51 +00:00
|
|
|
// WORKAROUND bug #795937
|
2009-09-11 10:13:54 +00:00
|
|
|
if ((_game.id == GID_MONKEY_EGA || _game.id == GID_PASS) && o1 == 1 && o2 == 307 && vm.slot[_currentScript].number == 205 && r == 2)
|
2003-12-06 14:17:07 +00:00
|
|
|
r = 3;
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
setResult(r);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getInventoryCount() {
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
setResult(getInventoryCount(getVarOrDirectByte(PARAM_1)));
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getObjectOwner() {
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
setResult(getOwner(getVarOrDirectWord(PARAM_1)));
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getObjectState() {
|
2009-04-19 01:01:28 +00:00
|
|
|
getResultPos();
|
|
|
|
setResult(getState(getVarOrDirectWord(PARAM_1)));
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getRandomNr() {
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
setResult(_rnd.getRandomNumber(getVarOrDirectByte(PARAM_1)));
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_isScriptRunning() {
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
setResult(isScriptRunning(getVarOrDirectByte(PARAM_1)));
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_getVerbEntrypoint() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int a, b;
|
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
|
|
|
b = getVarOrDirectWord(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
setResult(getVerbEntrypoint(a, b));
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_ifClassOfIs() {
|
2009-04-20 12:35:17 +00:00
|
|
|
int obj, cls, b = 0;
|
2002-12-12 16:29:21 +00:00
|
|
|
bool cond = true;
|
|
|
|
|
2009-04-20 12:35:17 +00:00
|
|
|
obj = getVarOrDirectWord(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
while ((_opcode = fetchScriptByte()) != 0xFF) {
|
2003-11-16 18:34:33 +00:00
|
|
|
cls = getVarOrDirectWord(PARAM_1);
|
2009-07-18 13:39:21 +00:00
|
|
|
|
2011-04-04 11:02:12 +00:00
|
|
|
// WORKAROUND bug #1668393: Due to a script bug, the wrong opcode is
|
|
|
|
// used to test and set the state of various objects (e.g. the inside
|
|
|
|
// door (object 465) of the of the Hostel on Mars), when opening the
|
|
|
|
// Hostel door from the outside.
|
2009-07-18 13:39:21 +00:00
|
|
|
if (_game.id == GID_ZAK && _game.platform == Common::kPlatformFMTowns &&
|
|
|
|
vm.slot[_currentScript].number == 205 && _currentRoom == 185 &&
|
|
|
|
obj == 465 && cls == 0) {
|
|
|
|
cond = (getState(obj) == 0);
|
|
|
|
} else {
|
|
|
|
b = getClass(obj, cls);
|
|
|
|
if (((cls & 0x80) && !b) || (!(cls & 0x80) && b))
|
|
|
|
cond = false;
|
|
|
|
}
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
2009-04-20 12:35:17 +00:00
|
|
|
jumpRelative(cond);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_increment() {
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
|
|
|
setResult(readVar(_resultVarNumber) + 1);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_isActorInBox() {
|
2003-11-16 18:34:33 +00:00
|
|
|
int act = getVarOrDirectByte(PARAM_1);
|
|
|
|
int box = getVarOrDirectByte(PARAM_2);
|
2003-05-23 13:24:41 +00:00
|
|
|
Actor *a = derefActor(act, "o5_isActorInBox");
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2009-04-20 12:35:17 +00:00
|
|
|
jumpRelative(checkXYInBoxBounds(box, a->getRealPos().x, a->getRealPos().y));
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_isEqual() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int16 a, b;
|
|
|
|
int var;
|
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.version <= 2)
|
2003-05-05 09:25:07 +00:00
|
|
|
var = fetchScriptByte();
|
|
|
|
else
|
|
|
|
var = fetchScriptWord();
|
2002-12-12 16:29:21 +00:00
|
|
|
a = readVar(var);
|
2003-11-16 18:34:33 +00:00
|
|
|
b = getVarOrDirectWord(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
// HACK: See bug report #602348. The sound effects for Largo's screams
|
|
|
|
// are only played on type 5 soundcards. However, there is at least one
|
|
|
|
// other sound effect (the bartender spitting) which is only played on
|
|
|
|
// type 3 soundcards.
|
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.id == GID_MONKEY2 && var == VAR_SOUNDCARD && b == 5)
|
2002-12-12 16:29:21 +00:00
|
|
|
b = a;
|
|
|
|
|
2004-07-26 11:49:41 +00:00
|
|
|
// HACK: To allow demo script of Maniac Mansion V2
|
|
|
|
// The camera x position is only 100, instead of 180, after game title name scrolls.
|
2006-04-23 00:08:18 +00:00
|
|
|
if (_game.id == GID_MANIAC && _game.version == 2 && (_game.features & GF_DEMO) && isScriptRunning(173) && b == 180)
|
2004-07-26 11:49:41 +00:00
|
|
|
b = 100;
|
|
|
|
|
2009-04-20 12:35:17 +00:00
|
|
|
jumpRelative(b == a);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_isGreater() {
|
2003-05-05 09:19:15 +00:00
|
|
|
int16 a = getVar();
|
2003-11-16 18:34:33 +00:00
|
|
|
int16 b = getVarOrDirectWord(PARAM_1);
|
2009-04-20 12:35:17 +00:00
|
|
|
jumpRelative(b > a);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_isGreaterEqual() {
|
2003-05-05 09:19:15 +00:00
|
|
|
int16 a = getVar();
|
2003-11-16 18:34:33 +00:00
|
|
|
int16 b = getVarOrDirectWord(PARAM_1);
|
2009-04-20 12:35:17 +00:00
|
|
|
jumpRelative(b >= a);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_isLess() {
|
2003-05-05 09:19:15 +00:00
|
|
|
int16 a = getVar();
|
2003-11-16 18:34:33 +00:00
|
|
|
int16 b = getVarOrDirectWord(PARAM_1);
|
2009-04-20 12:35:17 +00:00
|
|
|
jumpRelative(b < a);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2009-04-20 12:35:17 +00:00
|
|
|
void ScummEngine_v5::o5_isLessEqual() {
|
2003-05-05 09:19:15 +00:00
|
|
|
int16 a = getVar();
|
2003-11-16 18:34:33 +00:00
|
|
|
int16 b = getVarOrDirectWord(PARAM_1);
|
2003-10-12 17:17:43 +00:00
|
|
|
|
|
|
|
// WORKAROUND bug #820507 : Work around a bug in Indy3Town.
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.id == GID_INDY3 && (_game.platform == Common::kPlatformFMTowns) &&
|
2003-10-12 17:17:43 +00:00
|
|
|
(vm.slot[_currentScript].number == 200 || vm.slot[_currentScript].number == 203) &&
|
|
|
|
_currentRoom == 70 && b == -256) {
|
2004-09-30 22:39:13 +00:00
|
|
|
o5_jumpRelative();
|
|
|
|
return;
|
2003-10-12 17:17:43 +00:00
|
|
|
}
|
|
|
|
|
2009-04-20 12:35:17 +00:00
|
|
|
jumpRelative(b <= a);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_isNotEqual() {
|
2003-05-05 09:19:15 +00:00
|
|
|
int16 a = getVar();
|
2003-11-16 18:34:33 +00:00
|
|
|
int16 b = getVarOrDirectWord(PARAM_1);
|
2009-04-20 12:35:17 +00:00
|
|
|
jumpRelative(b != a);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_notEqualZero() {
|
2003-05-05 09:19:15 +00:00
|
|
|
int a = getVar();
|
2009-04-20 12:35:17 +00:00
|
|
|
jumpRelative(a != 0);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_equalZero() {
|
2003-05-05 09:19:15 +00:00
|
|
|
int a = getVar();
|
2009-04-20 12:35:17 +00:00
|
|
|
jumpRelative(a == 0);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_jumpRelative() {
|
2009-04-20 12:35:17 +00:00
|
|
|
jumpRelative(false);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_lights() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int a, b, c;
|
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
b = fetchScriptByte();
|
|
|
|
c = fetchScriptByte();
|
|
|
|
|
|
|
|
if (c == 0)
|
2003-05-08 15:48:50 +00:00
|
|
|
VAR(VAR_CURRENT_LIGHTS) = a;
|
2002-12-12 16:29:21 +00:00
|
|
|
else if (c == 1) {
|
2003-05-15 22:48:06 +00:00
|
|
|
_flashlight.xStrips = a;
|
|
|
|
_flashlight.yStrips = b;
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
2005-08-06 14:34:40 +00:00
|
|
|
_fullRedraw = true;
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_loadRoom() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int room;
|
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
room = getVarOrDirectByte(PARAM_1);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2002-12-12 16:29:21 +00:00
|
|
|
// For small header games, we only call startScene if the room
|
|
|
|
// actually changed. This avoid unwanted (wrong) fades in Zak256
|
|
|
|
// and others. OTOH, it seems to cause a problem in newer games.
|
2006-02-20 16:51:30 +00:00
|
|
|
if (!(_game.features & GF_SMALL_HEADER) || room != _currentRoom)
|
2002-12-12 16:29:21 +00:00
|
|
|
startScene(room, 0, 0);
|
2003-07-31 15:32:57 +00:00
|
|
|
|
2005-08-06 14:34:40 +00:00
|
|
|
_fullRedraw = true;
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_loadRoomWithEgo() {
|
2002-12-12 16:29:21 +00:00
|
|
|
Actor *a;
|
|
|
|
int obj, room, x, y;
|
2003-09-11 14:11:31 +00:00
|
|
|
int x2, y2, dir, oldDir;
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
obj = getVarOrDirectWord(PARAM_1);
|
|
|
|
room = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(VAR(VAR_EGO), "o5_loadRoomWithEgo");
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2007-02-04 01:24:43 +00:00
|
|
|
a->putActor(room);
|
2003-09-11 14:11:31 +00:00
|
|
|
oldDir = a->getFacing();
|
2002-12-12 16:29:21 +00:00
|
|
|
_egoPositioned = false;
|
|
|
|
|
2009-04-20 12:35:17 +00:00
|
|
|
x = fetchScriptWordSigned();
|
|
|
|
y = fetchScriptWordSigned();
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2003-05-08 15:48:50 +00:00
|
|
|
VAR(VAR_WALKTO_OBJ) = obj;
|
2005-03-11 01:10:06 +00:00
|
|
|
startScene(a->_room, a, obj);
|
2003-05-08 15:48:50 +00:00
|
|
|
VAR(VAR_WALKTO_OBJ) = 0;
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.version <= 4) {
|
2005-04-06 05:04:39 +00:00
|
|
|
if (whereIsObject(obj) != WIO_ROOM)
|
2005-04-06 05:05:36 +00:00
|
|
|
error("o5_loadRoomWithEgo: Object %d is not in room %d", obj, _currentRoom);
|
2003-09-11 14:11:31 +00:00
|
|
|
if (!_egoPositioned) {
|
|
|
|
getObjectXYPos(obj, x2, y2, dir);
|
|
|
|
a->putActor(x2, y2, _currentRoom);
|
|
|
|
if (a->getFacing() == oldDir)
|
2003-09-12 00:07:42 +00:00
|
|
|
a->setDirection(dir + 180);
|
2003-09-11 14:11:31 +00:00
|
|
|
}
|
2005-03-11 01:10:06 +00:00
|
|
|
a->_moving = 0;
|
2003-09-11 14:11:31 +00:00
|
|
|
}
|
|
|
|
|
2004-02-22 15:00:49 +00:00
|
|
|
// This is based on disassembly
|
2006-11-19 00:39:48 +00:00
|
|
|
camera._cur.x = camera._dest.x = a->getPos().x;
|
2006-07-31 14:48:58 +00:00
|
|
|
if ((_game.id == GID_ZAK || _game.id == GID_LOOM) && (_game.platform == Common::kPlatformFMTowns)) {
|
2006-11-19 00:39:48 +00:00
|
|
|
setCameraAt(a->getPos().x, a->getPos().y);
|
2006-07-31 14:48:58 +00:00
|
|
|
}
|
2002-12-12 16:29:21 +00:00
|
|
|
setCameraFollows(a);
|
|
|
|
|
2005-08-06 14:34:40 +00:00
|
|
|
_fullRedraw = true;
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
if (x != -1) {
|
|
|
|
a->startWalkActor(x, y, -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_matrixOps() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int a, b;
|
|
|
|
|
2003-11-14 10:55:24 +00:00
|
|
|
_opcode = fetchScriptByte();
|
|
|
|
switch (_opcode & 0x1F) {
|
2002-12-12 16:29:21 +00:00
|
|
|
case 1:
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
|
|
|
b = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
setBoxFlags(a, b);
|
|
|
|
break;
|
2003-11-16 18:34:33 +00:00
|
|
|
case 2:
|
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
|
|
|
b = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
setBoxScale(a, b);
|
|
|
|
break;
|
|
|
|
case 3:
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
|
|
|
b = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
setBoxScale(a, (b - 1) | 0x8000);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
createBoxMatrix();
|
|
|
|
break;
|
2019-12-23 11:56:16 +00:00
|
|
|
default:
|
|
|
|
break;
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_move() {
|
2002-12-12 16:29:21 +00:00
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
setResult(getVarOrDirectWord(PARAM_1));
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_multiply() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int a;
|
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
setResult(readVar(_resultVarNumber) * a);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_or() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int a;
|
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
setResult(readVar(_resultVarNumber) | a);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_beginOverride() {
|
2002-12-12 16:29:21 +00:00
|
|
|
if (fetchScriptByte() != 0)
|
|
|
|
beginOverride();
|
|
|
|
else
|
|
|
|
endOverride();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_panCameraTo() {
|
2003-11-16 18:34:33 +00:00
|
|
|
panCameraTo(getVarOrDirectWord(PARAM_1), 0);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_pickupObject() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int obj, room;
|
2003-11-16 18:34:33 +00:00
|
|
|
obj = getVarOrDirectWord(PARAM_1);
|
|
|
|
room = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
if (room == 0)
|
|
|
|
room = _roomResource;
|
|
|
|
addObjectToInventory(obj, room);
|
2003-05-08 15:48:50 +00:00
|
|
|
putOwner(obj, VAR(VAR_EGO));
|
2003-05-20 20:42:28 +00:00
|
|
|
putClass(obj, kObjectClassUntouchable, 1);
|
2002-12-12 16:29:21 +00:00
|
|
|
putState(obj, 1);
|
2004-01-11 20:42:40 +00:00
|
|
|
markObjectRectAsDirty(obj);
|
2002-12-12 16:29:21 +00:00
|
|
|
clearDrawObjectQueue();
|
2003-06-14 12:23:30 +00:00
|
|
|
runInventoryScript(1);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_print() {
|
2003-11-16 18:34:33 +00:00
|
|
|
_actorToPrintStrFor = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
decodeParseString();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_printEgo() {
|
2003-05-08 15:48:50 +00:00
|
|
|
_actorToPrintStrFor = (byte)VAR(VAR_EGO);
|
2002-12-12 16:29:21 +00:00
|
|
|
decodeParseString();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_pseudoRoom() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int i = fetchScriptByte(), j;
|
|
|
|
while ((j = fetchScriptByte()) != 0) {
|
|
|
|
if (j >= 0x80) {
|
|
|
|
_resourceMapper[j & 0x7F] = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_putActor() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int x, y;
|
|
|
|
Actor *a;
|
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
a = derefActor(getVarOrDirectByte(PARAM_1), "o5_putActor");
|
|
|
|
x = getVarOrDirectWord(PARAM_2);
|
|
|
|
y = getVarOrDirectWord(PARAM_3);
|
2006-11-19 00:39:48 +00:00
|
|
|
a->putActor(x, y);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_putActorAtObject() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int obj, x, y;
|
|
|
|
Actor *a;
|
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
a = derefActor(getVarOrDirectByte(PARAM_1), "o5_putActorAtObject");
|
|
|
|
obj = getVarOrDirectWord(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
if (whereIsObject(obj) != WIO_NOT_FOUND)
|
|
|
|
getObjectXYPos(obj, x, y);
|
|
|
|
else {
|
|
|
|
x = 240;
|
|
|
|
y = 120;
|
|
|
|
}
|
2006-11-19 00:39:48 +00:00
|
|
|
a->putActor(x, y);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_putActorInRoom() {
|
2002-12-12 16:29:21 +00:00
|
|
|
Actor *a;
|
2003-11-16 18:34:33 +00:00
|
|
|
int act = getVarOrDirectByte(PARAM_1);
|
|
|
|
int room = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(act, "o5_putActorInRoom");
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-03-11 01:10:06 +00:00
|
|
|
if (a->_visible && _currentRoom != room && getTalkingActor() == a->_number) {
|
2004-03-15 03:24:29 +00:00
|
|
|
stopTalk();
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
2005-03-11 01:10:06 +00:00
|
|
|
a->_room = room;
|
2002-12-12 16:29:21 +00:00
|
|
|
if (!room)
|
|
|
|
a->putActor(0, 0, 0);
|
|
|
|
}
|
|
|
|
|
2005-05-28 08:37:44 +00:00
|
|
|
void ScummEngine_v5::o5_systemOps() {
|
2003-06-02 02:25:24 +00:00
|
|
|
byte subOp = fetchScriptByte();
|
|
|
|
switch (subOp) {
|
2003-11-10 00:05:17 +00:00
|
|
|
case 1: // SO_RESTART
|
2003-06-02 02:25:24 +00:00
|
|
|
restart();
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 2: // SO_PAUSE
|
2003-06-02 02:25:24 +00:00
|
|
|
pauseGame();
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 3: // SO_QUIT
|
2008-07-11 01:22:37 +00:00
|
|
|
quitGame();
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-06-02 02:25:24 +00:00
|
|
|
default:
|
2005-05-28 08:37:44 +00:00
|
|
|
error("o5_systemOps: unknown subopcode %d", subOp);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_resourceRoutines() {
|
2011-05-13 12:02:53 +00:00
|
|
|
const ResType resType[4] = { rtScript, rtSound, rtCostume, rtRoom };
|
2002-12-12 16:29:21 +00:00
|
|
|
int resid = 0;
|
|
|
|
int foo, bar;
|
|
|
|
|
|
|
|
_opcode = fetchScriptByte();
|
|
|
|
if (_opcode != 17)
|
2003-11-16 18:34:33 +00:00
|
|
|
resid = getVarOrDirectByte(PARAM_1);
|
2006-02-20 16:51:30 +00:00
|
|
|
if (!(_game.platform == Common::kPlatformFMTowns)) {
|
2003-05-07 23:09:04 +00:00
|
|
|
// FIXME - this probably can be removed eventually, I don't think the following
|
|
|
|
// check will ever be triggered, but then I could be wrong and it's better
|
|
|
|
// to play it safe.
|
2003-06-07 00:49:36 +00:00
|
|
|
if ((_opcode & 0x3F) != (_opcode & 0x1F))
|
2003-05-07 23:09:04 +00:00
|
|
|
error("Oops, this shouldn't happen: o5_resourceRoutines opcode %d", _opcode);
|
|
|
|
}
|
|
|
|
|
|
|
|
int op = _opcode & 0x3F;
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2007-03-03 23:02:54 +00:00
|
|
|
// FIXME: Sound resources are currently missing
|
|
|
|
if (_game.id == GID_LOOM && _game.platform == Common::kPlatformPCEngine &&
|
|
|
|
(op == 2 || op == 6)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-04-17 22:37:16 +00:00
|
|
|
switch (op) {
|
2003-11-10 00:05:17 +00:00
|
|
|
case 1: // SO_LOAD_SCRIPT
|
|
|
|
case 2: // SO_LOAD_SOUND
|
|
|
|
case 3: // SO_LOAD_COSTUME
|
|
|
|
ensureResourceLoaded(resType[op - 1], resid);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 4: // SO_LOAD_ROOM
|
2009-03-20 23:02:40 +00:00
|
|
|
ensureResourceLoaded(rtRoom, resid);
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.version == 3) {
|
2002-12-12 16:29:21 +00:00
|
|
|
if (resid > 0x7F)
|
|
|
|
resid = _resourceMapper[resid & 0x7F];
|
|
|
|
|
|
|
|
if (_currentRoom != resid) {
|
2006-09-17 20:36:48 +00:00
|
|
|
_res->setResourceCounter(rtRoom, resid, 1);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
2009-03-20 23:02:40 +00:00
|
|
|
}
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
|
2003-11-10 00:05:17 +00:00
|
|
|
case 5: // SO_NUKE_SCRIPT
|
|
|
|
case 6: // SO_NUKE_SOUND
|
|
|
|
case 7: // SO_NUKE_COSTUME
|
|
|
|
case 8: // SO_NUKE_ROOM
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.id == GID_ZAK && (_game.platform == Common::kPlatformFMTowns))
|
2005-08-14 01:41:52 +00:00
|
|
|
error("o5_resourceRoutines %d should not occur in Zak256", op);
|
2002-12-12 16:29:21 +00:00
|
|
|
else
|
2006-09-17 20:36:48 +00:00
|
|
|
_res->setResourceCounter(resType[op-5], resid, 0x7F);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 9: // SO_LOCK_SCRIPT
|
2002-12-12 16:29:21 +00:00
|
|
|
if (resid >= _numGlobalScripts)
|
|
|
|
break;
|
2006-09-17 20:36:48 +00:00
|
|
|
_res->lock(rtScript, resid);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 10: // SO_LOCK_SOUND
|
2007-03-03 23:02:54 +00:00
|
|
|
// FIXME: Sound resources are currently missing
|
|
|
|
if (_game.id == GID_LOOM && _game.platform == Common::kPlatformPCEngine)
|
|
|
|
break;
|
2006-09-17 20:36:48 +00:00
|
|
|
_res->lock(rtSound, resid);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 11: // SO_LOCK_COSTUME
|
2006-09-17 20:36:48 +00:00
|
|
|
_res->lock(rtCostume, resid);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 12: // SO_LOCK_ROOM
|
2002-12-12 16:29:21 +00:00
|
|
|
if (resid > 0x7F)
|
|
|
|
resid = _resourceMapper[resid & 0x7F];
|
2006-09-17 20:36:48 +00:00
|
|
|
_res->lock(rtRoom, resid);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
|
2003-11-10 00:05:17 +00:00
|
|
|
case 13: // SO_UNLOCK_SCRIPT
|
2002-12-12 16:29:21 +00:00
|
|
|
if (resid >= _numGlobalScripts)
|
|
|
|
break;
|
2006-09-17 20:36:48 +00:00
|
|
|
_res->unlock(rtScript, resid);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 14: // SO_UNLOCK_SOUND
|
2007-03-03 23:02:54 +00:00
|
|
|
// FIXME: Sound resources are currently missing
|
|
|
|
if (_game.id == GID_LOOM && _game.platform == Common::kPlatformPCEngine)
|
|
|
|
break;
|
2006-09-17 20:36:48 +00:00
|
|
|
_res->unlock(rtSound, resid);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 15: // SO_UNLOCK_COSTUME
|
2006-09-17 20:36:48 +00:00
|
|
|
_res->unlock(rtCostume, resid);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 16: // SO_UNLOCK_ROOM
|
2002-12-12 16:29:21 +00:00
|
|
|
if (resid > 0x7F)
|
|
|
|
resid = _resourceMapper[resid & 0x7F];
|
2006-09-17 20:36:48 +00:00
|
|
|
_res->unlock(rtRoom, resid);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
|
2003-11-10 00:05:17 +00:00
|
|
|
case 17: // SO_CLEAR_HEAP
|
2003-05-13 23:33:01 +00:00
|
|
|
//heapClear(0);
|
|
|
|
//unkHeapProc2(0, 0);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 18: // SO_LOAD_CHARSET
|
2002-12-12 16:29:21 +00:00
|
|
|
loadCharset(resid);
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 19: // SO_NUKE_CHARSET
|
2002-12-12 16:29:21 +00:00
|
|
|
nukeCharset(resid);
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 20: // SO_LOAD_OBJECT
|
2003-11-16 18:34:33 +00:00
|
|
|
loadFlObject(getVarOrDirectWord(PARAM_2), resid);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
|
2003-09-14 13:42:28 +00:00
|
|
|
// TODO: For the following see also Hibarnatus' information on bug #805691.
|
2003-07-13 02:25:36 +00:00
|
|
|
case 32:
|
2004-09-29 09:47:38 +00:00
|
|
|
// TODO (apparently never used in FM-TOWNS)
|
2009-09-11 10:13:54 +00:00
|
|
|
debug(0, "o5_resourceRoutines %d not yet handled (script %d)", op, vm.slot[_currentScript].number);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-07-13 02:25:36 +00:00
|
|
|
case 33:
|
2004-09-29 09:47:38 +00:00
|
|
|
// TODO (apparently never used in FM-TOWNS)
|
2009-09-11 10:13:54 +00:00
|
|
|
debug(0, "o5_resourceRoutines %d not yet handled (script %d)", op, vm.slot[_currentScript].number);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-07-13 02:25:36 +00:00
|
|
|
case 35:
|
2010-08-18 21:38:43 +00:00
|
|
|
if (_townsPlayer)
|
|
|
|
_townsPlayer->setVolumeCD(getVarOrDirectByte(PARAM_2), resid);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-07-13 02:25:36 +00:00
|
|
|
case 36:
|
2003-11-16 18:34:33 +00:00
|
|
|
foo = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
bar = fetchScriptByte();
|
2010-08-18 21:38:43 +00:00
|
|
|
if (_townsPlayer)
|
2011-06-19 22:59:48 +00:00
|
|
|
_townsPlayer->setSoundVolume(resid, foo, bar);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-07-13 02:25:36 +00:00
|
|
|
case 37:
|
2010-08-18 21:38:43 +00:00
|
|
|
if (_townsPlayer)
|
|
|
|
_townsPlayer->setSoundNote(resid, getVarOrDirectByte(PARAM_2));
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2005-10-12 05:58:57 +00:00
|
|
|
error("o5_resourceRoutines: default case %d", op);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_roomOps() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int a = 0, b = 0, c, d, e;
|
2010-10-10 10:26:49 +00:00
|
|
|
const bool paramsBeforeOpcode = ((_game.version == 3) && (_game.platform != Common::kPlatformPCEngine));
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2009-03-20 23:02:40 +00:00
|
|
|
if (paramsBeforeOpcode) {
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
|
|
|
b = getVarOrDirectWord(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_opcode = fetchScriptByte();
|
|
|
|
switch (_opcode & 0x1F) {
|
2003-11-10 00:05:17 +00:00
|
|
|
case 1: // SO_ROOM_SCROLL
|
2009-03-20 23:02:40 +00:00
|
|
|
if (!paramsBeforeOpcode) {
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
|
|
|
b = getVarOrDirectWord(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
2003-05-10 21:49:59 +00:00
|
|
|
if (a < (_screenWidth / 2))
|
|
|
|
a = (_screenWidth / 2);
|
|
|
|
if (b < (_screenWidth / 2))
|
|
|
|
b = (_screenWidth / 2);
|
|
|
|
if (a > _roomWidth - (_screenWidth / 2))
|
|
|
|
a = _roomWidth - (_screenWidth / 2);
|
|
|
|
if (b > _roomWidth - (_screenWidth / 2))
|
|
|
|
b = _roomWidth - (_screenWidth / 2);
|
2003-05-08 15:48:50 +00:00
|
|
|
VAR(VAR_CAMERA_MIN_X) = a;
|
|
|
|
VAR(VAR_CAMERA_MAX_X) = b;
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 2: // SO_ROOM_COLOR
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.features & GF_SMALL_HEADER) {
|
2009-03-20 23:02:40 +00:00
|
|
|
if (!paramsBeforeOpcode) {
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
|
|
|
b = getVarOrDirectWord(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
2006-09-16 13:38:43 +00:00
|
|
|
assertRange(0, a, 256, "o5_roomOps: 2: room color slot");
|
2003-10-05 02:58:11 +00:00
|
|
|
_roomPalette[b] = a;
|
|
|
|
_fullRedraw = true;
|
2003-08-27 06:56:54 +00:00
|
|
|
} else {
|
2002-12-12 16:29:21 +00:00
|
|
|
error("room-color is no longer a valid command");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2003-11-10 00:05:17 +00:00
|
|
|
case 3: // SO_ROOM_SCREEN
|
2009-03-20 23:02:40 +00:00
|
|
|
if (!paramsBeforeOpcode) {
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
|
|
|
b = getVarOrDirectWord(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
2004-01-04 14:49:14 +00:00
|
|
|
initScreens(a, b);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 4: // SO_ROOM_PALETTE
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.features & GF_SMALL_HEADER) {
|
2009-03-20 23:02:40 +00:00
|
|
|
if (!paramsBeforeOpcode) {
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
|
|
|
b = getVarOrDirectWord(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
2006-09-16 13:38:43 +00:00
|
|
|
assertRange(0, a, 256, "o5_roomOps: 4: room color slot");
|
2002-12-12 16:29:21 +00:00
|
|
|
_shadowPalette[b] = a;
|
2003-05-03 20:49:53 +00:00
|
|
|
setDirtyColors(b, b);
|
2002-12-12 16:29:21 +00:00
|
|
|
} else {
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
|
|
|
b = getVarOrDirectWord(PARAM_2);
|
|
|
|
c = getVarOrDirectWord(PARAM_3);
|
2002-12-12 16:29:21 +00:00
|
|
|
_opcode = fetchScriptByte();
|
2003-11-16 18:34:33 +00:00
|
|
|
d = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
setPalColor(d, a, b, c); /* index, r, g, b */
|
|
|
|
}
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 5: // SO_ROOM_SHAKE_ON
|
2002-12-12 16:29:21 +00:00
|
|
|
setShake(1);
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 6: // SO_ROOM_SHAKE_OFF
|
2002-12-12 16:29:21 +00:00
|
|
|
setShake(0);
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 7: // SO_ROOM_SCALE
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
|
|
|
b = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
_opcode = fetchScriptByte();
|
2003-11-16 18:34:33 +00:00
|
|
|
c = getVarOrDirectByte(PARAM_1);
|
|
|
|
d = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
_opcode = fetchScriptByte();
|
2003-11-16 18:34:33 +00:00
|
|
|
e = getVarOrDirectByte(PARAM_2);
|
2003-09-09 17:29:22 +00:00
|
|
|
setScaleSlot(e - 1, 0, b, a, 0, d, c);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 8: // SO_ROOM_INTENSITY
|
2006-11-05 00:22:46 +00:00
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
|
|
|
b = getVarOrDirectByte(PARAM_2);
|
|
|
|
c = getVarOrDirectByte(PARAM_3);
|
2003-07-13 05:07:27 +00:00
|
|
|
darkenPalette(a, a, a, b, c);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 9: // SO_ROOM_SAVEGAME
|
2003-11-16 18:34:33 +00:00
|
|
|
_saveLoadFlag = getVarOrDirectByte(PARAM_1);
|
|
|
|
_saveLoadSlot = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
_saveLoadSlot = 99; /* use this slot */
|
2004-01-31 22:12:35 +00:00
|
|
|
_saveTemporaryState = true;
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 10: // SO_ROOM_FADE
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
if (a) {
|
2010-10-05 19:04:52 +00:00
|
|
|
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.platform == Common::kPlatformFMTowns) {
|
2005-06-07 20:44:19 +00:00
|
|
|
switch (a) {
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
case 8:
|
|
|
|
towns_drawStripToScreen(&_virtscr[kMainVirtScreen], 0, _virtscr[kMainVirtScreen].topline, 0, 0, _virtscr[kMainVirtScreen].w, _virtscr[kMainVirtScreen].topline + _virtscr[kMainVirtScreen].h);
|
|
|
|
_townsScreen->update();
|
|
|
|
return;
|
|
|
|
case 9:
|
|
|
|
_townsActiveLayerFlags = 2;
|
|
|
|
_townsScreen->toggleLayers(_townsActiveLayerFlags);
|
|
|
|
return;
|
|
|
|
case 10:
|
|
|
|
_townsActiveLayerFlags = 3;
|
|
|
|
_townsScreen->toggleLayers(_townsActiveLayerFlags);
|
|
|
|
return;
|
|
|
|
case 11:
|
|
|
|
_townsScreen->clearLayer(1);
|
|
|
|
return;
|
|
|
|
case 12:
|
|
|
|
_townsActiveLayerFlags = 0;
|
|
|
|
_townsScreen->toggleLayers(_townsActiveLayerFlags);
|
|
|
|
return;
|
|
|
|
case 13:
|
|
|
|
_townsActiveLayerFlags = 1;
|
|
|
|
_townsScreen->toggleLayers(_townsActiveLayerFlags);
|
|
|
|
return;
|
|
|
|
case 16: // enable clearing of layer 2 buffer in drawBitmap()
|
|
|
|
_townsPaletteFlags |= 2;
|
|
|
|
return;
|
|
|
|
case 17: // disable clearing of layer 2 buffer in drawBitmap()
|
|
|
|
_townsPaletteFlags &= ~2;
|
|
|
|
return;
|
|
|
|
case 18: // clear kMainVirtScreen layer 2 buffer
|
|
|
|
_textSurface.fillRect(Common::Rect(0, _virtscr[kMainVirtScreen].topline * _textSurfaceMultiplier, _textSurface.pitch, (_virtscr[kMainVirtScreen].topline + _virtscr[kMainVirtScreen].h) * _textSurfaceMultiplier), 0);
|
2017-08-11 18:20:25 +00:00
|
|
|
return;
|
2005-06-07 20:44:19 +00:00
|
|
|
case 19: // enable palette operations (palManipulate(), cyclePalette() etc.)
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
_townsPaletteFlags |= 1;
|
|
|
|
return;
|
2005-06-07 20:44:19 +00:00
|
|
|
case 20: // disable palette operations
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
_townsPaletteFlags &= ~1;
|
|
|
|
return;
|
|
|
|
case 21: // disable clearing of layer 0 in initScreens()
|
|
|
|
_townsClearLayerFlag = 1;
|
|
|
|
return;
|
|
|
|
case 22: // enable clearing of layer 0 in initScreens()
|
|
|
|
_townsClearLayerFlag = 0;
|
|
|
|
return;
|
2005-09-30 13:46:46 +00:00
|
|
|
case 30:
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
_townsOverrideShadowColor = 3;
|
2005-06-07 20:44:19 +00:00
|
|
|
return;
|
2019-12-23 11:56:16 +00:00
|
|
|
default:
|
|
|
|
break;
|
2005-06-07 20:44:19 +00:00
|
|
|
}
|
|
|
|
}
|
2010-10-05 19:04:52 +00:00
|
|
|
#endif // DISABLE_TOWNS_DUAL_LAYER_MODE
|
2003-11-16 18:34:33 +00:00
|
|
|
_switchRoomEffect = (byte)(a & 0xFF);
|
2002-12-12 16:29:21 +00:00
|
|
|
_switchRoomEffect2 = (byte)(a >> 8);
|
|
|
|
} else {
|
|
|
|
fadeIn(_newEffect);
|
|
|
|
}
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 11: // SO_RGB_ROOM_INTENSITY
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
|
|
|
b = getVarOrDirectWord(PARAM_2);
|
|
|
|
c = getVarOrDirectWord(PARAM_3);
|
2002-12-12 16:29:21 +00:00
|
|
|
_opcode = fetchScriptByte();
|
2003-11-16 18:34:33 +00:00
|
|
|
d = getVarOrDirectByte(PARAM_1);
|
|
|
|
e = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
darkenPalette(a, b, c, d, e);
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 12: // SO_ROOM_SHADOW
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
|
|
|
b = getVarOrDirectWord(PARAM_2);
|
|
|
|
c = getVarOrDirectWord(PARAM_3);
|
2002-12-12 16:29:21 +00:00
|
|
|
_opcode = fetchScriptByte();
|
2003-11-16 18:34:33 +00:00
|
|
|
d = getVarOrDirectByte(PARAM_1);
|
|
|
|
e = getVarOrDirectByte(PARAM_2);
|
2006-04-29 16:24:39 +00:00
|
|
|
setShadowPalette(a, b, c, d, e, 0, 256);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
|
2003-11-10 00:05:17 +00:00
|
|
|
case 13: // SO_SAVE_STRING
|
|
|
|
{
|
2011-10-01 03:34:44 +00:00
|
|
|
// This subopcode is used in Indy 4 to save the IQ points
|
|
|
|
// data. No other LucasArts game uses it. We use this fact
|
|
|
|
// to substitute a filename based on the targetname
|
|
|
|
// ("TARGET.iq").
|
|
|
|
//
|
|
|
|
// This way, the iq data of each Indy 4 variant stays
|
|
|
|
// separate. Moreover, the filename now clearly reflects to
|
|
|
|
// which target it belongs (as it should).
|
|
|
|
//
|
|
|
|
// In addition, the Monkey Island fan patch (which adds
|
|
|
|
// speech support and more things to MI 1 and 2) uses
|
|
|
|
// this opcode to generate a "monkey.cfg" file containing.
|
|
|
|
// some user controllable settings.
|
|
|
|
// Once more we use a custom filename ("TARGET.cfg").
|
2009-03-16 03:55:09 +00:00
|
|
|
Common::String filename;
|
|
|
|
char chr;
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
2009-03-16 03:55:09 +00:00
|
|
|
while ((chr = fetchScriptByte()))
|
|
|
|
filename += chr;
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2009-12-04 14:25:31 +00:00
|
|
|
if (_game.id == GID_INDY4) {
|
2009-03-16 03:55:09 +00:00
|
|
|
filename = _targetName + ".iq";
|
2011-10-01 03:34:44 +00:00
|
|
|
} else if (_game.id == GID_MONKEY || _game.id == GID_MONKEY2) {
|
|
|
|
filename = _targetName + ".cfg";
|
2009-03-16 03:55:09 +00:00
|
|
|
} else {
|
2009-05-31 10:02:16 +00:00
|
|
|
error("SO_SAVE_STRING: Unsupported filename %s", filename.c_str());
|
2009-03-16 03:55:09 +00:00
|
|
|
}
|
|
|
|
|
2009-05-29 14:38:22 +00:00
|
|
|
Common::OutSaveFile *file = _saveFileMan->openForSaving(filename);
|
2003-08-10 20:50:50 +00:00
|
|
|
if (file != NULL) {
|
2002-12-12 16:29:21 +00:00
|
|
|
byte *ptr;
|
|
|
|
ptr = getResourceAddress(rtString, a);
|
2003-08-10 20:50:50 +00:00
|
|
|
file->write(ptr, resStrLen(ptr) + 1);
|
|
|
|
delete file;
|
2004-07-26 00:12:51 +00:00
|
|
|
VAR(VAR_SOUNDRESULT) = 0;
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2003-11-10 09:16:41 +00:00
|
|
|
case 14: // SO_LOAD_STRING
|
2003-11-10 00:05:17 +00:00
|
|
|
{
|
2009-12-04 14:25:31 +00:00
|
|
|
// This subopcode is used in Indy 4 to load the IQ points data.
|
|
|
|
// See SO_SAVE_STRING for details
|
2009-03-16 03:55:09 +00:00
|
|
|
Common::String filename;
|
|
|
|
char chr;
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
2009-03-16 03:55:09 +00:00
|
|
|
while ((chr = fetchScriptByte()))
|
|
|
|
filename += chr;
|
|
|
|
|
2009-12-04 14:25:31 +00:00
|
|
|
if (_game.id == GID_INDY4) {
|
2009-03-16 03:55:09 +00:00
|
|
|
filename = _targetName + ".iq";
|
2011-10-01 03:34:44 +00:00
|
|
|
} else if (_game.id == GID_MONKEY || _game.id == GID_MONKEY2) {
|
|
|
|
filename = _targetName + ".cfg";
|
2009-03-16 03:55:09 +00:00
|
|
|
} else {
|
2009-05-31 10:02:16 +00:00
|
|
|
error("SO_LOAD_STRING: Unsupported filename %s", filename.c_str());
|
2009-03-16 03:55:09 +00:00
|
|
|
}
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2009-05-29 14:38:22 +00:00
|
|
|
Common::InSaveFile *file = _saveFileMan->openForLoading(filename);
|
2003-08-10 20:50:50 +00:00
|
|
|
if (file != NULL) {
|
2002-12-12 16:29:21 +00:00
|
|
|
byte *ptr;
|
2010-10-18 18:56:40 +00:00
|
|
|
const int len = file->size();
|
|
|
|
ptr = (byte *)malloc(len + 1);
|
|
|
|
assert(ptr);
|
|
|
|
int r = file->read(ptr, len);
|
|
|
|
assert(r == len);
|
|
|
|
ptr[len] = '\0';
|
2002-12-12 16:29:21 +00:00
|
|
|
loadPtrToResource(rtString, a, ptr);
|
|
|
|
free(ptr);
|
2003-09-30 23:43:59 +00:00
|
|
|
delete file;
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2003-11-10 00:05:17 +00:00
|
|
|
case 15: // SO_ROOM_TRANSFORM
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
_opcode = fetchScriptByte();
|
2003-11-16 18:34:33 +00:00
|
|
|
b = getVarOrDirectByte(PARAM_1);
|
|
|
|
c = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
_opcode = fetchScriptByte();
|
2003-11-16 18:34:33 +00:00
|
|
|
d = getVarOrDirectByte(PARAM_1);
|
2003-12-17 17:12:09 +00:00
|
|
|
palManipulateInit(a, b, c, d);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
|
2003-11-10 00:05:17 +00:00
|
|
|
case 16: // SO_CYCLE_SPEED
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
|
|
|
b = getVarOrDirectByte(PARAM_2);
|
2006-09-16 13:38:43 +00:00
|
|
|
assertRange(1, a, 16, "o5_roomOps: 16: color cycle");
|
2002-12-12 16:29:21 +00:00
|
|
|
_colorCycle[a - 1].delay = (b != 0) ? 0x4000 / (b * 0x4C) : 0;
|
|
|
|
break;
|
2003-04-28 14:46:55 +00:00
|
|
|
default:
|
2003-07-13 16:22:17 +00:00
|
|
|
error("o5_roomOps: unknown subopcode %d", _opcode & 0x1F);
|
2019-12-23 11:56:16 +00:00
|
|
|
break;
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_saveRestoreVerbs() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int a, b, c, slot, slot2;
|
|
|
|
|
|
|
|
_opcode = fetchScriptByte();
|
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
|
|
|
b = getVarOrDirectByte(PARAM_2);
|
|
|
|
c = getVarOrDirectByte(PARAM_3);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
switch (_opcode) {
|
2003-11-10 00:05:17 +00:00
|
|
|
case 1: // SO_SAVE_VERBS
|
2002-12-12 16:29:21 +00:00
|
|
|
while (a <= b) {
|
|
|
|
slot = getVerbSlot(a, 0);
|
|
|
|
if (slot && _verbs[slot].saveid == 0) {
|
|
|
|
_verbs[slot].saveid = c;
|
|
|
|
drawVerb(slot, 0);
|
|
|
|
verbMouseOver(0);
|
|
|
|
}
|
|
|
|
a++;
|
|
|
|
}
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 2: // SO_RESTORE_VERBS
|
2002-12-12 16:29:21 +00:00
|
|
|
while (a <= b) {
|
|
|
|
slot = getVerbSlot(a, c);
|
|
|
|
if (slot) {
|
|
|
|
slot2 = getVerbSlot(a, 0);
|
|
|
|
if (slot2)
|
|
|
|
killVerb(slot2);
|
|
|
|
slot = getVerbSlot(a, c);
|
|
|
|
_verbs[slot].saveid = 0;
|
|
|
|
drawVerb(slot, 0);
|
|
|
|
verbMouseOver(0);
|
|
|
|
}
|
|
|
|
a++;
|
|
|
|
}
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 3: // SO_DELETE_VERBS
|
2002-12-12 16:29:21 +00:00
|
|
|
while (a <= b) {
|
|
|
|
slot = getVerbSlot(a, c);
|
|
|
|
if (slot)
|
|
|
|
killVerb(slot);
|
|
|
|
a++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2003-09-05 20:47:23 +00:00
|
|
|
error("o5_saveRestoreVerbs: unknown subopcode %d", _opcode);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_setCameraAt() {
|
2003-11-16 18:34:33 +00:00
|
|
|
setCameraAtEx(getVarOrDirectWord(PARAM_1));
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_setObjectName() {
|
2003-11-16 18:34:33 +00:00
|
|
|
int obj = getVarOrDirectWord(PARAM_1);
|
2004-03-17 01:50:15 +00:00
|
|
|
setObjectName(obj);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_setOwnerOf() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int obj, owner;
|
|
|
|
|
2006-12-11 06:20:17 +00:00
|
|
|
obj = getVarOrDirectWord(PARAM_1);
|
|
|
|
owner = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
setOwnerOf(obj, owner);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_setState() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int obj, state;
|
2003-11-16 18:34:33 +00:00
|
|
|
obj = getVarOrDirectWord(PARAM_1);
|
|
|
|
state = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
putState(obj, state);
|
2004-01-11 20:42:40 +00:00
|
|
|
markObjectRectAsDirty(obj);
|
2004-09-18 22:42:45 +00:00
|
|
|
if (_bgNeedsRedraw)
|
2002-12-12 16:29:21 +00:00
|
|
|
clearDrawObjectQueue();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_setVarRange() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int a, b;
|
|
|
|
|
|
|
|
getResultPos();
|
|
|
|
a = fetchScriptByte();
|
|
|
|
do {
|
|
|
|
if (_opcode & 0x80)
|
2003-05-04 13:50:28 +00:00
|
|
|
b = fetchScriptWordSigned();
|
2002-12-12 16:29:21 +00:00
|
|
|
else
|
|
|
|
b = fetchScriptByte();
|
|
|
|
|
|
|
|
setResult(b);
|
|
|
|
_resultVarNumber++;
|
|
|
|
} while (--a);
|
2005-10-01 13:02:35 +00:00
|
|
|
|
2009-04-19 00:59:50 +00:00
|
|
|
// Macintosh version of indy3ega used different interface, so adjust values.
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.id == GID_INDY3 && _game.platform == Common::kPlatformMacintosh) {
|
2005-10-01 13:02:35 +00:00
|
|
|
VAR(68) = 0;
|
|
|
|
VAR(69) = 0;
|
|
|
|
VAR(70) = 168;
|
|
|
|
VAR(71) = 0;
|
|
|
|
VAR(72) = 168;
|
|
|
|
VAR(73) = 0;
|
|
|
|
VAR(74) = 168;
|
|
|
|
VAR(75) = 0;
|
|
|
|
VAR(76) = 176;
|
|
|
|
VAR(77) = 176;
|
|
|
|
VAR(78) = 184;
|
|
|
|
VAR(79) = 184;
|
|
|
|
VAR(80) = 192;
|
|
|
|
VAR(81) = 192;
|
|
|
|
}
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_startMusic() {
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.platform == Common::kPlatformFMTowns && _game.version == 3) {
|
2004-09-29 09:47:38 +00:00
|
|
|
// In FM-TOWNS games this is some kind of Audio CD status query function.
|
2003-06-30 23:18:20 +00:00
|
|
|
// See also bug #762589 (thanks to Hibernatus for providing the information).
|
2003-06-24 17:31:35 +00:00
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
int b = getVarOrDirectByte(PARAM_1);
|
2003-06-30 23:18:20 +00:00
|
|
|
int result = 0;
|
|
|
|
switch (b) {
|
|
|
|
case 0:
|
2003-07-06 06:36:26 +00:00
|
|
|
result = _sound->pollCD() == 0;
|
2003-06-30 23:18:20 +00:00
|
|
|
break;
|
|
|
|
case 0xFC:
|
|
|
|
// TODO: Unpause (resume) audio track. We'll have to extend Sound and OSystem for this.
|
|
|
|
break;
|
|
|
|
case 0xFD:
|
|
|
|
// TODO: Pause audio track. We'll have to extend Sound and OSystem for this.
|
|
|
|
break;
|
|
|
|
case 0xFE:
|
|
|
|
result = _sound->getCurrentCDSound();
|
|
|
|
break;
|
|
|
|
case 0xFF:
|
2010-08-18 21:38:43 +00:00
|
|
|
result = _townsPlayer->getCurrentCdaVolume();
|
2003-06-30 23:18:20 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
// TODO: return track length in seconds. We'll have to extend Sound and OSystem for this.
|
2005-07-30 21:11:48 +00:00
|
|
|
// To check scummvm returns the right track length you
|
|
|
|
// can look at the global script #9 (0x888A in 49.LFL).
|
2003-06-30 23:18:20 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-08-22 09:30:08 +00:00
|
|
|
debugC(DEBUG_GENERAL,"o5_startMusic(%d)", b);
|
2003-07-23 05:17:21 +00:00
|
|
|
setResult(result);
|
2003-06-24 17:31:35 +00:00
|
|
|
} else {
|
2003-11-16 18:34:33 +00:00
|
|
|
_sound->addSoundToQueue(getVarOrDirectByte(PARAM_1));
|
2003-05-08 00:28:05 +00:00
|
|
|
}
|
2003-05-03 17:50:04 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_startSound() {
|
2004-02-26 07:31:48 +00:00
|
|
|
const byte *oldaddr = _scriptPointer - 1;
|
|
|
|
int sound = getVarOrDirectByte(PARAM_1);
|
|
|
|
|
|
|
|
// WORKAROUND: In the scene where Largo is talking to Mad Marty, the
|
|
|
|
// Woodtick music often resumes before Largo's theme has finished. As
|
|
|
|
// far as I can tell, this is a script bug.
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.id == GID_MONKEY2 && sound == 110 && _sound->isSoundRunning(151)) {
|
2008-01-05 23:57:12 +00:00
|
|
|
debug(1, "Delaying Woodtick music until Largo's theme has finished");
|
2004-02-26 07:31:48 +00:00
|
|
|
_scriptPointer = oldaddr;
|
|
|
|
o5_breakHere();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-09-24 05:26:12 +00:00
|
|
|
if (VAR_MUSIC_TIMER != 0xFF)
|
|
|
|
VAR(VAR_MUSIC_TIMER) = 0;
|
2004-02-26 07:31:48 +00:00
|
|
|
_sound->addSoundToQueue(sound);
|
2003-05-03 17:50:04 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_stopMusic() {
|
2003-05-03 17:50:04 +00:00
|
|
|
_sound->stopAllSounds();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_stopSound() {
|
2003-11-16 18:34:33 +00:00
|
|
|
_sound->stopSound(getVarOrDirectByte(PARAM_1));
|
2003-05-03 17:50:04 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_isSoundRunning() {
|
2003-05-03 17:50:04 +00:00
|
|
|
int snd;
|
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
snd = getVarOrDirectByte(PARAM_1);
|
2003-05-03 17:50:04 +00:00
|
|
|
if (snd)
|
|
|
|
snd = _sound->isSoundRunning(snd);
|
|
|
|
setResult(snd);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_soundKludge() {
|
2013-05-01 05:47:56 +00:00
|
|
|
int items[NUM_SCRIPT_LOCAL];
|
2002-12-25 14:46:39 +00:00
|
|
|
int num = getWordVararg(items);
|
|
|
|
_sound->soundKludge(items, num);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_startObject() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int obj, script;
|
2013-05-01 05:47:56 +00:00
|
|
|
int data[NUM_SCRIPT_LOCAL];
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
obj = getVarOrDirectWord(PARAM_1);
|
|
|
|
script = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
getWordVararg(data);
|
2003-05-20 20:58:26 +00:00
|
|
|
runObjectScript(obj, script, 0, 0, data);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_startScript() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int op, script;
|
2013-05-01 05:47:56 +00:00
|
|
|
int data[NUM_SCRIPT_LOCAL];
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
op = _opcode;
|
2003-11-16 18:34:33 +00:00
|
|
|
script = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
getWordVararg(data);
|
|
|
|
|
2006-11-07 20:55:05 +00:00
|
|
|
// WORKAROUND bug #1290485: Script 171 loads a complete room resource,
|
|
|
|
// instead of the actual script, causing invalid opcode cases
|
2006-07-15 04:31:17 +00:00
|
|
|
if (_game.id == GID_ZAK && _game.platform == Common::kPlatformFMTowns && script == 171)
|
2005-10-12 05:58:57 +00:00
|
|
|
return;
|
|
|
|
|
2011-07-13 11:33:51 +00:00
|
|
|
// WORKAROUND bug #3306145 (also occurs in original): Some old versions of
|
|
|
|
// Indy3 sometimes fail to allocate IQ points correctly. To quote:
|
|
|
|
// "In the Amiga version you get the 15 points for puzzle 30 if you give the
|
|
|
|
// book or KO the guy. The PC version correctly gives 10 points for puzzle
|
|
|
|
// 29 for KO and 15 for puzzle 30 when giving the book."
|
|
|
|
// This workaround is meant to address that.
|
|
|
|
if (_game.id == GID_INDY3 && vm.slot[_currentScript].number == 106 && script == 125 && VAR(115) != 2) {
|
|
|
|
// If Var[115] != 2, then:
|
|
|
|
// Correct: startScript(125,[29,10]);
|
|
|
|
// Wrong : startScript(125,[30,15]);
|
|
|
|
data[0] = 29;
|
|
|
|
data[1] = 10;
|
|
|
|
}
|
|
|
|
|
2006-07-16 02:39:22 +00:00
|
|
|
// Method used by original games to skip copy protection scheme
|
2004-07-24 07:14:26 +00:00
|
|
|
if (!_copyProtection) {
|
2006-07-16 02:39:22 +00:00
|
|
|
// Copy protection was disabled in LucasArts Classic Adventures (PC Disk)
|
2013-05-02 22:26:58 +00:00
|
|
|
if (_game.id == GID_LOOM && _game.platform == Common::kPlatformDOS && _game.version == 3 && _currentRoom == 69 && script == 201)
|
2004-07-24 07:14:26 +00:00
|
|
|
script = 205;
|
2007-04-04 13:01:09 +00:00
|
|
|
// Copy protection was disabled in KIXX XL release (Amiga Disk) and
|
|
|
|
// in LucasArts Classic Adventures (PC Disk)
|
|
|
|
if (_game.id == GID_MONKEY_VGA && script == 152)
|
2004-07-24 07:14:26 +00:00
|
|
|
return;
|
2006-07-16 02:39:22 +00:00
|
|
|
// Copy protection was disabled in LucasArts Mac CD Game Pack II (Macintosh CD)
|
|
|
|
if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformMacintosh && script == 155)
|
|
|
|
return;
|
2004-07-24 07:14:26 +00:00
|
|
|
}
|
2004-07-23 08:59:07 +00:00
|
|
|
|
2003-05-30 22:22:51 +00:00
|
|
|
runScript(script, (op & 0x20) != 0, (op & 0x40) != 0, data);
|
2009-03-23 22:34:53 +00:00
|
|
|
|
|
|
|
// WORKAROUND: Indy3 does not save the series IQ automatically after changing it.
|
|
|
|
// Save on IQ increment (= script 125 was executed).
|
|
|
|
if (_game.id == GID_INDY3 && script == 125)
|
2009-04-19 01:01:54 +00:00
|
|
|
((ScummEngine_v4 *)this)->updateIQPoints();
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_stopObjectCode() {
|
2002-12-12 16:29:21 +00:00
|
|
|
stopObjectCode();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_stopObjectScript() {
|
2003-11-16 18:34:33 +00:00
|
|
|
stopObjectScript(getVarOrDirectWord(PARAM_1));
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_stopScript() {
|
2006-02-20 14:01:49 +00:00
|
|
|
const byte *oldaddr = _scriptPointer - 1;
|
2002-12-12 16:29:21 +00:00
|
|
|
int script;
|
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
script = getVarOrDirectByte(PARAM_1);
|
2003-07-31 15:32:57 +00:00
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.id == GID_INDY4 && script == 164 &&
|
2006-02-20 14:01:49 +00:00
|
|
|
_roomResource == 50 && vm.slot[_currentScript].number == 213 && VAR(VAR_HAVE_MSG)) {
|
|
|
|
// WORKAROUND bug #1308033: Due to a script bug, a line of text is skipped
|
|
|
|
// which Indy is supposed to speak when he finds Orichalcum in some old
|
|
|
|
// bones in the caves below Crete.
|
|
|
|
_scriptPointer = oldaddr;
|
|
|
|
o5_breakHere();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-12-12 16:29:21 +00:00
|
|
|
if (!script)
|
|
|
|
stopObjectCode();
|
|
|
|
else
|
2003-05-20 20:58:26 +00:00
|
|
|
stopScript(script);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_stringOps() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int a, b, c, i;
|
|
|
|
byte *ptr;
|
|
|
|
|
|
|
|
_opcode = fetchScriptByte();
|
|
|
|
switch (_opcode & 0x1F) {
|
|
|
|
case 1: /* loadstring */
|
2003-11-16 18:34:33 +00:00
|
|
|
loadPtrToResource(rtString, getVarOrDirectByte(PARAM_1), NULL);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2019-12-23 11:56:16 +00:00
|
|
|
|
2002-12-12 16:29:21 +00:00
|
|
|
case 2: /* copystring */
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
|
|
|
b = getVarOrDirectByte(PARAM_2);
|
2010-10-18 18:56:20 +00:00
|
|
|
assert(a != b);
|
2006-09-17 20:36:48 +00:00
|
|
|
_res->nukeResource(rtString, a);
|
2002-12-12 16:29:21 +00:00
|
|
|
ptr = getResourceAddress(rtString, b);
|
|
|
|
if (ptr)
|
|
|
|
loadPtrToResource(rtString, a, ptr);
|
|
|
|
break;
|
2019-12-23 11:56:16 +00:00
|
|
|
|
2002-12-12 16:29:21 +00:00
|
|
|
case 3: /* set string char */
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
|
|
|
b = getVarOrDirectByte(PARAM_2);
|
|
|
|
c = getVarOrDirectByte(PARAM_3);
|
2002-12-12 16:29:21 +00:00
|
|
|
ptr = getResourceAddress(rtString, a);
|
2006-03-19 02:50:51 +00:00
|
|
|
if (ptr == NULL)
|
|
|
|
error("String %d does not exist", a);
|
|
|
|
ptr[b] = c;
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 4: /* get string char */
|
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
|
|
|
b = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
ptr = getResourceAddress(rtString, a);
|
|
|
|
if (ptr == NULL)
|
|
|
|
error("String %d does not exist", a);
|
|
|
|
setResult(ptr[b]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5: /* create empty string */
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectByte(PARAM_1);
|
|
|
|
b = getVarOrDirectByte(PARAM_2);
|
2006-09-17 20:36:48 +00:00
|
|
|
_res->nukeResource(rtString, a);
|
2002-12-12 16:29:21 +00:00
|
|
|
if (b) {
|
2006-09-17 20:36:48 +00:00
|
|
|
ptr = _res->createResource(rtString, a, b);
|
2002-12-12 16:29:21 +00:00
|
|
|
if (ptr) {
|
|
|
|
for (i = 0; i < b; i++)
|
|
|
|
ptr[i] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2019-12-23 11:56:16 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_subtract() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int a;
|
|
|
|
getResultPos();
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
setResult(readVar(_resultVarNumber) - a);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_verbOps() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int verb, slot;
|
|
|
|
VerbSlot *vs;
|
|
|
|
int a, b;
|
|
|
|
byte *ptr;
|
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
verb = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
slot = getVerbSlot(verb, 0);
|
2006-09-16 13:38:43 +00:00
|
|
|
assertRange(0, slot, _numVerbs - 1, "new verb slot");
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
vs = &_verbs[slot];
|
|
|
|
vs->verbid = verb;
|
|
|
|
|
|
|
|
while ((_opcode = fetchScriptByte()) != 0xFF) {
|
|
|
|
switch (_opcode & 0x1F) {
|
2003-11-10 00:05:17 +00:00
|
|
|
case 1: // SO_VERB_IMAGE
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
if (slot) {
|
|
|
|
setVerbObject(_roomResource, a, slot);
|
|
|
|
vs->type = kImageVerbType;
|
|
|
|
}
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 2: // SO_VERB_NAME
|
2002-12-12 16:29:21 +00:00
|
|
|
loadPtrToResource(rtVerb, slot, NULL);
|
|
|
|
if (slot == 0)
|
2006-09-17 20:36:48 +00:00
|
|
|
_res->nukeResource(rtVerb, slot);
|
2002-12-12 16:29:21 +00:00
|
|
|
vs->type = kTextVerbType;
|
|
|
|
vs->imgindex = 0;
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 3: // SO_VERB_COLOR
|
2003-11-16 18:34:33 +00:00
|
|
|
vs->color = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 4: // SO_VERB_HICOLOR
|
2003-11-16 18:34:33 +00:00
|
|
|
vs->hicolor = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 5: // SO_VERB_AT
|
2004-01-15 19:25:17 +00:00
|
|
|
vs->curRect.left = getVarOrDirectWord(PARAM_1);
|
|
|
|
vs->curRect.top = getVarOrDirectWord(PARAM_2);
|
2006-11-07 20:55:05 +00:00
|
|
|
// Macintosh version of indy3ega used different interface, so adjust values.
|
2006-02-20 16:51:30 +00:00
|
|
|
if ((_game.platform == Common::kPlatformMacintosh) && (_game.id == GID_INDY3)) {
|
2005-10-02 01:26:53 +00:00
|
|
|
switch (verb) {
|
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
case 9:
|
|
|
|
vs->curRect.left += 16;
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
case 11:
|
|
|
|
case 12:
|
|
|
|
vs->curRect.left += 36;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
case 5:
|
|
|
|
case 8:
|
|
|
|
vs->curRect.left += 60;
|
|
|
|
break;
|
|
|
|
case 13:
|
|
|
|
case 32:
|
|
|
|
case 33:
|
|
|
|
case 34:
|
|
|
|
vs->curRect.left += 90;
|
|
|
|
break;
|
|
|
|
case 107:
|
|
|
|
vs->curRect.left -= 54;
|
|
|
|
vs->curRect.top += 16;
|
|
|
|
break;
|
|
|
|
case 108:
|
|
|
|
vs->curRect.left -= 54;
|
|
|
|
vs->curRect.top += 8;
|
|
|
|
break;
|
2019-12-23 11:56:16 +00:00
|
|
|
default:
|
|
|
|
break;
|
2003-09-08 03:06:37 +00:00
|
|
|
}
|
2008-01-28 00:14:17 +00:00
|
|
|
} else if (_game.id == GID_LOOM && _game.version == 4) {
|
2002-12-12 16:29:21 +00:00
|
|
|
// FIXME: hack loom notes into right spot
|
|
|
|
if ((verb >= 90) && (verb <= 97)) { // Notes
|
|
|
|
switch (verb) {
|
|
|
|
case 90:
|
|
|
|
case 91:
|
2004-01-15 19:25:17 +00:00
|
|
|
vs->curRect.top -= 7;
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
case 92:
|
2004-01-15 19:25:17 +00:00
|
|
|
vs->curRect.top -= 6;
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
case 93:
|
2004-01-15 19:25:17 +00:00
|
|
|
vs->curRect.top -= 4;
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
case 94:
|
2004-01-15 19:25:17 +00:00
|
|
|
vs->curRect.top -= 3;
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
case 95:
|
2004-01-15 19:25:17 +00:00
|
|
|
vs->curRect.top -= 1;
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
case 97:
|
2004-01-15 19:25:17 +00:00
|
|
|
vs->curRect.top -= 5;
|
2019-12-23 11:56:16 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 6: // SO_VERB_ON
|
2002-12-12 16:29:21 +00:00
|
|
|
vs->curmode = 1;
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 7: // SO_VERB_OFF
|
2002-12-12 16:29:21 +00:00
|
|
|
vs->curmode = 0;
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 8: // SO_VERB_DELETE
|
2002-12-12 16:29:21 +00:00
|
|
|
killVerb(slot);
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 9: // SO_VERB_NEW
|
2002-12-12 16:29:21 +00:00
|
|
|
slot = getVerbSlot(verb, 0);
|
2010-12-11 23:51:50 +00:00
|
|
|
|
|
|
|
if (_game.platform == Common::kPlatformFMTowns && _game.version == 3 && slot)
|
|
|
|
continue;
|
2011-06-19 22:59:48 +00:00
|
|
|
|
2002-12-12 16:29:21 +00:00
|
|
|
if (slot == 0) {
|
2003-12-26 23:11:35 +00:00
|
|
|
for (slot = 1; slot < _numVerbs; slot++) {
|
2002-12-12 16:29:21 +00:00
|
|
|
if (_verbs[slot].verbid == 0)
|
|
|
|
break;
|
|
|
|
}
|
2003-12-26 23:11:35 +00:00
|
|
|
if (slot == _numVerbs)
|
2002-12-12 16:29:21 +00:00
|
|
|
error("Too many verbs");
|
|
|
|
}
|
|
|
|
vs = &_verbs[slot];
|
|
|
|
vs->verbid = verb;
|
|
|
|
vs->color = 2;
|
2006-02-20 16:51:30 +00:00
|
|
|
vs->hicolor = (_game.version == 3) ? 14 : 0;
|
2002-12-12 16:29:21 +00:00
|
|
|
vs->dimcolor = 8;
|
|
|
|
vs->type = kTextVerbType;
|
2004-04-05 23:54:58 +00:00
|
|
|
vs->charset_nr = _string[0]._default.charset;
|
2002-12-12 16:29:21 +00:00
|
|
|
vs->curmode = 0;
|
|
|
|
vs->saveid = 0;
|
|
|
|
vs->key = 0;
|
|
|
|
vs->center = 0;
|
|
|
|
vs->imgindex = 0;
|
|
|
|
break;
|
|
|
|
|
2003-11-10 00:05:17 +00:00
|
|
|
case 16: // SO_VERB_DIMCOLOR
|
2003-11-16 18:34:33 +00:00
|
|
|
vs->dimcolor = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 17: // SO_VERB_DIM
|
2002-12-12 16:29:21 +00:00
|
|
|
vs->curmode = 2;
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 18: // SO_VERB_KEY
|
2003-11-16 18:34:33 +00:00
|
|
|
vs->key = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 19: // SO_VERB_CENTER
|
2002-12-12 16:29:21 +00:00
|
|
|
vs->center = 1;
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 20: // SO_VERB_NAME_STR
|
2003-11-16 18:34:33 +00:00
|
|
|
ptr = getResourceAddress(rtString, getVarOrDirectWord(PARAM_1));
|
2002-12-12 16:29:21 +00:00
|
|
|
if (!ptr)
|
2006-09-17 20:36:48 +00:00
|
|
|
_res->nukeResource(rtVerb, slot);
|
2002-12-12 16:29:21 +00:00
|
|
|
else {
|
|
|
|
loadPtrToResource(rtVerb, slot, ptr);
|
|
|
|
}
|
|
|
|
if (slot == 0)
|
2006-09-17 20:36:48 +00:00
|
|
|
_res->nukeResource(rtVerb, slot);
|
2002-12-12 16:29:21 +00:00
|
|
|
vs->type = kTextVerbType;
|
|
|
|
vs->imgindex = 0;
|
|
|
|
break;
|
|
|
|
case 22: /* assign object */
|
2003-11-16 18:34:33 +00:00
|
|
|
a = getVarOrDirectWord(PARAM_1);
|
|
|
|
b = getVarOrDirectByte(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
if (slot && vs->imgindex != a) {
|
|
|
|
setVerbObject(b, a, slot);
|
|
|
|
vs->type = kImageVerbType;
|
|
|
|
vs->imgindex = a;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 23: /* set back color */
|
2003-11-16 18:34:33 +00:00
|
|
|
vs->bkcolor = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-09-05 20:47:23 +00:00
|
|
|
default:
|
|
|
|
error("o5_verbOps: unknown subopcode %d", _opcode & 0x1F);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
2003-09-19 14:13:24 +00:00
|
|
|
|
|
|
|
// Force redraw of the modified verb slot
|
2002-12-12 16:29:21 +00:00
|
|
|
drawVerb(slot, 0);
|
|
|
|
verbMouseOver(0);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_wait() {
|
2003-05-21 16:28:02 +00:00
|
|
|
const byte *oldaddr = _scriptPointer - 1;
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if ((_game.id == GID_INDY3) && !(_game.platform == Common::kPlatformMacintosh)) {
|
2002-12-12 16:29:21 +00:00
|
|
|
_opcode = 2;
|
|
|
|
} else
|
|
|
|
_opcode = fetchScriptByte();
|
|
|
|
|
|
|
|
switch (_opcode & 0x1F) {
|
2003-11-10 00:05:17 +00:00
|
|
|
case 1: // SO_WAIT_FOR_ACTOR
|
|
|
|
{
|
2003-11-16 18:34:33 +00:00
|
|
|
Actor *a = derefActorSafe(getVarOrDirectByte(PARAM_1), "o5_wait");
|
2006-02-12 09:52:13 +00:00
|
|
|
if (a && a->_moving)
|
2002-12-27 00:23:45 +00:00
|
|
|
break;
|
|
|
|
return;
|
|
|
|
}
|
2003-11-10 00:05:17 +00:00
|
|
|
case 2: // SO_WAIT_FOR_MESSAGE
|
2003-05-08 15:48:50 +00:00
|
|
|
if (VAR(VAR_HAVE_MSG))
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
return;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 3: // SO_WAIT_FOR_CAMERA
|
2003-11-16 20:52:57 +00:00
|
|
|
if (camera._cur.x / 8 != camera._dest.x / 8)
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
|
|
|
return;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 4: // SO_WAIT_FOR_SENTENCE
|
2002-12-12 16:29:21 +00:00
|
|
|
if (_sentenceNum) {
|
2003-05-08 15:48:50 +00:00
|
|
|
if (_sentence[_sentenceNum - 1].freezeCount && !isScriptInUse(VAR(VAR_SENTENCE_SCRIPT)))
|
2002-12-12 16:29:21 +00:00
|
|
|
return;
|
2009-04-19 00:59:50 +00:00
|
|
|
} else if (!isScriptInUse(VAR(VAR_SENTENCE_SCRIPT)))
|
2002-12-12 16:29:21 +00:00
|
|
|
return;
|
|
|
|
break;
|
|
|
|
default:
|
2003-09-05 20:47:23 +00:00
|
|
|
error("o5_wait: unknown subopcode %d", _opcode & 0x1F);
|
2002-12-12 16:29:21 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_scriptPointer = oldaddr;
|
|
|
|
o5_breakHere();
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_walkActorTo() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int x, y;
|
|
|
|
Actor *a;
|
2003-05-23 13:24:41 +00:00
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
a = derefActor(getVarOrDirectByte(PARAM_1), "o5_walkActorTo");
|
|
|
|
x = getVarOrDirectWord(PARAM_2);
|
|
|
|
y = getVarOrDirectWord(PARAM_3);
|
2002-12-12 16:29:21 +00:00
|
|
|
a->startWalkActor(x, y, -1);
|
|
|
|
}
|
|
|
|
|
2012-01-08 22:51:13 +00:00
|
|
|
void ScummEngine_v5::walkActorToActor(int actor, int toActor, int dist) {
|
|
|
|
Actor *a = derefActor(actor, "walkActorToActor");
|
|
|
|
Actor *to = derefActor(toActor, "walkActorToActor(2)");
|
|
|
|
|
|
|
|
if (_game.version <= 2) {
|
|
|
|
dist *= V12_X_MULTIPLIER;
|
|
|
|
} else if (dist == 0xFF) {
|
|
|
|
dist = a->_scalex * a->_width / 0xFF;
|
|
|
|
dist += (to->_scalex * to->_width / 0xFF) / 2;
|
|
|
|
}
|
|
|
|
int x = to->getPos().x;
|
|
|
|
int y = to->getPos().y;
|
|
|
|
if (x < a->getPos().x)
|
|
|
|
x += dist;
|
|
|
|
else
|
|
|
|
x -= dist;
|
|
|
|
|
|
|
|
if (_game.version <= 2) {
|
|
|
|
x /= V12_X_MULTIPLIER;
|
|
|
|
y /= V12_Y_MULTIPLIER;
|
|
|
|
}
|
|
|
|
if (_game.version <= 3) {
|
|
|
|
AdjustBoxResult abr = a->adjustXYToBeInBox(x, y);
|
|
|
|
x = abr.x;
|
|
|
|
y = abr.y;
|
|
|
|
}
|
|
|
|
a->startWalkActor(x, y, -1);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_walkActorToActor() {
|
2002-12-12 16:29:21 +00:00
|
|
|
Actor *a, *a2;
|
2003-11-16 18:34:33 +00:00
|
|
|
int nr = getVarOrDirectByte(PARAM_1);
|
|
|
|
int nr2 = getVarOrDirectByte(PARAM_2);
|
2003-05-23 00:52:31 +00:00
|
|
|
int dist = fetchScriptByte();
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.id == GID_LOOM && _game.version == 4 && nr == 1 && nr2 == 0 &&
|
2003-05-26 14:43:02 +00:00
|
|
|
dist == 255 && vm.slot[_currentScript].number == 98) {
|
2003-07-31 18:46:31 +00:00
|
|
|
// WORKAROUND bug #743615: LoomCD script 98 contains this:
|
|
|
|
// walkActorToActor(1,0,255)
|
|
|
|
// Once again this is either a script bug, or there is some hidden
|
|
|
|
// or unknown meaning to this odd walk request...
|
2003-05-26 14:43:02 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.id == GID_INDY4 && nr == 1 && nr2 == 106 &&
|
2003-06-13 17:35:44 +00:00
|
|
|
dist == 255 && vm.slot[_currentScript].number == 210) {
|
2003-07-31 18:46:31 +00:00
|
|
|
// WORKAROUND bug: Work around an invalid actor bug when using the
|
|
|
|
// camel in Fate of Atlantis, the "wits" path. The room-65-210 script
|
|
|
|
// contains this:
|
|
|
|
// walkActorToActor(1,106,255)
|
|
|
|
// Once again this is either a script bug, or there is some hidden
|
|
|
|
// or unknown meaning to this odd walk request...
|
2003-06-13 17:35:44 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2003-05-23 13:24:41 +00:00
|
|
|
a = derefActor(nr, "o5_walkActorToActor");
|
2003-05-23 00:52:31 +00:00
|
|
|
if (!a->isInCurrentRoom())
|
2002-12-12 16:29:21 +00:00
|
|
|
return;
|
2003-05-23 00:52:31 +00:00
|
|
|
|
2003-05-23 13:24:41 +00:00
|
|
|
a2 = derefActor(nr2, "o5_walkActorToActor(2)");
|
2003-05-23 00:52:31 +00:00
|
|
|
if (!a2->isInCurrentRoom())
|
|
|
|
return;
|
|
|
|
|
2012-01-08 22:51:13 +00:00
|
|
|
walkActorToActor(nr, nr2, dist);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::o5_walkActorToObject() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int obj;
|
|
|
|
Actor *a;
|
|
|
|
|
2003-11-16 18:34:33 +00:00
|
|
|
a = derefActor(getVarOrDirectByte(PARAM_1), "o5_walkActorToObject");
|
|
|
|
obj = getVarOrDirectWord(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
if (whereIsObject(obj) != WIO_NOT_FOUND) {
|
|
|
|
int x, y, dir;
|
|
|
|
getObjectXYPos(obj, x, y, dir);
|
|
|
|
a->startWalkActor(x, y, dir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
int ScummEngine_v5::getWordVararg(int *ptr) {
|
2002-12-12 16:29:21 +00:00
|
|
|
int i;
|
|
|
|
|
2013-05-01 05:47:56 +00:00
|
|
|
for (i = 0; i < NUM_SCRIPT_LOCAL; i++)
|
2002-12-12 16:29:21 +00:00
|
|
|
ptr[i] = 0;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while ((_opcode = fetchScriptByte()) != 0xFF) {
|
2003-11-16 18:34:33 +00:00
|
|
|
ptr[i++] = getVarOrDirectWord(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v5::decodeParseString() {
|
2002-12-12 16:29:21 +00:00
|
|
|
int textSlot;
|
|
|
|
|
|
|
|
switch (_actorToPrintStrFor) {
|
|
|
|
case 252:
|
|
|
|
textSlot = 3;
|
|
|
|
break;
|
|
|
|
case 253:
|
|
|
|
textSlot = 2;
|
|
|
|
break;
|
|
|
|
case 254:
|
|
|
|
textSlot = 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
textSlot = 0;
|
|
|
|
}
|
|
|
|
|
2004-04-05 23:54:58 +00:00
|
|
|
_string[textSlot].loadDefault();
|
2002-12-12 16:29:21 +00:00
|
|
|
|
|
|
|
while ((_opcode = fetchScriptByte()) != 0xFF) {
|
|
|
|
switch (_opcode & 0xF) {
|
2003-11-10 00:05:17 +00:00
|
|
|
case 0: // SO_AT
|
2003-11-16 18:34:33 +00:00
|
|
|
_string[textSlot].xpos = getVarOrDirectWord(PARAM_1);
|
|
|
|
_string[textSlot].ypos = getVarOrDirectWord(PARAM_2);
|
2002-12-12 16:29:21 +00:00
|
|
|
_string[textSlot].overhead = false;
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 1: // SO_COLOR
|
2003-11-16 18:34:33 +00:00
|
|
|
_string[textSlot].color = getVarOrDirectByte(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 2: // SO_CLIPPED
|
2003-11-16 18:34:33 +00:00
|
|
|
_string[textSlot].right = getVarOrDirectWord(PARAM_1);
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 3: // SO_ERASE
|
2003-04-26 16:17:51 +00:00
|
|
|
{
|
2005-03-18 15:04:37 +00:00
|
|
|
int w = getVarOrDirectWord(PARAM_1);
|
|
|
|
int h = getVarOrDirectWord(PARAM_2);
|
|
|
|
// restoreCharsetBg(xpos, xpos + w, ypos, ypos + h)
|
|
|
|
error("ScummEngine_v5::decodeParseString: Unhandled case 3: %d, %d", w, h);
|
2003-04-26 16:17:51 +00:00
|
|
|
}
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 4: // SO_CENTER
|
2002-12-12 16:29:21 +00:00
|
|
|
_string[textSlot].center = true;
|
|
|
|
_string[textSlot].overhead = false;
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 6: // SO_LEFT
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.version == 3) {
|
2005-03-18 15:04:37 +00:00
|
|
|
_string[textSlot].height = getVarOrDirectWord(PARAM_1);
|
2003-04-26 16:17:51 +00:00
|
|
|
} else {
|
|
|
|
_string[textSlot].center = false;
|
|
|
|
_string[textSlot].overhead = false;
|
|
|
|
}
|
2002-12-12 16:29:21 +00:00
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 7: // SO_OVERHEAD
|
2002-12-12 16:29:21 +00:00
|
|
|
_string[textSlot].overhead = true;
|
|
|
|
break;
|
2003-11-10 00:05:17 +00:00
|
|
|
case 8:{ // SO_SAY_VOICE
|
2003-11-16 18:34:33 +00:00
|
|
|
int offset = (uint16)getVarOrDirectWord(PARAM_1);
|
|
|
|
int delay = (uint16)getVarOrDirectWord(PARAM_2);
|
2003-03-10 02:55:50 +00:00
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.id == GID_LOOM && _game.version == 4) {
|
2002-12-12 16:29:21 +00:00
|
|
|
if (offset == 0 && delay == 0) {
|
2003-09-10 22:35:35 +00:00
|
|
|
VAR(VAR_MUSIC_TIMER) = 0;
|
2002-12-12 16:29:21 +00:00
|
|
|
_sound->stopCD();
|
|
|
|
} else {
|
2003-03-10 02:55:50 +00:00
|
|
|
// Loom specified the offset from the start of the CD;
|
2003-06-30 23:18:20 +00:00
|
|
|
// thus we have to subtract the length of the first track
|
2003-03-10 02:55:50 +00:00
|
|
|
// (22500 frames) plus the 2 second = 150 frame leadin.
|
|
|
|
// I.e. in total 22650 frames.
|
2003-09-10 22:35:35 +00:00
|
|
|
offset = (int)(offset * 7.5 - 22500 - 2*75);
|
2003-03-10 02:55:50 +00:00
|
|
|
|
|
|
|
// Slightly increase the delay (5 frames = 1/25 of a second).
|
|
|
|
// This noticably improves the experience in Loom CD.
|
|
|
|
delay = (int)(delay * 7.5 + 5);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2002-12-12 16:29:21 +00:00
|
|
|
_sound->playCDTrack(1, 0, offset, delay);
|
|
|
|
}
|
|
|
|
} else {
|
2005-08-14 01:41:52 +00:00
|
|
|
error("ScummEngine_v5::decodeParseString: Unhandled case 8");
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2007-02-02 13:53:59 +00:00
|
|
|
case 15:{ // SO_TEXTSTRING
|
|
|
|
const int len = resStrLen(_scriptPointer);
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2007-02-02 13:53:59 +00:00
|
|
|
if (_game.id == GID_LOOM && strcmp((const char *) _scriptPointer, "I am Choas.") == 0) {
|
|
|
|
// WORKAROUND: This happens when Chaos introduces
|
|
|
|
// herself to bishop Mandible. Of all the places to put
|
|
|
|
// a typo...
|
|
|
|
printString(textSlot, (const byte *) "I am Chaos.");
|
|
|
|
} else if (_game.id == GID_INDY4 && _roomResource == 23 && vm.slot[_currentScript].number == 167 &&
|
|
|
|
len == 24 && 0==memcmp(_scriptPointer+16, "pregod", 6)) {
|
|
|
|
// WORKAROUND for bug #1621210.
|
|
|
|
byte tmpBuf[25];
|
|
|
|
memcpy(tmpBuf, _scriptPointer, 25);
|
|
|
|
if (tmpBuf[22] == '8')
|
|
|
|
strcpy((char *)tmpBuf+16, "^18^");
|
|
|
|
else
|
|
|
|
strcpy((char *)tmpBuf+16, "^19^");
|
|
|
|
printString(textSlot, tmpBuf);
|
2010-06-15 23:12:34 +00:00
|
|
|
} else if (_game.id == GID_MONKEY_EGA && _roomResource == 30 && vm.slot[_currentScript].number == 411 &&
|
|
|
|
strstr((const char *)_scriptPointer, "NCREDIT-NOTE-AMOUNT")) {
|
|
|
|
// WORKAROUND for bug #3003643 (MI1EGA German: Credit text incorrect)
|
|
|
|
// The script contains buggy text.
|
|
|
|
const char *tmp = strstr((const char *)_scriptPointer, "NCREDIT-NOTE-AMOUNT");
|
|
|
|
char tmpBuf[256];
|
|
|
|
const int diff = tmp - (const char *)_scriptPointer;
|
|
|
|
memcpy(tmpBuf, _scriptPointer, diff);
|
|
|
|
strcpy(tmpBuf + diff, "5000");
|
|
|
|
strcpy(tmpBuf + diff + 4, tmp + sizeof("NCREDIT-NOTE-AMOUNT") - 1);
|
|
|
|
printString(textSlot, (byte *)tmpBuf);
|
2007-02-02 13:53:59 +00:00
|
|
|
} else {
|
|
|
|
printString(textSlot, _scriptPointer);
|
|
|
|
}
|
|
|
|
_scriptPointer += len + 1;
|
|
|
|
}
|
2004-03-15 03:09:48 +00:00
|
|
|
|
2002-12-12 16:29:21 +00:00
|
|
|
|
2008-01-28 00:14:17 +00:00
|
|
|
// In SCUMM V1-V3, there were no 'default' values for the text slot
|
2011-05-25 14:31:37 +00:00
|
|
|
// values. Hence to achieve correct behavior, we have to keep the
|
2008-01-28 00:14:17 +00:00
|
|
|
// 'default' values in sync with the active values.
|
|
|
|
//
|
2004-04-05 23:56:28 +00:00
|
|
|
// Note: This is needed for Indy3 (Grail Diary). It's also needed
|
|
|
|
// for Loom, or the lines Bobbin speaks during the intro are put
|
|
|
|
// at position 0,0.
|
2004-05-02 14:39:48 +00:00
|
|
|
//
|
|
|
|
// Note: We can't use saveDefault() here because we only want to
|
|
|
|
// save the position and color. In particular, we do not want to
|
|
|
|
// save the 'center' flag. See bug #933168.
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.version <= 3) {
|
2004-05-02 14:39:48 +00:00
|
|
|
_string[textSlot]._default.xpos = _string[textSlot].xpos;
|
|
|
|
_string[textSlot]._default.ypos = _string[textSlot].ypos;
|
2005-03-18 15:04:37 +00:00
|
|
|
_string[textSlot]._default.height = _string[textSlot].height;
|
2004-05-02 14:39:48 +00:00
|
|
|
_string[textSlot]._default.color = _string[textSlot].color;
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
default:
|
2005-08-14 01:41:52 +00:00
|
|
|
error("ScummEngine_v5::decodeParseString: Unhandled case %d", _opcode & 0xF);
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-04-05 23:54:58 +00:00
|
|
|
_string[textSlot].saveDefault();
|
2002-12-12 16:29:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-03 18:33:57 +00:00
|
|
|
} // End of namespace Scumm
|