2002-06-29 16:11:13 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2006-05-05 00:42:37 +00:00
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2001-2006 The ScummVM project
|
2002-06-29 16:11:13 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-06-29 16:11:13 +00:00
|
|
|
*
|
2006-02-11 12:46:41 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2002-06-29 16:11:13 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Item script opcodes for Simon1/Simon2
|
2002-12-02 00:05:05 +00:00
|
|
|
|
2005-06-24 15:23:51 +00:00
|
|
|
#include "common/stdafx.h"
|
2006-04-17 04:02:48 +00:00
|
|
|
|
2006-04-29 14:23:16 +00:00
|
|
|
#include "common/system.h"
|
|
|
|
|
2006-09-29 08:14:27 +00:00
|
|
|
#include "agos/animation.h"
|
|
|
|
#include "agos/agos.h"
|
2005-01-10 22:06:49 +00:00
|
|
|
|
2005-03-26 14:09:21 +00:00
|
|
|
#ifdef _WIN32_WCE
|
|
|
|
extern bool isSmartphone(void);
|
|
|
|
#endif
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
namespace AGOS {
|
2003-10-03 19:42:27 +00:00
|
|
|
|
2006-04-06 17:56:41 +00:00
|
|
|
// Opcode table
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::setupOpcodes() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// This opcode table is for Simon 1. Changes for Simon 2 and FF are
|
|
|
|
// made below.
|
|
|
|
|
|
|
|
static OpcodeProc opcode_table[200] = {
|
|
|
|
// 0 - 4
|
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_at,
|
|
|
|
&AGOSEngine::o_notAt,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
// 5 - 9
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_carried,
|
|
|
|
&AGOSEngine::o_notCarried,
|
|
|
|
&AGOSEngine::o_isAt,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
// 10 - 14
|
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_zero,
|
|
|
|
&AGOSEngine::o_notZero,
|
|
|
|
&AGOSEngine::o_eq,
|
|
|
|
&AGOSEngine::o_notEq,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 15 - 19
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_gt,
|
|
|
|
&AGOSEngine::o_lt,
|
|
|
|
&AGOSEngine::o_eqf,
|
|
|
|
&AGOSEngine::o_notEqf,
|
|
|
|
&AGOSEngine::o_ltf,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 20 - 24
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_gtf,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_chance,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
|
|
|
// 25 - 29
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_isRoom,
|
|
|
|
&AGOSEngine::o_isObject,
|
|
|
|
&AGOSEngine::o_state,
|
|
|
|
&AGOSEngine::o_oflag,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
|
|
|
// 30 - 34
|
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_destroy,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_place,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
|
|
|
// 35 - 39
|
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_copyff,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
// 40 - 44
|
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_clear,
|
|
|
|
&AGOSEngine::o_let,
|
|
|
|
&AGOSEngine::o_add,
|
|
|
|
&AGOSEngine::o_sub,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 45 - 49
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_addf,
|
|
|
|
&AGOSEngine::o_subf,
|
|
|
|
&AGOSEngine::o_mul,
|
|
|
|
&AGOSEngine::o_div,
|
|
|
|
&AGOSEngine::o_mulf,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 50 - 54
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_divf,
|
|
|
|
&AGOSEngine::o_mod,
|
|
|
|
&AGOSEngine::o_modf,
|
|
|
|
&AGOSEngine::o_random,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
|
|
|
// 55 - 59
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_goto,
|
|
|
|
&AGOSEngine::o_oset,
|
|
|
|
&AGOSEngine::o_oclear,
|
|
|
|
&AGOSEngine::o_putBy,
|
|
|
|
&AGOSEngine::o_inc,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 60 - 64
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_dec,
|
|
|
|
&AGOSEngine::o_setState,
|
|
|
|
&AGOSEngine::o_print,
|
|
|
|
&AGOSEngine::o_message,
|
|
|
|
&AGOSEngine::o_msg,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 65 - 69
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_addTextBox,
|
|
|
|
&AGOSEngine::o_setShortText,
|
|
|
|
&AGOSEngine::o_setLongText,
|
|
|
|
&AGOSEngine::o_end,
|
|
|
|
&AGOSEngine::o_done,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 70 - 74
|
2006-04-10 10:07:56 +00:00
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_process,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
// 75 - 79
|
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_when,
|
|
|
|
&AGOSEngine::o_if1,
|
|
|
|
&AGOSEngine::o_if2,
|
|
|
|
&AGOSEngine::o_isCalled,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 80 - 84
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_is,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_debug,
|
2006-04-10 10:07:56 +00:00
|
|
|
NULL,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
|
|
|
// 85 - 89
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_comment,
|
|
|
|
&AGOSEngine::o_haltAnimation,
|
|
|
|
&AGOSEngine::o_restartAnimation,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 90 - 94
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_getParent,
|
|
|
|
&AGOSEngine::o_getNext,
|
|
|
|
&AGOSEngine::o_getChildren,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
// 95 - 99
|
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_picture,
|
|
|
|
&AGOSEngine::o_loadZone,
|
2006-04-10 10:07:56 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 100 - 104
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_killAnimate,
|
|
|
|
&AGOSEngine::o_defWindow,
|
|
|
|
&AGOSEngine::o_window,
|
|
|
|
&AGOSEngine::o_cls,
|
|
|
|
&AGOSEngine::o_closeWindow,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 105 - 109
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_addBox,
|
|
|
|
&AGOSEngine::o_delBox,
|
|
|
|
&AGOSEngine::o_enableBox,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 110 - 114
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_disableBox,
|
|
|
|
&AGOSEngine::o_moveBox,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_doIcons,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 115 - 119
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_isClass,
|
|
|
|
&AGOSEngine::o_setClass,
|
|
|
|
&AGOSEngine::o_unsetClass,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_waitSync,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 120 - 124
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_sync,
|
|
|
|
&AGOSEngine::o_defObj,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
// 125 - 129
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_here,
|
|
|
|
&AGOSEngine::o_doClassIcons,
|
2006-04-10 10:18:55 +00:00
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_waitEndTune,
|
|
|
|
&AGOSEngine::o_ifEndTune,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 130 - 134
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_setAdjNoun,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_saveUserGame,
|
|
|
|
&AGOSEngine::o_loadUserGame,
|
|
|
|
&AGOSEngine::o_stopTune,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 135 - 139
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_pauseGame,
|
|
|
|
&AGOSEngine::o_copysf,
|
|
|
|
&AGOSEngine::o_restoreIcons,
|
|
|
|
&AGOSEngine::o_freezeZones,
|
|
|
|
&AGOSEngine::o_placeNoIcons,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 140 - 144
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_clearTimers,
|
|
|
|
&AGOSEngine::o_setDollar,
|
|
|
|
&AGOSEngine::o_isBox,
|
|
|
|
&AGOSEngine::o_doTable,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
|
|
|
// 145 - 149
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
// 150 - 154
|
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_storeItem,
|
|
|
|
&AGOSEngine::o_getItem,
|
|
|
|
&AGOSEngine::o_bSet,
|
|
|
|
&AGOSEngine::o_bClear,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 155 - 159
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_bZero,
|
|
|
|
&AGOSEngine::o_bNotZero,
|
|
|
|
&AGOSEngine::o_getOValue,
|
|
|
|
&AGOSEngine::o_setOValue,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
|
|
|
// 160 - 164
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_ink,
|
|
|
|
&AGOSEngine::o_screenTextBox,
|
|
|
|
&AGOSEngine::o_screenTextMsg,
|
|
|
|
&AGOSEngine::o_playEffect,
|
|
|
|
&AGOSEngine::o_getDollar2,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 165 - 169
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_isAdjNoun,
|
|
|
|
&AGOSEngine::o_b2Set,
|
|
|
|
&AGOSEngine::o_b2Clear,
|
|
|
|
&AGOSEngine::o_b2Zero,
|
|
|
|
&AGOSEngine::o_b2NotZero,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 170 - 174
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
// 175 - 179
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_lockZones,
|
|
|
|
&AGOSEngine::o_unlockZones,
|
2006-04-17 22:47:12 +00:00
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_getPathPosn,
|
|
|
|
&AGOSEngine::o_scnTxtLongText,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 180 - 184
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_mouseOn,
|
2006-04-10 10:07:56 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_unloadZone,
|
2006-04-06 17:56:41 +00:00
|
|
|
// 185 - 189
|
2006-04-10 10:07:56 +00:00
|
|
|
NULL,
|
2006-09-29 09:44:30 +00:00
|
|
|
&AGOSEngine::o_unfreezeZones,
|
2006-04-10 10:07:56 +00:00
|
|
|
NULL,
|
2006-04-06 17:56:41 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
// 190 - 194
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
// 195 - 199
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
_opcode_table = opcode_table;
|
|
|
|
_numOpcodes = ARRAYSIZE(opcode_table);
|
|
|
|
|
|
|
|
switch (getGameType()) {
|
2006-09-28 23:22:07 +00:00
|
|
|
case GType_ELVIRA:
|
2006-09-29 22:22:43 +00:00
|
|
|
opcode_table[0] = &AGOSEngine::o_at;
|
|
|
|
opcode_table[1] = &AGOSEngine::o_notAt;
|
|
|
|
opcode_table[2] = NULL;
|
|
|
|
|
|
|
|
opcode_table[6] = &AGOSEngine::o_carried;
|
|
|
|
opcode_table[7] = &AGOSEngine::o_notCarried;
|
|
|
|
opcode_table[8] = &AGOSEngine::o_isAt;
|
|
|
|
|
|
|
|
opcode_table[12] = &AGOSEngine::o_zero;
|
|
|
|
opcode_table[13] = &AGOSEngine::o_notZero;
|
|
|
|
opcode_table[14] = &AGOSEngine::o_eq;
|
|
|
|
opcode_table[15] = &AGOSEngine::o_notEq;
|
|
|
|
opcode_table[16] = &AGOSEngine::o_gt;
|
|
|
|
opcode_table[17] = &AGOSEngine::o_lt;
|
|
|
|
opcode_table[18] = &AGOSEngine::o_eqf;
|
|
|
|
opcode_table[19] = &AGOSEngine::o_notEqf;
|
|
|
|
opcode_table[20] = &AGOSEngine::o_ltf;
|
|
|
|
opcode_table[21] = &AGOSEngine::o_gtf;
|
|
|
|
|
|
|
|
opcode_table[32] = &AGOSEngine::o_isRoom;
|
|
|
|
opcode_table[33] = &AGOSEngine::o_isObject;
|
|
|
|
|
|
|
|
opcode_table[34] = &AGOSEngine::o_state;
|
|
|
|
opcode_table[36] = &AGOSEngine::o_oflag;
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[48] = &AGOSEngine::o_destroy;
|
2006-09-29 22:22:43 +00:00
|
|
|
opcode_table[49] = NULL;
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[51] = &AGOSEngine::o_place;
|
2006-09-29 22:22:43 +00:00
|
|
|
|
|
|
|
opcode_table[56] = &AGOSEngine::o_copyff;
|
|
|
|
|
|
|
|
opcode_table[61] = &AGOSEngine::o_clear;
|
|
|
|
|
|
|
|
opcode_table[64] = &AGOSEngine::o_let;
|
|
|
|
opcode_table[65] = &AGOSEngine::o_add;
|
|
|
|
opcode_table[66] = &AGOSEngine::o_sub;
|
|
|
|
opcode_table[67] = &AGOSEngine::o_addf;
|
|
|
|
opcode_table[68] = &AGOSEngine::o_subf;
|
|
|
|
opcode_table[69] = &AGOSEngine::o_mul;
|
|
|
|
opcode_table[70] = &AGOSEngine::o_div;
|
|
|
|
opcode_table[71] = &AGOSEngine::o_mulf;
|
|
|
|
opcode_table[72] = &AGOSEngine::o_divf;
|
|
|
|
opcode_table[73] = &AGOSEngine::o_mod;
|
|
|
|
opcode_table[74] = &AGOSEngine::o_modf;
|
|
|
|
opcode_table[75] = &AGOSEngine::o_random;
|
|
|
|
|
|
|
|
opcode_table[77] = &AGOSEngine::o_goto;
|
|
|
|
|
|
|
|
opcode_table[80] = &AGOSEngine::o_oset;
|
|
|
|
opcode_table[81] = &AGOSEngine::o_oclear;
|
|
|
|
|
|
|
|
opcode_table[84] = &AGOSEngine::o_putBy;
|
|
|
|
opcode_table[85] = &AGOSEngine::o_inc;
|
|
|
|
opcode_table[86] = &AGOSEngine::o_dec;
|
|
|
|
opcode_table[87] = &AGOSEngine::o_setState;
|
|
|
|
opcode_table[88] = NULL;
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[91] = &AGOSEngine::o_message;
|
|
|
|
|
2006-09-29 22:22:43 +00:00
|
|
|
opcode_table[97] = &AGOSEngine::o_end;
|
|
|
|
opcode_table[98] = &AGOSEngine::o_done;
|
|
|
|
|
|
|
|
opcode_table[101] = NULL;
|
|
|
|
opcode_table[102] = NULL;
|
|
|
|
opcode_table[103] = NULL;
|
|
|
|
opcode_table[104] = NULL;
|
|
|
|
opcode_table[105] = &AGOSEngine::o_process;
|
|
|
|
|
|
|
|
opcode_table[108] = NULL;
|
|
|
|
opcode_table[109] = NULL;
|
|
|
|
opcode_table[110] = NULL;
|
|
|
|
opcode_table[111] = NULL;
|
|
|
|
|
|
|
|
opcode_table[116] = NULL;
|
|
|
|
opcode_table[117] = NULL;
|
|
|
|
opcode_table[118] = NULL;
|
|
|
|
opcode_table[119] = &AGOSEngine::o_when;
|
|
|
|
opcode_table[120] = NULL;
|
|
|
|
opcode_table[121] = NULL;
|
|
|
|
opcode_table[122] = NULL;
|
|
|
|
|
|
|
|
opcode_table[124] = NULL;
|
|
|
|
opcode_table[125] = NULL;
|
|
|
|
opcode_table[126] = NULL;
|
|
|
|
opcode_table[127] = NULL;
|
|
|
|
opcode_table[128] = &AGOSEngine::o_if1;
|
|
|
|
opcode_table[129] = &AGOSEngine::o_if2;
|
|
|
|
opcode_table[130] = NULL;
|
|
|
|
opcode_table[131] = NULL;
|
|
|
|
opcode_table[132] = NULL;
|
|
|
|
|
|
|
|
opcode_table[134] = NULL;
|
|
|
|
opcode_table[135] = &AGOSEngine::o_isCalled;
|
|
|
|
opcode_table[136] = &AGOSEngine::o_is;
|
|
|
|
|
|
|
|
opcode_table[138] = NULL;
|
|
|
|
opcode_table[139] = NULL;
|
|
|
|
|
|
|
|
opcode_table[141] = NULL;
|
|
|
|
opcode_table[142] = NULL;
|
|
|
|
opcode_table[143] = NULL;
|
|
|
|
opcode_table[144] = NULL;
|
|
|
|
opcode_table[145] = NULL;
|
|
|
|
opcode_table[146] = NULL;
|
|
|
|
opcode_table[147] = NULL;
|
|
|
|
opcode_table[148] = NULL;
|
|
|
|
opcode_table[149] = NULL;
|
|
|
|
opcode_table[150] = NULL;
|
|
|
|
opcode_table[151] = NULL;
|
|
|
|
opcode_table[152] = &AGOSEngine::o_debug;
|
|
|
|
opcode_table[153] = NULL;
|
|
|
|
opcode_table[154] = NULL;
|
|
|
|
opcode_table[155] = NULL;
|
|
|
|
opcode_table[156] = NULL;
|
|
|
|
opcode_table[157] = NULL;
|
|
|
|
opcode_table[158] = NULL;
|
|
|
|
opcode_table[159] = NULL;
|
2006-09-28 23:22:07 +00:00
|
|
|
|
|
|
|
opcode_table[166] = NULL;
|
|
|
|
opcode_table[167] = NULL;
|
|
|
|
opcode_table[168] = NULL;
|
|
|
|
opcode_table[169] = NULL;
|
2006-09-29 22:22:43 +00:00
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
opcode_table[171] = NULL;
|
|
|
|
opcode_table[172] = NULL;
|
|
|
|
opcode_table[173] = NULL;
|
|
|
|
opcode_table[174] = NULL;
|
2006-09-29 22:22:43 +00:00
|
|
|
|
|
|
|
opcode_table[179] = NULL;
|
|
|
|
|
|
|
|
opcode_table[182] = NULL;
|
|
|
|
opcode_table[183] = NULL;
|
2006-09-28 23:22:07 +00:00
|
|
|
opcode_table[184] = NULL;
|
|
|
|
opcode_table[185] = NULL;
|
|
|
|
opcode_table[186] = NULL;
|
|
|
|
opcode_table[187] = NULL;
|
|
|
|
opcode_table[188] = NULL;
|
|
|
|
opcode_table[189] = NULL;
|
|
|
|
opcode_table[190] = NULL;
|
2006-09-29 22:22:43 +00:00
|
|
|
opcode_table[191] = NULL;
|
|
|
|
opcode_table[192] = NULL;
|
|
|
|
opcode_table[193] = NULL;
|
|
|
|
|
|
|
|
opcode_table[195] = NULL;
|
|
|
|
opcode_table[196] = NULL;
|
|
|
|
opcode_table[197] = NULL;
|
|
|
|
opcode_table[198] = &AGOSEngine::o_comment;
|
|
|
|
opcode_table[199] = NULL;
|
|
|
|
opcode_table[200] = NULL;
|
|
|
|
|
|
|
|
opcode_table[203] = NULL;
|
|
|
|
|
|
|
|
opcode_table[205] = NULL;
|
|
|
|
opcode_table[206] = &AGOSEngine::o_getParent;
|
|
|
|
opcode_table[207] = &AGOSEngine::o_getNext;
|
|
|
|
opcode_table[208] = &AGOSEngine::o_getChildren;
|
|
|
|
|
|
|
|
opcode_table[210] = NULL;
|
|
|
|
opcode_table[211] = NULL;
|
|
|
|
opcode_table[212] = NULL;
|
|
|
|
opcode_table[213] = NULL;
|
|
|
|
opcode_table[214] = NULL;
|
|
|
|
opcode_table[215] = NULL;
|
|
|
|
opcode_table[216] = NULL;
|
|
|
|
opcode_table[217] = NULL;
|
|
|
|
opcode_table[218] = NULL;
|
|
|
|
|
|
|
|
opcode_table[221] = NULL;
|
|
|
|
opcode_table[222] = NULL;
|
|
|
|
opcode_table[223] = NULL;
|
|
|
|
opcode_table[224] = &AGOSEngine::o_picture;
|
|
|
|
opcode_table[225] = &AGOSEngine::o_loadZone;
|
|
|
|
opcode_table[226] = &AGOSEngine::o1_animate;
|
|
|
|
opcode_table[227] = &AGOSEngine::o1_stopAnimate;
|
|
|
|
opcode_table[228] = &AGOSEngine::o_killAnimate;
|
|
|
|
opcode_table[229] = &AGOSEngine::o_defWindow;
|
|
|
|
opcode_table[230] = &AGOSEngine::o_window;
|
|
|
|
opcode_table[231] = &AGOSEngine::o_cls;
|
|
|
|
opcode_table[232] = &AGOSEngine::o_closeWindow;
|
|
|
|
|
|
|
|
opcode_table[235] = &AGOSEngine::o_addBox;
|
|
|
|
opcode_table[236] = &AGOSEngine::o_delBox;
|
|
|
|
opcode_table[237] = &AGOSEngine::o_enableBox;
|
|
|
|
opcode_table[238] = &AGOSEngine::o_disableBox;
|
|
|
|
opcode_table[239] = &AGOSEngine::o_moveBox;
|
|
|
|
|
|
|
|
opcode_table[242] = &AGOSEngine::o_doIcons;
|
|
|
|
opcode_table[243] = &AGOSEngine::o_isClass;
|
|
|
|
opcode_table[244] = NULL;
|
|
|
|
opcode_table[245] = NULL;
|
|
|
|
opcode_table[246] = NULL;
|
|
|
|
opcode_table[247] = NULL;
|
|
|
|
opcode_table[248] = NULL;
|
|
|
|
opcode_table[249] = &AGOSEngine::o_setClass;
|
|
|
|
opcode_table[250] = &AGOSEngine::o_unsetClass;
|
|
|
|
|
|
|
|
opcode_table[255] = &AGOSEngine::o_waitSync;
|
|
|
|
opcode_table[256] = &AGOSEngine::o_sync;
|
|
|
|
opcode_table[257] = &AGOSEngine::o_defObj;
|
|
|
|
|
|
|
|
opcode_table[261] = &AGOSEngine::o_here;
|
|
|
|
opcode_table[262] = &AGOSEngine::o_doClassIcons;
|
|
|
|
opcode_table[264] = &AGOSEngine::o_waitEndTune;
|
|
|
|
opcode_table[263] = &AGOSEngine::o1_playTune;
|
|
|
|
|
|
|
|
opcode_table[265] = &AGOSEngine::o_ifEndTune;
|
|
|
|
opcode_table[266] = &AGOSEngine::o_setAdjNoun;
|
|
|
|
opcode_table[268] = &AGOSEngine::o_saveUserGame;
|
|
|
|
opcode_table[269] = &AGOSEngine::o_loadUserGame;
|
|
|
|
opcode_table[271] = &AGOSEngine::o_stopTune;
|
|
|
|
|
|
|
|
opcode_table[274] = &AGOSEngine::o_pauseGame;
|
|
|
|
opcode_table[275] = &AGOSEngine::o_copysf;
|
|
|
|
opcode_table[276] = &AGOSEngine::o_restoreIcons;
|
|
|
|
|
|
|
|
opcode_table[279] = &AGOSEngine::o_freezeZones;
|
|
|
|
opcode_table[280] = &AGOSEngine::o_placeNoIcons;
|
|
|
|
opcode_table[281] = &AGOSEngine::o_clearTimers;
|
|
|
|
|
|
|
|
opcode_table[283] = &AGOSEngine::o_isBox;
|
2006-09-28 23:22:07 +00:00
|
|
|
break;
|
2006-09-19 11:59:13 +00:00
|
|
|
case GType_WW:
|
|
|
|
// Confirmed
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[70] = &AGOSEngine::o1_printLongText;
|
|
|
|
opcode_table[83] = &AGOSEngine::o1_rescan;
|
|
|
|
opcode_table[98] = &AGOSEngine::o1_animate;
|
|
|
|
opcode_table[99] = &AGOSEngine::o1_stopAnimate;
|
|
|
|
opcode_table[85] = &AGOSEngine::oww_whereTo;
|
|
|
|
opcode_table[105] = &AGOSEngine::oww_menu;
|
|
|
|
opcode_table[106] = &AGOSEngine::oww_textMenu;
|
|
|
|
opcode_table[127] = &AGOSEngine::o1_playTune;
|
|
|
|
opcode_table[148] = &AGOSEngine::oww_ifDoorOpen;
|
|
|
|
opcode_table[179] = &AGOSEngine::o_isAdjNoun;
|
|
|
|
opcode_table[180] = &AGOSEngine::o_b2Set;
|
|
|
|
opcode_table[181] = &AGOSEngine::o_b2Clear;
|
|
|
|
opcode_table[182] = &AGOSEngine::o_b2Zero;
|
|
|
|
opcode_table[183] = &AGOSEngine::o_b2NotZero;
|
2006-09-19 11:59:13 +00:00
|
|
|
|
|
|
|
// Code difference, check if triggered
|
|
|
|
opcode_table[161] = NULL;
|
|
|
|
opcode_table[162] = NULL;
|
|
|
|
opcode_table[163] = NULL;
|
|
|
|
opcode_table[164] = NULL;
|
|
|
|
opcode_table[165] = NULL;
|
|
|
|
opcode_table[166] = NULL;
|
|
|
|
opcode_table[167] = NULL;
|
|
|
|
opcode_table[168] = NULL;
|
|
|
|
opcode_table[169] = NULL;
|
|
|
|
opcode_table[170] = NULL;
|
|
|
|
opcode_table[171] = NULL;
|
|
|
|
opcode_table[172] = NULL;
|
|
|
|
opcode_table[173] = NULL;
|
|
|
|
opcode_table[174] = NULL;
|
|
|
|
opcode_table[175] = NULL;
|
|
|
|
opcode_table[176] = NULL;
|
|
|
|
opcode_table[177] = NULL;
|
|
|
|
opcode_table[178] = NULL;
|
|
|
|
opcode_table[184] = NULL;
|
|
|
|
opcode_table[185] = NULL;
|
|
|
|
opcode_table[186] = NULL;
|
|
|
|
opcode_table[187] = NULL;
|
|
|
|
opcode_table[188] = NULL;
|
|
|
|
opcode_table[189] = NULL;
|
|
|
|
opcode_table[190] = NULL;
|
|
|
|
break;
|
2006-04-06 17:56:41 +00:00
|
|
|
case GType_SIMON1:
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[70] = &AGOSEngine::o1_printLongText;
|
|
|
|
opcode_table[83] = &AGOSEngine::o1_rescan;
|
|
|
|
opcode_table[98] = &AGOSEngine::o1_animate;
|
|
|
|
opcode_table[99] = &AGOSEngine::o1_stopAnimate;
|
|
|
|
opcode_table[127] = &AGOSEngine::o1_playTune;
|
|
|
|
opcode_table[177] = &AGOSEngine::o1_screenTextPObj;
|
|
|
|
opcode_table[181] = &AGOSEngine::o1_mouseOff;
|
|
|
|
opcode_table[182] = &AGOSEngine::o1_loadBeard;
|
|
|
|
opcode_table[183] = &AGOSEngine::o1_unloadBeard;
|
|
|
|
opcode_table[185] = &AGOSEngine::o1_loadStrings;
|
|
|
|
opcode_table[187] = &AGOSEngine::o1_specialFade;
|
2006-04-06 17:56:41 +00:00
|
|
|
break;
|
|
|
|
case GType_SIMON2:
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[70] = &AGOSEngine::o2_printLongText;
|
|
|
|
opcode_table[83] = &AGOSEngine::o2_rescan;
|
|
|
|
opcode_table[98] = &AGOSEngine::o2_animate;
|
|
|
|
opcode_table[99] = &AGOSEngine::o2_stopAnimate;
|
|
|
|
opcode_table[127] = &AGOSEngine::o2_playTune;
|
|
|
|
opcode_table[177] = &AGOSEngine::o2_screenTextPObj;
|
|
|
|
opcode_table[181] = &AGOSEngine::o2_mouseOff;
|
|
|
|
opcode_table[188] = &AGOSEngine::o2_isShortText;
|
|
|
|
opcode_table[189] = &AGOSEngine::o2_clearMarks;
|
|
|
|
opcode_table[190] = &AGOSEngine::o2_waitMark;
|
2006-04-06 17:56:41 +00:00
|
|
|
break;
|
|
|
|
case GType_FF:
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[23] = &AGOSEngine::o3_chance;
|
|
|
|
opcode_table[37] = &AGOSEngine::o3_jumpOut;
|
|
|
|
opcode_table[65] = &AGOSEngine::o3_addTextBox;
|
|
|
|
opcode_table[70] = &AGOSEngine::o3_printLongText;
|
|
|
|
opcode_table[83] = &AGOSEngine::o2_rescan;
|
|
|
|
opcode_table[98] = &AGOSEngine::o2_animate;
|
|
|
|
opcode_table[99] = &AGOSEngine::o2_stopAnimate;
|
|
|
|
opcode_table[107] = &AGOSEngine::o3_addBox;
|
|
|
|
opcode_table[122] = &AGOSEngine::o3_oracleTextDown;
|
|
|
|
opcode_table[123] = &AGOSEngine::o3_oracleTextUp;
|
|
|
|
opcode_table[124] = &AGOSEngine::o3_ifTime;
|
|
|
|
opcode_table[127] = &AGOSEngine::o3_playTune;
|
|
|
|
opcode_table[131] = &AGOSEngine::o3_setTime;
|
2006-09-29 22:22:43 +00:00
|
|
|
opcode_table[132] = &AGOSEngine::o3_saveUserGame;
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[133] = &AGOSEngine::o3_loadUserGame;
|
|
|
|
opcode_table[134] = &AGOSEngine::o3_listSaveGames;
|
|
|
|
opcode_table[135] = &AGOSEngine::o3_checkCD;
|
|
|
|
opcode_table[161] = &AGOSEngine::o3_screenTextBox;
|
|
|
|
opcode_table[165] = &AGOSEngine::o3_isAdjNoun;
|
|
|
|
opcode_table[171] = &AGOSEngine::o3_hyperLinkOn;
|
|
|
|
opcode_table[172] = &AGOSEngine::o3_hyperLinkOff;
|
|
|
|
opcode_table[173] = &AGOSEngine::o3_checkPaths;
|
|
|
|
opcode_table[177] = &AGOSEngine::o3_screenTextPObj;
|
|
|
|
opcode_table[181] = &AGOSEngine::o3_mouseOff;
|
|
|
|
opcode_table[182] = &AGOSEngine::o3_loadVideo;
|
|
|
|
opcode_table[183] = &AGOSEngine::o3_playVideo;
|
|
|
|
opcode_table[187] = &AGOSEngine::o3_centreScroll;
|
|
|
|
opcode_table[188] = &AGOSEngine::o2_isShortText;
|
|
|
|
opcode_table[189] = &AGOSEngine::o2_clearMarks;
|
|
|
|
opcode_table[190] = &AGOSEngine::o2_waitMark;
|
|
|
|
opcode_table[191] = &AGOSEngine::o3_resetPVCount;
|
|
|
|
opcode_table[192] = &AGOSEngine::o3_setPathValues;
|
|
|
|
opcode_table[193] = &AGOSEngine::o3_stopClock;
|
|
|
|
opcode_table[194] = &AGOSEngine::o3_restartClock;
|
|
|
|
opcode_table[195] = &AGOSEngine::o3_setColour;
|
|
|
|
opcode_table[196] = &AGOSEngine::o3_b3Set;
|
|
|
|
opcode_table[197] = &AGOSEngine::o3_b3Clear;
|
|
|
|
opcode_table[198] = &AGOSEngine::o3_b3Zero;
|
|
|
|
opcode_table[199] = &AGOSEngine::o3_b3NotZero;
|
2006-04-06 17:56:41 +00:00
|
|
|
break;
|
2006-09-28 23:22:07 +00:00
|
|
|
case GType_PP:
|
2006-09-29 11:07:38 +00:00
|
|
|
opcode_table[23] = &AGOSEngine::o3_chance;
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[30] = &AGOSEngine::o4_opcode30;
|
2006-09-29 11:07:38 +00:00
|
|
|
opcode_table[32] = &AGOSEngine::o4_restoreOopsPosition;
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[37] = &AGOSEngine::o4_checkTiles;
|
2006-09-29 11:07:38 +00:00
|
|
|
opcode_table[38] = &AGOSEngine::o4_loadMouseImage;
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[65] = &AGOSEngine::o3_addTextBox;
|
2006-09-29 22:22:43 +00:00
|
|
|
opcode_table[66] = &AGOSEngine::o4_setShortText;
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[70] = &AGOSEngine::o3_printLongText;
|
|
|
|
opcode_table[83] = &AGOSEngine::o2_rescan;
|
2006-09-29 11:07:38 +00:00
|
|
|
opcode_table[98] = &AGOSEngine::o4_animate;
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[99] = &AGOSEngine::o2_stopAnimate;
|
2006-09-29 11:07:38 +00:00
|
|
|
opcode_table[105] = &AGOSEngine::o4_loadHiScores;
|
|
|
|
opcode_table[106] = &AGOSEngine::o4_checkHiScores;
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[107] = &AGOSEngine::o3_addBox;
|
|
|
|
opcode_table[122] = &AGOSEngine::o3_oracleTextDown;
|
|
|
|
opcode_table[123] = &AGOSEngine::o3_oracleTextUp;
|
|
|
|
opcode_table[124] = &AGOSEngine::o3_ifTime;
|
|
|
|
opcode_table[127] = &AGOSEngine::o3_playTune;
|
|
|
|
opcode_table[131] = &AGOSEngine::o3_setTime;
|
2006-09-29 22:22:43 +00:00
|
|
|
opcode_table[132] = &AGOSEngine::o3_saveUserGame;
|
2006-09-29 11:07:38 +00:00
|
|
|
opcode_table[133] = &AGOSEngine::o4_loadUserGame;
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[134] = &AGOSEngine::o3_listSaveGames;
|
|
|
|
opcode_table[161] = &AGOSEngine::o3_screenTextBox;
|
|
|
|
opcode_table[165] = &AGOSEngine::o3_isAdjNoun;
|
2006-09-29 11:07:38 +00:00
|
|
|
opcode_table[166] = NULL;
|
|
|
|
opcode_table[167] = NULL;
|
|
|
|
opcode_table[168] = NULL;
|
|
|
|
opcode_table[169] = NULL;
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[171] = &AGOSEngine::o3_hyperLinkOn;
|
|
|
|
opcode_table[172] = &AGOSEngine::o3_hyperLinkOff;
|
2006-09-29 11:07:38 +00:00
|
|
|
opcode_table[173] = &AGOSEngine::o4_saveOopsPosition;
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[177] = &AGOSEngine::o3_screenTextPObj;
|
|
|
|
opcode_table[181] = &AGOSEngine::o3_mouseOff;
|
2006-09-29 11:07:38 +00:00
|
|
|
opcode_table[187] = &AGOSEngine::o4_resetGameTime;
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[188] = &AGOSEngine::o2_isShortText;
|
|
|
|
opcode_table[189] = &AGOSEngine::o2_clearMarks;
|
2006-09-29 11:07:38 +00:00
|
|
|
opcode_table[190] = &AGOSEngine::o2_waitMark;
|
|
|
|
opcode_table[191] = &AGOSEngine::o4_resetPVCount;
|
|
|
|
opcode_table[192] = &AGOSEngine::o4_setPathValues;
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[193] = &AGOSEngine::o3_stopClock;
|
2006-09-29 11:07:38 +00:00
|
|
|
opcode_table[194] = &AGOSEngine::o4_restartClock;
|
2006-09-29 09:44:30 +00:00
|
|
|
opcode_table[195] = &AGOSEngine::o3_setColour;
|
2006-09-28 23:22:07 +00:00
|
|
|
break;
|
2006-04-06 17:56:41 +00:00
|
|
|
default:
|
|
|
|
error("setupOpcodes: Unknown game");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::setScriptCondition(bool cond) {
|
2006-04-07 09:37:44 +00:00
|
|
|
_runScriptCondition[_recursionDepth] = cond;
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
bool AGOSEngine::getScriptCondition() {
|
2006-04-07 09:37:44 +00:00
|
|
|
return _runScriptCondition[_recursionDepth];
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::setScriptReturn(int ret) {
|
2006-04-07 09:37:44 +00:00
|
|
|
_runScriptReturn[_recursionDepth] = ret;
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
int AGOSEngine::getScriptReturn() {
|
2006-04-07 09:37:44 +00:00
|
|
|
return _runScriptReturn[_recursionDepth];
|
|
|
|
}
|
|
|
|
|
2006-04-06 17:56:41 +00:00
|
|
|
// -----------------------------------------------------------------------
|
2006-09-19 11:59:13 +00:00
|
|
|
// Common Opcodes
|
2006-04-06 17:56:41 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_at() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 1: ptrA parent is
|
2006-04-19 11:54:38 +00:00
|
|
|
setScriptCondition(me()->parent == getNextItemID());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_notAt() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 2: ptrA parent is not
|
2006-04-19 11:54:38 +00:00
|
|
|
setScriptCondition(me()->parent != getNextItemID());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_carried() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 5: parent is 1
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(getNextItemPtr()->parent == getItem1ID());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_notCarried() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 6: parent isnot 1
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(getNextItemPtr()->parent != getItem1ID());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_isAt() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 7: parent is
|
|
|
|
Item *item = getNextItemPtr();
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(item->parent == getNextItemID());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_zero() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 11: is zero
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(getNextVarContents() == 0);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_notZero() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 12: isnot zero
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(getNextVarContents() != 0);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_eq() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 13: equal
|
|
|
|
uint tmp = getNextVarContents();
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(tmp == getVarOrWord());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_notEq() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 14: not equal
|
|
|
|
uint tmp = getNextVarContents();
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(tmp != getVarOrWord());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_gt() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 15: is greater
|
|
|
|
uint tmp = getNextVarContents();
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(tmp > getVarOrWord());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_lt() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 16: is less
|
|
|
|
uint tmp = getNextVarContents();
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(tmp < getVarOrWord());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_eqf() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 17: is eq f
|
|
|
|
uint tmp = getNextVarContents();
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(tmp == getNextVarContents());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_notEqf() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 18: is not equal f
|
|
|
|
uint tmp = getNextVarContents();
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(tmp != getNextVarContents());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_ltf() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 19: is greater f
|
|
|
|
uint tmp = getNextVarContents();
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(tmp < getNextVarContents());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_gtf() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 20: is less f
|
|
|
|
uint tmp = getNextVarContents();
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(tmp > getNextVarContents());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_chance() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 23
|
2006-04-10 06:40:15 +00:00
|
|
|
uint a = getVarOrWord();
|
|
|
|
|
|
|
|
if (a == 0) {
|
|
|
|
setScriptCondition(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (a == 100) {
|
|
|
|
setScriptCondition(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-04-21 07:42:40 +00:00
|
|
|
a += _chanceModifier;
|
2006-04-10 06:40:15 +00:00
|
|
|
|
|
|
|
if (a <= 0) {
|
2006-04-21 07:42:40 +00:00
|
|
|
_chanceModifier = 0;
|
2006-04-10 06:40:15 +00:00
|
|
|
setScriptCondition(false);
|
|
|
|
} else if ((uint)_rnd.getRandomNumber(99) < a) {
|
2006-04-21 07:42:40 +00:00
|
|
|
if (_chanceModifier <= 0)
|
|
|
|
_chanceModifier -= 5;
|
2006-04-10 06:40:15 +00:00
|
|
|
else
|
2006-04-21 07:42:40 +00:00
|
|
|
_chanceModifier = 0;
|
2006-04-10 06:40:15 +00:00
|
|
|
setScriptCondition(true);
|
|
|
|
} else {
|
2006-04-21 07:42:40 +00:00
|
|
|
if (_chanceModifier >= 0)
|
|
|
|
_chanceModifier += 5;
|
2006-04-10 06:40:15 +00:00
|
|
|
else
|
2006-04-21 07:42:40 +00:00
|
|
|
_chanceModifier = 0;
|
2006-04-10 06:40:15 +00:00
|
|
|
setScriptCondition(false);
|
|
|
|
}
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_isRoom() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 25: is room
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(isRoom(getNextItemPtr()));
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_isObject() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 26: is object
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(isObject(getNextItemPtr()));
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_state() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 27: item state is
|
|
|
|
Item *item = getNextItemPtr();
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition((uint) item->state == getVarOrWord());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_oflag() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 28: item has prop
|
|
|
|
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
|
|
|
|
byte num = getVarOrByte();
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(subObject != NULL && (subObject->objectFlags & (1 << num)) != 0);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_destroy() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 31: set no parent
|
|
|
|
setItemParent(getNextItemPtr(), NULL);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_place() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 33: set item parent
|
|
|
|
Item *item = getNextItemPtr();
|
|
|
|
setItemParent(item, getNextItemPtr());
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_copyff() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 36: copy var
|
|
|
|
uint value = getNextVarContents();
|
|
|
|
writeNextVarContents(value);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_clear() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 41: zero var
|
|
|
|
writeNextVarContents(0);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_let() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 42: set var
|
2006-09-28 23:22:07 +00:00
|
|
|
uint var = getVarWrapper();
|
2006-04-06 17:56:41 +00:00
|
|
|
writeVariable(var, getVarOrWord());
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_add() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 43: add
|
2006-09-29 00:50:22 +00:00
|
|
|
uint var = getVarWrapper();
|
2006-04-06 17:56:41 +00:00
|
|
|
writeVariable(var, readVariable(var) + getVarOrWord());
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_sub() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 44: sub
|
2006-09-28 23:22:07 +00:00
|
|
|
uint var = getVarWrapper();
|
2006-04-06 17:56:41 +00:00
|
|
|
writeVariable(var, readVariable(var) - getVarOrWord());
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_addf() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 45: add f
|
2006-09-28 23:22:07 +00:00
|
|
|
uint var = getVarWrapper();
|
2006-04-06 17:56:41 +00:00
|
|
|
writeVariable(var, readVariable(var) + getNextVarContents());
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_subf() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 46: sub f
|
2006-09-28 23:22:07 +00:00
|
|
|
uint var = getVarWrapper();
|
2006-04-06 17:56:41 +00:00
|
|
|
writeVariable(var, readVariable(var) - getNextVarContents());
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_mul() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 47: mul
|
2006-09-28 23:22:07 +00:00
|
|
|
uint var = getVarWrapper();
|
2006-04-06 17:56:41 +00:00
|
|
|
writeVariable(var, readVariable(var) * getVarOrWord());
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_div() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 48: div
|
2006-09-28 23:22:07 +00:00
|
|
|
uint var = getVarWrapper();
|
2006-04-06 17:56:41 +00:00
|
|
|
int value = getVarOrWord();
|
|
|
|
if (value == 0)
|
2006-04-10 09:49:03 +00:00
|
|
|
error("o_div: Division by zero");
|
2006-04-06 17:56:41 +00:00
|
|
|
writeVariable(var, readVariable(var) / value);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_mulf() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 49: mul f
|
2006-09-28 23:22:07 +00:00
|
|
|
uint var = getVarWrapper();
|
2006-04-06 17:56:41 +00:00
|
|
|
writeVariable(var, readVariable(var) * getNextVarContents());
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_divf() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 50: div f
|
2006-09-28 23:22:07 +00:00
|
|
|
uint var = getVarWrapper();
|
2006-04-06 17:56:41 +00:00
|
|
|
int value = getNextVarContents();
|
|
|
|
if (value == 0)
|
2006-04-10 09:49:03 +00:00
|
|
|
error("o_divf: Division by zero");
|
2006-04-06 17:56:41 +00:00
|
|
|
writeVariable(var, readVariable(var) / value);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_mod() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 51: mod
|
2006-09-28 23:22:07 +00:00
|
|
|
uint var = getVarWrapper();
|
2006-04-06 17:56:41 +00:00
|
|
|
int value = getVarOrWord();
|
|
|
|
if (value == 0)
|
2006-04-10 09:49:03 +00:00
|
|
|
error("o_mod: Division by zero");
|
2006-04-06 17:56:41 +00:00
|
|
|
writeVariable(var, readVariable(var) % value);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_modf() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 52: mod f
|
2006-09-28 23:22:07 +00:00
|
|
|
uint var = getVarWrapper();
|
2006-04-06 17:56:41 +00:00
|
|
|
int value = getNextVarContents();
|
|
|
|
if (value == 0)
|
2006-04-10 09:49:03 +00:00
|
|
|
error("o_modf: Division by zero");
|
2006-04-06 17:56:41 +00:00
|
|
|
writeVariable(var, readVariable(var) % value);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_random() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 53: random
|
2006-09-28 23:22:07 +00:00
|
|
|
uint var = getVarWrapper();
|
2006-04-06 17:56:41 +00:00
|
|
|
uint value = (uint16)getVarOrWord();
|
2006-09-29 00:50:22 +00:00
|
|
|
writeVariable(var, _rnd.getRandomNumber(value - 1));
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_goto() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 55: set itemA parent
|
2006-09-20 06:39:27 +00:00
|
|
|
uint item = getNextItemID();
|
|
|
|
if (_itemArrayPtr[item] == NULL) {
|
|
|
|
setItemParent(me(), NULL);
|
|
|
|
loadRoomItems(item);
|
|
|
|
}
|
|
|
|
setItemParent(me(), _itemArrayPtr[item]);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_oset() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 56: set child2 fr bit
|
|
|
|
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
|
|
|
|
int value = getVarOrByte();
|
|
|
|
if (subObject != NULL && value >= 0x10)
|
2006-04-07 14:40:33 +00:00
|
|
|
subObject->objectFlags |= (1 << value);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_oclear() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 57: clear child2 fr bit
|
|
|
|
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
|
|
|
|
int value = getVarOrByte();
|
|
|
|
if (subObject != NULL && value >= 0x10)
|
|
|
|
subObject->objectFlags &= ~(1 << value);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_putBy() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 58: make siblings
|
|
|
|
Item *item = getNextItemPtr();
|
|
|
|
setItemParent(item, derefItem(getNextItemPtr()->parent));
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_inc() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 59: item inc state
|
|
|
|
Item *item = getNextItemPtr();
|
|
|
|
if (item->state <= 30000)
|
|
|
|
setItemState(item, item->state + 1);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_dec() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 60: item dec state
|
|
|
|
Item *item = getNextItemPtr();
|
|
|
|
if (item->state >= 0)
|
|
|
|
setItemState(item, item->state - 1);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_setState() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 61: item set state
|
|
|
|
Item *item = getNextItemPtr();
|
|
|
|
int value = getVarOrWord();
|
|
|
|
if (value < 0)
|
|
|
|
value = 0;
|
|
|
|
if (value > 30000)
|
|
|
|
value = 30000;
|
|
|
|
setItemState(item, value);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_print() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 62: show int
|
|
|
|
showMessageFormat("%d", getNextVarContents());
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_message() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 63: show string nl
|
|
|
|
showMessageFormat("%s\n", getStringPtrByID(getNextStringID()));
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_msg() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 64: show string
|
|
|
|
showMessageFormat("%s", getStringPtrByID(getNextStringID()));
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_addTextBox() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 65: add hit area
|
2006-04-15 06:47:26 +00:00
|
|
|
uint id = getVarOrWord();
|
|
|
|
uint x = getVarOrWord();
|
|
|
|
uint y = getVarOrWord();
|
|
|
|
uint w = getVarOrWord();
|
|
|
|
uint h = getVarOrWord();
|
|
|
|
uint number = getVarOrByte();
|
2006-04-15 06:42:40 +00:00
|
|
|
if (number < _numTextBoxes)
|
2006-04-08 12:06:52 +00:00
|
|
|
defineBox(id, x, y, w, h, (number << 8) + 129, 208, _dummyItem2);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_setShortText() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 66: set item name
|
|
|
|
uint var = getVarOrByte();
|
|
|
|
uint stringId = getNextStringID();
|
2006-09-28 23:22:07 +00:00
|
|
|
if (var < _numTextBoxes) {
|
2006-09-29 00:50:22 +00:00
|
|
|
_shortText[var] = stringId;
|
2006-09-28 23:22:07 +00:00
|
|
|
}
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_setLongText() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 67: set item description
|
|
|
|
uint var = getVarOrByte();
|
|
|
|
uint stringId = getNextStringID();
|
|
|
|
if (getFeatures() & GF_TALKIE) {
|
|
|
|
uint speechId = getNextWord();
|
2006-04-15 06:42:40 +00:00
|
|
|
if (var < _numTextBoxes) {
|
2006-09-29 00:50:22 +00:00
|
|
|
_longText[var] = stringId;
|
|
|
|
_longSound[var] = speechId;
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
} else {
|
2006-04-15 06:42:40 +00:00
|
|
|
if (var < _numTextBoxes) {
|
2006-09-29 00:50:22 +00:00
|
|
|
_longText[var] = stringId;
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_end() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 68: exit interpreter
|
|
|
|
shutdown();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_done() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 69: return 1
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptReturn(1);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_process() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 71: start subroutine
|
|
|
|
Subroutine *sub = getSubroutineByID(getVarOrWord());
|
|
|
|
if (sub != NULL)
|
|
|
|
startSubroutine(sub);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_when() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 76: add timeout
|
|
|
|
uint timeout = getVarOrWord();
|
|
|
|
addTimeEvent(timeout, getVarOrWord());
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_if1() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 77: has item minus 1
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(_subjectItem != NULL);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_if2() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 78: has item minus 3
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(_objectItem != NULL);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_isCalled() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 79: childstruct fr2 is
|
|
|
|
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
|
|
|
|
uint stringId = getNextStringID();
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition((subObject != NULL) && subObject->objectName == stringId);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_is() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 80: item equal
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(getNextItemPtr() == getNextItemPtr());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_debug() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 82: debug opcode
|
|
|
|
getVarOrByte();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_comment() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 87: comment
|
|
|
|
getNextStringID();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_haltAnimation() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 88: stop animation
|
|
|
|
_lockWord |= 0x10;
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_restartAnimation() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 89: restart animation
|
|
|
|
_lockWord &= ~0x10;
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_getParent() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 90: set minusitem to parent
|
|
|
|
Item *item = derefItem(getNextItemPtr()->parent);
|
|
|
|
switch (getVarOrByte()) {
|
|
|
|
case 0:
|
|
|
|
_objectItem = item;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
_subjectItem = item;
|
|
|
|
break;
|
|
|
|
default:
|
2006-04-10 09:49:03 +00:00
|
|
|
error("o_getParent: invalid subcode");
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_getNext() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 91: set minusitem to sibling
|
|
|
|
Item *item = derefItem(getNextItemPtr()->sibling);
|
|
|
|
switch (getVarOrByte()) {
|
|
|
|
case 0:
|
|
|
|
_objectItem = item;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
_subjectItem = item;
|
|
|
|
break;
|
|
|
|
default:
|
2006-04-10 09:49:03 +00:00
|
|
|
error("o_getNext: invalid subcode");
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_getChildren() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 92: set minusitem to child
|
|
|
|
Item *item = derefItem(getNextItemPtr()->child);
|
|
|
|
switch (getVarOrByte()) {
|
|
|
|
case 0:
|
|
|
|
_objectItem = item;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
_subjectItem = item;
|
|
|
|
break;
|
|
|
|
default:
|
2006-04-10 09:49:03 +00:00
|
|
|
error("o_getChildren: invalid subcode");
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_picture() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 96
|
2006-04-10 07:09:03 +00:00
|
|
|
uint vga_res = getVarOrWord();
|
|
|
|
uint mode = getVarOrByte();
|
|
|
|
|
|
|
|
if (mode == 4)
|
|
|
|
vc29_stopAllSounds();
|
|
|
|
|
|
|
|
if (_lockWord & 0x10)
|
2006-04-10 09:49:03 +00:00
|
|
|
error("o_picture: _lockWord & 0x10");
|
2006-04-10 07:09:03 +00:00
|
|
|
|
|
|
|
set_video_mode_internal(mode, vga_res);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_loadZone() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 97: load vga
|
2006-04-10 08:00:29 +00:00
|
|
|
uint vga_res = getVarOrWord();
|
|
|
|
|
|
|
|
_lockWord |= 0x80;
|
|
|
|
loadZone(vga_res);
|
|
|
|
_lockWord &= ~0x80;
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_killAnimate() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 100: vga reset
|
2006-04-10 06:51:20 +00:00
|
|
|
_lockWord |= 0x8000;
|
|
|
|
vc27_resetSprite();
|
|
|
|
_lockWord &= ~0x8000;
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_defWindow() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 101
|
|
|
|
uint num = getVarOrByte();
|
|
|
|
uint x = getVarOrWord();
|
|
|
|
uint y = getVarOrWord();
|
|
|
|
uint w = getVarOrWord();
|
|
|
|
uint h = getVarOrWord();
|
|
|
|
uint flags = getVarOrWord();
|
|
|
|
uint fill_color = getVarOrWord();
|
2006-04-10 06:57:44 +00:00
|
|
|
uint text_color = 0;
|
|
|
|
|
|
|
|
num &= 7;
|
|
|
|
|
|
|
|
if (_windowArray[num])
|
|
|
|
closeWindow(num);
|
|
|
|
|
|
|
|
_windowArray[num] = openWindow(x, y, w, h, flags, fill_color, text_color);
|
|
|
|
|
|
|
|
if (num == _curWindow) {
|
|
|
|
_textWindow = _windowArray[num];
|
|
|
|
if (getGameType() == GType_FF)
|
|
|
|
showmessage_helper_3(_textWindow->textColumn, _textWindow->width);
|
|
|
|
else
|
|
|
|
showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
|
|
|
|
}
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_window() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 102
|
|
|
|
changeWindow(getVarOrByte() & 7);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_cls() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 103
|
2006-04-10 07:02:28 +00:00
|
|
|
mouseOff();
|
|
|
|
removeIconArray(_curWindow);
|
|
|
|
showMessageFormat("\x0C");
|
|
|
|
_oracleMaxScrollY = 0;
|
|
|
|
_noOracleScroll = 0;
|
|
|
|
mouseOn();
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_closeWindow() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 104
|
|
|
|
closeWindow(getVarOrByte() & 7);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_addBox() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 107: add item hitarea
|
|
|
|
uint flags = 0;
|
|
|
|
uint id = getVarOrWord();
|
|
|
|
uint params = id / 1000;
|
|
|
|
uint x, y, w, h, verb;
|
|
|
|
Item *item;
|
|
|
|
|
|
|
|
id = id % 1000;
|
|
|
|
|
|
|
|
if (params & 1)
|
2006-04-07 14:40:33 +00:00
|
|
|
flags |= kBFInvertTouch;
|
2006-04-06 17:56:41 +00:00
|
|
|
if (params & 2)
|
2006-04-07 14:40:33 +00:00
|
|
|
flags |= kBFNoTouchName;
|
2006-04-06 17:56:41 +00:00
|
|
|
if (params & 4)
|
2006-04-07 14:40:33 +00:00
|
|
|
flags |= kBFBoxItem;
|
2006-04-06 17:56:41 +00:00
|
|
|
if (params & 8)
|
2006-04-07 14:40:33 +00:00
|
|
|
flags |= kBFTextBox;
|
2006-04-06 17:56:41 +00:00
|
|
|
if (params & 16)
|
|
|
|
flags |= 0x10;
|
|
|
|
|
|
|
|
x = getVarOrWord();
|
|
|
|
y = getVarOrWord();
|
|
|
|
w = getVarOrWord();
|
|
|
|
h = getVarOrWord();
|
|
|
|
item = getNextItemPtrStrange();
|
|
|
|
verb = getVarOrWord();
|
|
|
|
if (x >= 1000) {
|
|
|
|
verb += 0x4000;
|
|
|
|
x -= 1000;
|
|
|
|
}
|
2006-04-08 12:06:52 +00:00
|
|
|
defineBox(id, x, y, w, h, flags, verb, item);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_delBox() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 108: delete hitarea
|
2006-04-14 09:57:43 +00:00
|
|
|
undefineBox(getVarOrWord());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_enableBox() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 109: clear hitarea bit 0x40
|
2006-04-14 09:57:43 +00:00
|
|
|
enableBox(getVarOrWord());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_disableBox() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 110: set hitarea bit 0x40
|
2006-04-14 09:57:43 +00:00
|
|
|
disableBox(getVarOrWord());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_moveBox() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 111: set hitarea xy
|
|
|
|
uint hitarea_id = getVarOrWord();
|
|
|
|
uint x = getVarOrWord();
|
|
|
|
uint y = getVarOrWord();
|
|
|
|
moveBox(hitarea_id, x, y);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_doIcons() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 114
|
|
|
|
Item *item = getNextItemPtr();
|
|
|
|
uint num = getVarOrByte();
|
|
|
|
mouseOff();
|
|
|
|
drawIconArray(num, item, 0, 0);
|
|
|
|
mouseOn();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_isClass() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 115: item has flag
|
|
|
|
Item *item = getNextItemPtr();
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition((item->classFlags & (1 << getVarOrByte())) != 0);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_setClass() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 116: item set flag
|
|
|
|
Item *item = getNextItemPtr();
|
|
|
|
item->classFlags |= (1 << getVarOrByte());
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_unsetClass() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 117: item clear flag
|
|
|
|
Item *item = getNextItemPtr();
|
|
|
|
item->classFlags &= ~(1 << getVarOrByte());
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_waitSync() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 119: wait vga
|
|
|
|
uint var = getVarOrWord();
|
|
|
|
_scriptVar2 = (var == 200);
|
|
|
|
|
|
|
|
if (var != 200 || !_skipVgaWait)
|
By now, it should be obvious that I'm trying to get rid of the o_ functions.
This is in preparation for the next stage of the cleanup.
By now, I have merged most of the o_ opcode functions into the corresponding
o1_ opcode function. There are a few pure o_ opcode functions left, but it
makes sense to keep them separate functions since they are part of groups of
other functions. Now, to get rid of the remaining o_ functions I have:
Dropped the "o_" prefix from the following functions: o_kill_sprite_simon1(),
o_kill_sprite_simon2(), o_waitForSync(), o_freezeBottom(), o_setTextColor(),
o_fadeToBlack(), o_waitForMark(), o_unk_132_helper_3(), o_unk_132_helper(),
o_clearCharacter(), o_fileError().
Renamed o_sync() to sendSync().
Renamed o_mouseOn() to scriptMouseOn(), and moved it to items.cpp
Renamed o_mouseOff() to scriptMouseOff(), and moved it to items.cpp
svn-id: r21760
2006-04-10 09:18:07 +00:00
|
|
|
waitForSync(var);
|
2006-04-06 17:56:41 +00:00
|
|
|
_skipVgaWait = false;
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_sync() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 120: sync
|
By now, it should be obvious that I'm trying to get rid of the o_ functions.
This is in preparation for the next stage of the cleanup.
By now, I have merged most of the o_ opcode functions into the corresponding
o1_ opcode function. There are a few pure o_ opcode functions left, but it
makes sense to keep them separate functions since they are part of groups of
other functions. Now, to get rid of the remaining o_ functions I have:
Dropped the "o_" prefix from the following functions: o_kill_sprite_simon1(),
o_kill_sprite_simon2(), o_waitForSync(), o_freezeBottom(), o_setTextColor(),
o_fadeToBlack(), o_waitForMark(), o_unk_132_helper_3(), o_unk_132_helper(),
o_clearCharacter(), o_fileError().
Renamed o_sync() to sendSync().
Renamed o_mouseOn() to scriptMouseOn(), and moved it to items.cpp
Renamed o_mouseOff() to scriptMouseOff(), and moved it to items.cpp
svn-id: r21760
2006-04-10 09:18:07 +00:00
|
|
|
sendSync(getVarOrWord());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_defObj() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 121: set vga item
|
|
|
|
uint slot = getVarOrByte();
|
2006-04-15 06:35:40 +00:00
|
|
|
_objectArray[slot] = getNextItemPtr();
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_here() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 125: item is sibling with item 1
|
|
|
|
Item *item = getNextItemPtr();
|
2006-04-19 11:54:38 +00:00
|
|
|
setScriptCondition(me()->parent == item->parent);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_doClassIcons() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 126
|
|
|
|
Item *item = getNextItemPtr();
|
|
|
|
uint num = getVarOrByte();
|
|
|
|
uint a = 1 << getVarOrByte();
|
|
|
|
mouseOff();
|
|
|
|
drawIconArray(num, item, 1, a);
|
|
|
|
mouseOn();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_waitEndTune() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 128: dummy instruction
|
|
|
|
getVarOrWord();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_ifEndTune() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 129: dummy instruction
|
|
|
|
getVarOrWord();
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(true);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_setAdjNoun() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 130: set adj noun
|
|
|
|
uint var = getVarOrByte();
|
|
|
|
if (var == 1) {
|
|
|
|
_scriptAdj1 = getNextWord();
|
|
|
|
_scriptNoun1 = getNextWord();
|
|
|
|
} else {
|
|
|
|
_scriptAdj2 = getNextWord();
|
|
|
|
_scriptNoun2 = getNextWord();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_saveUserGame() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 132: save game
|
|
|
|
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
|
2006-06-02 08:06:50 +00:00
|
|
|
userGame(false);
|
2006-04-06 17:56:41 +00:00
|
|
|
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_loadUserGame() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 133: load game
|
|
|
|
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
|
2006-06-02 08:06:50 +00:00
|
|
|
userGame(true);
|
2006-04-06 17:56:41 +00:00
|
|
|
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_stopTune() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 134: dummy opcode?
|
|
|
|
midi.stop();
|
|
|
|
_lastMusicPlayed = -1;
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_pauseGame() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 135: quit if user presses y
|
|
|
|
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
|
2006-04-10 08:22:03 +00:00
|
|
|
|
|
|
|
// If all else fails, use English as fallback.
|
|
|
|
byte keyYes = 'y';
|
|
|
|
byte keyNo = 'n';
|
|
|
|
|
|
|
|
switch (_language) {
|
|
|
|
case Common::RU_RUS:
|
|
|
|
break;
|
|
|
|
case Common::PL_POL:
|
|
|
|
keyYes = 't';
|
|
|
|
break;
|
|
|
|
case Common::HB_ISR:
|
|
|
|
keyYes = 'f';
|
|
|
|
break;
|
|
|
|
case Common::ES_ESP:
|
|
|
|
keyYes = 's';
|
|
|
|
break;
|
|
|
|
case Common::IT_ITA:
|
|
|
|
keyYes = 's';
|
|
|
|
break;
|
|
|
|
case Common::FR_FRA:
|
|
|
|
keyYes = 'o';
|
|
|
|
break;
|
|
|
|
case Common::DE_DEU:
|
|
|
|
keyYes = 'j';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
delay(1);
|
|
|
|
#ifdef _WIN32_WCE
|
|
|
|
if (isSmartphone()) {
|
|
|
|
if (_keyPressed) {
|
|
|
|
if (_keyPressed == 13)
|
|
|
|
shutdown();
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2006-07-25 03:46:56 +00:00
|
|
|
if (_keyPressed == keyYes || _keyPressed == (keyYes - 32))
|
2006-04-10 08:22:03 +00:00
|
|
|
shutdown();
|
2006-07-25 03:46:56 +00:00
|
|
|
else if (_keyPressed == keyNo || _keyPressed == (keyNo - 32))
|
2006-04-10 08:22:03 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-04-06 17:56:41 +00:00
|
|
|
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_copysf() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 136: set var to item unk3
|
|
|
|
Item *item = getNextItemPtr();
|
|
|
|
writeNextVarContents(item->state);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_restoreIcons() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 137
|
2006-04-10 08:28:29 +00:00
|
|
|
uint num = getVarOrByte();
|
|
|
|
WindowBlock *window = _windowArray[num & 7];
|
|
|
|
if (window->iconPtr)
|
|
|
|
drawIconArray(num, window->iconPtr->itemRef, window->iconPtr->line, window->iconPtr->classMask);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_freezeZones() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 138: vga pointer op 4
|
By now, it should be obvious that I'm trying to get rid of the o_ functions.
This is in preparation for the next stage of the cleanup.
By now, I have merged most of the o_ opcode functions into the corresponding
o1_ opcode function. There are a few pure o_ opcode functions left, but it
makes sense to keep them separate functions since they are part of groups of
other functions. Now, to get rid of the remaining o_ functions I have:
Dropped the "o_" prefix from the following functions: o_kill_sprite_simon1(),
o_kill_sprite_simon2(), o_waitForSync(), o_freezeBottom(), o_setTextColor(),
o_fadeToBlack(), o_waitForMark(), o_unk_132_helper_3(), o_unk_132_helper(),
o_clearCharacter(), o_fileError().
Renamed o_sync() to sendSync().
Renamed o_mouseOn() to scriptMouseOn(), and moved it to items.cpp
Renamed o_mouseOff() to scriptMouseOff(), and moved it to items.cpp
svn-id: r21760
2006-04-10 09:18:07 +00:00
|
|
|
freezeBottom();
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_placeNoIcons() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 139: set parent special
|
|
|
|
Item *item = getNextItemPtr();
|
|
|
|
_noParentNotify = true;
|
|
|
|
setItemParent(item, getNextItemPtr());
|
|
|
|
_noParentNotify = false;
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_clearTimers() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 140: del te and add one
|
|
|
|
killAllTimers();
|
|
|
|
addTimeEvent(3, 0xA0);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_setDollar() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 141: set m1 to m3
|
|
|
|
uint which = getVarOrByte();
|
|
|
|
Item *item = getNextItemPtr();
|
|
|
|
if (which == 1) {
|
|
|
|
_subjectItem = item;
|
|
|
|
} else {
|
|
|
|
_objectItem = item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_isBox() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 142: is hitarea 0x40 clear
|
2006-05-03 01:11:50 +00:00
|
|
|
setScriptCondition(isBoxDead(getVarOrWord()));
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_doTable() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 143: start item sub
|
|
|
|
SubRoom *subRoom = (SubRoom *)findChildOfType(getNextItemPtr(), 1);
|
|
|
|
if (subRoom != NULL) {
|
|
|
|
Subroutine *sub = getSubroutineByID(subRoom->subroutine_id);
|
|
|
|
if (sub)
|
|
|
|
startSubroutine(sub);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_storeItem() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 151: set array6 to item
|
|
|
|
uint var = getVarOrByte();
|
|
|
|
Item *item = getNextItemPtr();
|
2006-04-15 06:35:40 +00:00
|
|
|
_itemStore[var] = item;
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_getItem() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 152: set m1 to m3 to array 6
|
2006-04-15 06:35:40 +00:00
|
|
|
Item *item = _itemStore[getVarOrByte()];
|
2006-04-06 17:56:41 +00:00
|
|
|
uint var = getVarOrByte();
|
|
|
|
if (var == 1) {
|
|
|
|
_subjectItem = item;
|
|
|
|
} else {
|
|
|
|
_objectItem = item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_bSet() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 153: set bit
|
2006-09-28 23:22:07 +00:00
|
|
|
setBitFlag(getVarWrapper(), true);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_bClear() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 154: clear bit
|
2006-09-28 23:22:07 +00:00
|
|
|
setBitFlag(getVarWrapper(), false);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_bZero() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 155: is bit clear
|
2006-09-28 23:22:07 +00:00
|
|
|
setScriptCondition(!getBitFlag(getVarWrapper()));
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_bNotZero() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 156: is bit set
|
2006-09-28 23:22:07 +00:00
|
|
|
uint bit = getVarWrapper();
|
2006-04-06 17:56:41 +00:00
|
|
|
|
|
|
|
// WORKAROUND: Fix for glitch in some versions
|
|
|
|
if (getGameType() == GType_SIMON1 && _subroutine == 2962 && bit == 63) {
|
|
|
|
bit = 50;
|
|
|
|
}
|
|
|
|
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(getBitFlag(bit));
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_getOValue() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 157: get item int prop
|
|
|
|
Item *item = getNextItemPtr();
|
|
|
|
SubObject *subObject = (SubObject *)findChildOfType(item, 2);
|
|
|
|
uint prop = getVarOrByte();
|
|
|
|
|
|
|
|
if (subObject != NULL && subObject->objectFlags & (1 << prop) && prop < 16) {
|
|
|
|
uint offs = getOffsetOfChild2Param(subObject, 1 << prop);
|
|
|
|
writeNextVarContents(subObject->objectFlagValue[offs]);
|
|
|
|
} else {
|
|
|
|
writeNextVarContents(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_setOValue() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 158: set item prop
|
|
|
|
Item *item = getNextItemPtr();
|
|
|
|
SubObject *subObject = (SubObject *)findChildOfType(item, 2);
|
|
|
|
uint prop = getVarOrByte();
|
|
|
|
int value = getVarOrWord();
|
|
|
|
|
|
|
|
if (subObject != NULL && subObject->objectFlags & (1 << prop) && prop < 16) {
|
|
|
|
uint offs = getOffsetOfChild2Param(subObject, 1 << prop);
|
|
|
|
subObject->objectFlagValue[offs] = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_ink() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 160
|
By now, it should be obvious that I'm trying to get rid of the o_ functions.
This is in preparation for the next stage of the cleanup.
By now, I have merged most of the o_ opcode functions into the corresponding
o1_ opcode function. There are a few pure o_ opcode functions left, but it
makes sense to keep them separate functions since they are part of groups of
other functions. Now, to get rid of the remaining o_ functions I have:
Dropped the "o_" prefix from the following functions: o_kill_sprite_simon1(),
o_kill_sprite_simon2(), o_waitForSync(), o_freezeBottom(), o_setTextColor(),
o_fadeToBlack(), o_waitForMark(), o_unk_132_helper_3(), o_unk_132_helper(),
o_clearCharacter(), o_fileError().
Renamed o_sync() to sendSync().
Renamed o_mouseOn() to scriptMouseOn(), and moved it to items.cpp
Renamed o_mouseOff() to scriptMouseOff(), and moved it to items.cpp
svn-id: r21760
2006-04-10 09:18:07 +00:00
|
|
|
setTextColor(getVarOrByte());
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_screenTextBox() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 161: setup text
|
|
|
|
TextLocation *tl = getTextLocation(getVarOrByte());
|
|
|
|
|
|
|
|
tl->x = getVarOrWord();
|
|
|
|
tl->y = getVarOrByte();
|
|
|
|
tl->width = getVarOrWord();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_screenTextMsg() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 162: print string
|
2006-04-10 08:42:29 +00:00
|
|
|
uint vgaSpriteId = getVarOrByte();
|
|
|
|
uint color = getVarOrByte();
|
|
|
|
uint stringId = getNextStringID();
|
|
|
|
const byte *string_ptr = NULL;
|
2006-04-15 23:23:55 +00:00
|
|
|
uint speechId = 0;
|
2006-04-10 08:42:29 +00:00
|
|
|
TextLocation *tl;
|
|
|
|
|
|
|
|
if (stringId != 0xFFFF)
|
|
|
|
string_ptr = getStringPtrByID(stringId);
|
|
|
|
|
2006-04-15 23:23:55 +00:00
|
|
|
if (getFeatures() & GF_TALKIE) {
|
2006-09-29 00:50:22 +00:00
|
|
|
if (getGameType() == GType_FF || getGameType() == GType_PP)
|
2006-04-15 23:23:55 +00:00
|
|
|
speechId = (uint16)getVarOrWord();
|
|
|
|
else
|
|
|
|
speechId = (uint16)getNextWord();
|
|
|
|
}
|
2006-04-10 08:42:29 +00:00
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
if (getGameType() == GType_FF || getGameType() == GType_PP)
|
2006-04-10 08:42:29 +00:00
|
|
|
vgaSpriteId = 1;
|
|
|
|
|
|
|
|
tl = getTextLocation(vgaSpriteId);
|
2006-04-15 23:23:55 +00:00
|
|
|
if (_speech && speechId != 0)
|
|
|
|
playSpeech(speechId, vgaSpriteId);
|
2006-04-29 12:35:46 +00:00
|
|
|
if (((getGameType() == GType_SIMON2 && (getFeatures() & GF_TALKIE)) || getGameType() == GType_FF) &&
|
|
|
|
speechId == 0) {
|
2006-04-21 00:18:23 +00:00
|
|
|
stopAnimateSimon2(2, vgaSpriteId + 2);
|
2006-04-29 12:35:46 +00:00
|
|
|
}
|
2006-04-10 08:42:29 +00:00
|
|
|
|
2006-04-15 23:23:55 +00:00
|
|
|
if (string_ptr != NULL && (speechId == 0 || _subtitles))
|
2006-04-10 08:42:29 +00:00
|
|
|
printScreenText(vgaSpriteId, color, (const char *)string_ptr, tl->x, tl->y, tl->width);
|
|
|
|
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_playEffect() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 163: play sound
|
2006-04-16 10:12:33 +00:00
|
|
|
uint soundId = getVarOrWord();
|
|
|
|
|
|
|
|
if (getGameType() == GType_FF)
|
|
|
|
error("o_playEffect: triggered");
|
2006-04-10 07:48:58 +00:00
|
|
|
|
|
|
|
if (getGameId() == GID_SIMON1DOS)
|
2006-04-16 10:12:33 +00:00
|
|
|
playSting(soundId);
|
2006-04-10 07:48:58 +00:00
|
|
|
else
|
2006-04-16 10:12:33 +00:00
|
|
|
_sound->playEffects(soundId);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_getDollar2() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 164
|
|
|
|
_showPreposition = true;
|
2006-04-10 08:49:28 +00:00
|
|
|
|
|
|
|
setup_cond_c_helper();
|
|
|
|
|
|
|
|
_objectItem = _hitAreaObjectItem;
|
|
|
|
|
|
|
|
if (_objectItem == _dummyItem2)
|
2006-04-19 11:54:38 +00:00
|
|
|
_objectItem = me();
|
2006-04-10 08:49:28 +00:00
|
|
|
|
|
|
|
if (_objectItem == _dummyItem3)
|
2006-04-19 11:54:38 +00:00
|
|
|
_objectItem = derefItem(me()->parent);
|
2006-04-10 08:49:28 +00:00
|
|
|
|
|
|
|
if (_objectItem != NULL) {
|
|
|
|
_scriptNoun2 = _objectItem->noun;
|
|
|
|
_scriptAdj2 = _objectItem->adjective;
|
|
|
|
} else {
|
|
|
|
_scriptNoun2 = -1;
|
|
|
|
_scriptAdj2 = -1;
|
|
|
|
}
|
|
|
|
|
2006-04-06 17:56:41 +00:00
|
|
|
_showPreposition = false;
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_isAdjNoun() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 165: item unk1 unk2 is
|
|
|
|
Item *item = getNextItemPtr();
|
|
|
|
int16 a = getNextWord(), b = getNextWord();
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(item->adjective == a && item->noun == b);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_b2Set() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 166: set bit2
|
2006-04-21 06:37:28 +00:00
|
|
|
uint bit = getVarOrByte();
|
|
|
|
_bitArrayTwo[bit / 16] |= (1 << (bit & 15));
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_b2Clear() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 167: clear bit2
|
2006-04-21 06:37:28 +00:00
|
|
|
uint bit = getVarOrByte();
|
|
|
|
_bitArrayTwo[bit / 16] &= ~(1 << (bit & 15));
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_b2Zero() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 168: is bit2 clear
|
2006-04-21 06:37:28 +00:00
|
|
|
uint bit = getVarOrByte();
|
|
|
|
setScriptCondition((_bitArrayTwo[bit / 16] & (1 << (bit & 15))) == 0);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_b2NotZero() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 169: is bit2 set
|
2006-04-21 06:37:28 +00:00
|
|
|
uint bit = getVarOrByte();
|
|
|
|
setScriptCondition((_bitArrayTwo[bit / 16] & (1 << (bit & 15))) != 0);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_lockZones() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 175: vga pointer op 1
|
2006-05-13 08:24:47 +00:00
|
|
|
_vgaMemBase = _vgaMemPtr;
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_unlockZones() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 176: vga pointer op 2
|
2006-05-13 08:24:47 +00:00
|
|
|
_vgaMemPtr = _vgaFrozenBase;
|
|
|
|
_vgaMemBase = _vgaFrozenBase;
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_getPathPosn() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 178: path find
|
2006-04-10 08:34:16 +00:00
|
|
|
uint x = getVarOrWord();
|
|
|
|
uint y = getVarOrWord();
|
|
|
|
uint var_1 = getVarOrByte();
|
|
|
|
uint var_2 = getVarOrByte();
|
|
|
|
|
|
|
|
const uint16 *p;
|
|
|
|
uint i, j;
|
|
|
|
uint prev_i;
|
|
|
|
uint x_diff, y_diff;
|
|
|
|
uint best_i = 0, best_j = 0, best_dist = 0xFFFFFFFF;
|
2006-04-14 07:24:40 +00:00
|
|
|
uint maxPath = (getGameType() == GType_FF) ? 100 : 20;
|
2006-04-10 08:34:16 +00:00
|
|
|
|
|
|
|
if (getGameType() == GType_FF) {
|
|
|
|
x += _scrollX;
|
|
|
|
y += _scrollY;
|
|
|
|
}
|
|
|
|
if (getGameType() == GType_SIMON2) {
|
|
|
|
x += _scrollX * 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
int end = (getGameType() == GType_FF) ? 9999 : 999;
|
2006-04-14 07:24:40 +00:00
|
|
|
prev_i = maxPath + 1 - readVariable(12);
|
|
|
|
for (i = maxPath; i != 0; --i) {
|
|
|
|
p = (const uint16 *)_pathFindArray[maxPath - i];
|
2006-04-10 08:34:16 +00:00
|
|
|
if (!p)
|
|
|
|
continue;
|
|
|
|
for (j = 0; readUint16Wrapper(&p[0]) != end; j++, p += 2) {
|
2006-05-08 13:34:21 +00:00
|
|
|
x_diff = ABS((int16)(readUint16Wrapper(&p[0]) - x));
|
|
|
|
y_diff = ABS((int16)(readUint16Wrapper(&p[1]) - 12 - y));
|
2006-04-10 08:34:16 +00:00
|
|
|
|
|
|
|
if (x_diff < y_diff) {
|
|
|
|
x_diff /= 4;
|
|
|
|
y_diff *= 4;
|
|
|
|
}
|
|
|
|
x_diff += y_diff /= 4;
|
|
|
|
|
|
|
|
if (x_diff < best_dist || x_diff == best_dist && prev_i == i) {
|
|
|
|
best_dist = x_diff;
|
2006-04-14 07:24:40 +00:00
|
|
|
best_i = maxPath + 1 - i;
|
2006-04-10 08:34:16 +00:00
|
|
|
best_j = j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-14 07:24:40 +00:00
|
|
|
writeVariable(var_1, best_i);
|
|
|
|
writeVariable(var_2, best_j);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_scnTxtLongText() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 179: conversation responses and room descriptions
|
|
|
|
uint vgaSpriteId = getVarOrByte();
|
|
|
|
uint color = getVarOrByte();
|
|
|
|
uint stringId = getVarOrByte();
|
|
|
|
uint speechId = 0;
|
2006-04-07 03:30:52 +00:00
|
|
|
TextLocation *tl;
|
2006-04-06 17:56:41 +00:00
|
|
|
|
2006-09-29 00:50:22 +00:00
|
|
|
const char *string_ptr = (const char *)getStringPtrByID(_longText[stringId]);
|
2006-04-06 17:56:41 +00:00
|
|
|
if (getFeatures() & GF_TALKIE)
|
2006-09-29 00:50:22 +00:00
|
|
|
speechId = _longSound[stringId];
|
2006-04-06 17:56:41 +00:00
|
|
|
|
2006-04-07 03:30:52 +00:00
|
|
|
if (getGameType() == GType_FF)
|
|
|
|
vgaSpriteId = 1;
|
|
|
|
tl = getTextLocation(vgaSpriteId);
|
|
|
|
|
2006-04-06 17:56:41 +00:00
|
|
|
if (_speech && speechId != 0)
|
|
|
|
playSpeech(speechId, vgaSpriteId);
|
|
|
|
if (string_ptr != NULL && _subtitles)
|
2006-04-07 01:46:43 +00:00
|
|
|
printScreenText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_mouseOn() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 180: force mouseOn
|
By now, it should be obvious that I'm trying to get rid of the o_ functions.
This is in preparation for the next stage of the cleanup.
By now, I have merged most of the o_ opcode functions into the corresponding
o1_ opcode function. There are a few pure o_ opcode functions left, but it
makes sense to keep them separate functions since they are part of groups of
other functions. Now, to get rid of the remaining o_ functions I have:
Dropped the "o_" prefix from the following functions: o_kill_sprite_simon1(),
o_kill_sprite_simon2(), o_waitForSync(), o_freezeBottom(), o_setTextColor(),
o_fadeToBlack(), o_waitForMark(), o_unk_132_helper_3(), o_unk_132_helper(),
o_clearCharacter(), o_fileError().
Renamed o_sync() to sendSync().
Renamed o_mouseOn() to scriptMouseOn(), and moved it to items.cpp
Renamed o_mouseOff() to scriptMouseOff(), and moved it to items.cpp
svn-id: r21760
2006-04-10 09:18:07 +00:00
|
|
|
scriptMouseOn();
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_unloadZone() {
|
2006-04-10 10:07:56 +00:00
|
|
|
// 184: clear vgapointer entry
|
|
|
|
uint a = getVarOrWord();
|
|
|
|
VgaPointersEntry *vpe = &_vgaBufferPointers[a];
|
|
|
|
|
|
|
|
vpe->sfxFile = NULL;
|
|
|
|
vpe->vgaFile1 = NULL;
|
|
|
|
vpe->vgaFile2 = NULL;
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o_unfreezeZones() {
|
2006-04-10 10:07:56 +00:00
|
|
|
// 186: vga pointer op 3
|
|
|
|
unfreezeBottom();
|
|
|
|
}
|
|
|
|
|
2006-09-19 11:59:13 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
// Waxworks 1 Opcodes
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::oww_whereTo() {
|
2006-09-19 11:59:13 +00:00
|
|
|
// 85: where to
|
|
|
|
Item *i = getNextItemPtr();
|
|
|
|
int16 d = getVarOrByte();
|
|
|
|
int16 f = getVarOrByte();
|
|
|
|
|
|
|
|
if (f == 1)
|
|
|
|
_subjectItem = _itemArrayPtr[getExitOf(i, d)];
|
|
|
|
else
|
|
|
|
_objectItem = _itemArrayPtr[getExitOf(i, d)];
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::oww_menu() {
|
2006-09-19 11:59:13 +00:00
|
|
|
// 105: menu
|
|
|
|
getVarOrByte();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::oww_textMenu() {
|
2006-09-19 11:59:13 +00:00
|
|
|
// 106: text menu
|
|
|
|
|
|
|
|
/* byte tmp = getVarOrByte();
|
|
|
|
TextMenu[tmp] = getVarOrByte(); */
|
|
|
|
|
|
|
|
getVarOrByte();
|
|
|
|
getVarOrByte();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::oww_ifDoorOpen() {
|
2006-09-19 11:59:13 +00:00
|
|
|
// 148: if door open
|
|
|
|
Item *item = getNextItemPtr();
|
|
|
|
uint16 d = getVarOrByte();
|
|
|
|
setScriptCondition(getDoorState(item, d) != 0);
|
|
|
|
}
|
|
|
|
|
2006-04-10 10:07:56 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
// Simon 1 Opcodes
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o1_printLongText() {
|
2006-04-10 10:07:56 +00:00
|
|
|
// 70: show string from array
|
2006-09-29 00:50:22 +00:00
|
|
|
const char *str = (const char *)getStringPtrByID(_longText[getVarOrByte()]);
|
2006-04-10 10:07:56 +00:00
|
|
|
showMessageFormat("%s\n", str);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o1_rescan() {
|
2006-04-10 10:07:56 +00:00
|
|
|
// 83: restart subroutine
|
|
|
|
setScriptReturn(-10);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o1_animate() {
|
2006-04-10 10:07:56 +00:00
|
|
|
// 98: start vga
|
|
|
|
uint vga_res, vgaSpriteId, windowNum, x, y, palette;
|
|
|
|
vgaSpriteId = getVarOrWord();
|
|
|
|
vga_res = vgaSpriteId / 100;
|
|
|
|
windowNum = getVarOrByte();
|
|
|
|
x = getVarOrWord();
|
|
|
|
y = getVarOrWord();
|
|
|
|
palette = getVarOrWord();
|
|
|
|
loadSprite(windowNum, vga_res, vgaSpriteId, x, y, palette);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o1_stopAnimate() {
|
2006-04-10 10:07:56 +00:00
|
|
|
// 99: kill sprite
|
2006-04-21 00:18:23 +00:00
|
|
|
stopAnimateSimon1(getVarOrWord());
|
2006-04-10 10:07:56 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o1_playTune() {
|
2006-04-10 10:18:55 +00:00
|
|
|
// 127: deals with music
|
|
|
|
int music = getVarOrWord();
|
|
|
|
int track = getVarOrWord();
|
|
|
|
|
|
|
|
// Jamieson630:
|
|
|
|
// This appears to be a "load or play music" command.
|
|
|
|
// The music resource is specified, and optionally
|
|
|
|
// a track as well. Normally we see two calls being
|
|
|
|
// made, one to load the resource and another to
|
|
|
|
// actually start a track (so the resource is
|
|
|
|
// effectively preloaded so there's no latency when
|
|
|
|
// starting playback).
|
|
|
|
|
|
|
|
if (music != _lastMusicPlayed) {
|
|
|
|
_lastMusicPlayed = music;
|
|
|
|
loadMusic(music);
|
|
|
|
midi.startTrack(track);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o1_screenTextPObj() {
|
2006-09-18 12:01:18 +00:00
|
|
|
// 177: inventory descriptions
|
|
|
|
uint vgaSpriteId = getVarOrByte();
|
|
|
|
uint color = getVarOrByte();
|
|
|
|
|
|
|
|
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
|
|
|
|
if (getFeatures() & GF_TALKIE) {
|
|
|
|
if (subObject != NULL && subObject->objectFlags & kOFVoice) {
|
|
|
|
uint offs = getOffsetOfChild2Param(subObject, kOFVoice);
|
|
|
|
playSpeech(subObject->objectFlagValue[offs], vgaSpriteId);
|
|
|
|
} else if (subObject != NULL && subObject->objectFlags & kOFNumber) {
|
|
|
|
uint offs = getOffsetOfChild2Param(subObject, kOFNumber);
|
|
|
|
playSpeech(subObject->objectFlagValue[offs] + 3550, vgaSpriteId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (subObject != NULL && subObject->objectFlags & kOFText && _subtitles) {
|
|
|
|
const char *stringPtr = (const char *)getStringPtrByID(subObject->objectFlagValue[0]);
|
|
|
|
TextLocation *tl = getTextLocation(vgaSpriteId);
|
|
|
|
char buf[256];
|
|
|
|
int j, k;
|
|
|
|
|
|
|
|
if (subObject->objectFlags & kOFNumber) {
|
|
|
|
if (_language == Common::HB_ISR) {
|
|
|
|
j = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)];
|
|
|
|
k = (j % 10) * 10;
|
|
|
|
k += j / 10;
|
|
|
|
if (!(j % 10))
|
|
|
|
sprintf(buf,"0%d%s", k, stringPtr);
|
|
|
|
else
|
|
|
|
sprintf(buf,"%d%s", k, stringPtr);
|
|
|
|
} else {
|
|
|
|
sprintf(buf,"%d%s", subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)], stringPtr);
|
|
|
|
}
|
|
|
|
stringPtr = buf;
|
|
|
|
}
|
|
|
|
if (stringPtr != NULL)
|
|
|
|
printScreenText(vgaSpriteId, color, stringPtr, tl->x, tl->y, tl->width);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o1_mouseOff() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 181: force mouseOff
|
By now, it should be obvious that I'm trying to get rid of the o_ functions.
This is in preparation for the next stage of the cleanup.
By now, I have merged most of the o_ opcode functions into the corresponding
o1_ opcode function. There are a few pure o_ opcode functions left, but it
makes sense to keep them separate functions since they are part of groups of
other functions. Now, to get rid of the remaining o_ functions I have:
Dropped the "o_" prefix from the following functions: o_kill_sprite_simon1(),
o_kill_sprite_simon2(), o_waitForSync(), o_freezeBottom(), o_setTextColor(),
o_fadeToBlack(), o_waitForMark(), o_unk_132_helper_3(), o_unk_132_helper(),
o_clearCharacter(), o_fileError().
Renamed o_sync() to sendSync().
Renamed o_mouseOn() to scriptMouseOn(), and moved it to items.cpp
Renamed o_mouseOff() to scriptMouseOff(), and moved it to items.cpp
svn-id: r21760
2006-04-10 09:18:07 +00:00
|
|
|
scriptMouseOff();
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o1_loadBeard() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 182: load beard
|
2006-04-10 07:21:44 +00:00
|
|
|
if (_beardLoaded == false) {
|
|
|
|
_beardLoaded = true;
|
|
|
|
_lockWord |= 0x8000;
|
2006-04-21 00:18:23 +00:00
|
|
|
loadSimonVGAFile(328);
|
2006-04-10 07:21:44 +00:00
|
|
|
_lockWord &= ~0x8000;
|
|
|
|
}
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o1_unloadBeard() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 183: unload beard
|
2006-04-10 07:21:44 +00:00
|
|
|
if (_beardLoaded == true) {
|
|
|
|
_beardLoaded = false;
|
|
|
|
_lockWord |= 0x8000;
|
2006-04-21 00:18:23 +00:00
|
|
|
loadSimonVGAFile(23);
|
2006-04-10 07:21:44 +00:00
|
|
|
_lockWord &= ~0x8000;
|
|
|
|
}
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o1_loadStrings() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 185: load sound files
|
|
|
|
_soundFileId = getVarOrWord();
|
|
|
|
if (getPlatform() == Common::kPlatformAmiga && getFeatures() & GF_TALKIE) {
|
|
|
|
char buf[10];
|
|
|
|
sprintf(buf, "%d%s", _soundFileId, "Effects");
|
|
|
|
_sound->readSfxFile(buf);
|
|
|
|
sprintf(buf, "%d%s", _soundFileId, "simon");
|
|
|
|
_sound->readVoiceFile(buf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o1_specialFade() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 187: fade to black
|
2006-04-29 12:25:15 +00:00
|
|
|
uint i;
|
|
|
|
|
2006-05-12 20:09:15 +00:00
|
|
|
memcpy(_videoBuf1, _currentPalette, 4 * 256);
|
2006-04-29 12:25:15 +00:00
|
|
|
|
2006-05-05 05:53:36 +00:00
|
|
|
for (i = 32; i != 0; --i) {
|
2006-05-12 20:09:15 +00:00
|
|
|
paletteFadeOut(_videoBuf1, 32, 8);
|
|
|
|
paletteFadeOut(_videoBuf1 + 4 * 48, 144, 8);
|
|
|
|
paletteFadeOut(_videoBuf1 + 4 * 208, 48, 8);
|
2006-04-29 12:25:15 +00:00
|
|
|
_system->setPalette(_videoBuf1, 0, 256);
|
|
|
|
delay(5);
|
2006-05-05 05:53:36 +00:00
|
|
|
}
|
2006-04-29 12:25:15 +00:00
|
|
|
|
2006-05-05 05:53:36 +00:00
|
|
|
memcpy(_currentPalette, _videoBuf1, 1024);
|
|
|
|
memcpy(_displayPalette, _videoBuf1, 1024);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
// Simon 2 Opcodes
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o2_printLongText() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 70: show string from array
|
2006-09-29 00:50:22 +00:00
|
|
|
const char *str = (const char *)getStringPtrByID(_longText[getVarOrByte()]);
|
2006-04-06 17:56:41 +00:00
|
|
|
writeVariable(51, strlen(str) / 53 * 8 + 8);
|
|
|
|
showMessageFormat("%s\n", str);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o2_rescan() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 83: restart subroutine
|
2006-04-07 01:46:43 +00:00
|
|
|
if (_exitCutscene) {
|
|
|
|
if (getBitFlag(9)) {
|
|
|
|
endCutscene();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
processSpecialKeys();
|
|
|
|
}
|
|
|
|
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptReturn(-10);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o2_animate() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 98: start vga
|
2006-04-10 10:45:21 +00:00
|
|
|
uint vga_res = getVarOrWord();
|
|
|
|
uint vgaSpriteId = getVarOrWord();
|
|
|
|
uint windowNum = getVarOrByte();
|
|
|
|
uint x = getVarOrWord();
|
|
|
|
uint y = getVarOrWord();
|
|
|
|
uint palette = getVarOrWord();
|
2006-04-06 17:56:41 +00:00
|
|
|
loadSprite(windowNum, vga_res, vgaSpriteId, x, y, palette);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o2_stopAnimate() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 99: kill sprite
|
|
|
|
uint a = getVarOrWord();
|
|
|
|
uint b = getVarOrWord();
|
2006-04-21 00:18:23 +00:00
|
|
|
stopAnimateSimon2(a, b);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o2_playTune() {
|
2006-04-10 10:18:55 +00:00
|
|
|
// 127: deals with music
|
|
|
|
int music = getVarOrWord();
|
|
|
|
int track = getVarOrWord();
|
|
|
|
int loop = getVarOrByte();
|
|
|
|
|
|
|
|
// Jamieson630:
|
|
|
|
// This appears to be a "load or play music" command.
|
|
|
|
// The music resource is specified, and optionally
|
|
|
|
// a track as well. Normally we see two calls being
|
|
|
|
// made, one to load the resource and another to
|
|
|
|
// actually start a track (so the resource is
|
|
|
|
// effectively preloaded so there's no latency when
|
|
|
|
// starting playback).
|
|
|
|
|
|
|
|
midi.setLoop(loop != 0);
|
|
|
|
if (_lastMusicPlayed != music)
|
|
|
|
_nextMusicToPlay = music;
|
|
|
|
else
|
|
|
|
midi.startTrack(track);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o2_screenTextPObj() {
|
2006-04-17 22:47:12 +00:00
|
|
|
// 177: inventory descriptions
|
|
|
|
uint vgaSpriteId = getVarOrByte();
|
|
|
|
uint color = getVarOrByte();
|
|
|
|
|
|
|
|
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
|
|
|
|
if (getFeatures() & GF_TALKIE) {
|
|
|
|
if (subObject != NULL && subObject->objectFlags & kOFVoice) {
|
|
|
|
uint speechId = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFVoice)];
|
|
|
|
|
|
|
|
if (subObject->objectFlags & kOFNumber) {
|
|
|
|
uint speechIdOffs = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)];
|
|
|
|
|
|
|
|
if (speechId == 116)
|
|
|
|
speechId = speechIdOffs + 115;
|
|
|
|
if (speechId == 92)
|
|
|
|
speechId = speechIdOffs + 98;
|
|
|
|
if (speechId == 99)
|
|
|
|
speechId = 9;
|
|
|
|
if (speechId == 97) {
|
|
|
|
switch (speechIdOffs) {
|
|
|
|
case 12:
|
|
|
|
speechId = 109;
|
|
|
|
break;
|
|
|
|
case 14:
|
|
|
|
speechId = 108;
|
|
|
|
break;
|
|
|
|
case 18:
|
|
|
|
speechId = 107;
|
|
|
|
break;
|
|
|
|
case 20:
|
|
|
|
speechId = 106;
|
|
|
|
break;
|
|
|
|
case 22:
|
|
|
|
speechId = 105;
|
|
|
|
break;
|
|
|
|
case 28:
|
|
|
|
speechId = 104;
|
|
|
|
break;
|
|
|
|
case 90:
|
|
|
|
speechId = 103;
|
|
|
|
break;
|
|
|
|
case 92:
|
|
|
|
speechId = 102;
|
|
|
|
break;
|
|
|
|
case 100:
|
|
|
|
speechId = 51;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("o2_screenTextPObj: invalid case %d", speechIdOffs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_speech)
|
|
|
|
playSpeech(speechId, vgaSpriteId);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-06-02 02:35:04 +00:00
|
|
|
if (subObject != NULL && subObject->objectFlags & kOFText && _subtitles) {
|
|
|
|
const char *stringPtr = (const char *)getStringPtrByID(subObject->objectFlagValue[0]);
|
|
|
|
TextLocation *tl = getTextLocation(vgaSpriteId);
|
|
|
|
char buf[256];
|
|
|
|
int j, k;
|
|
|
|
|
2006-04-17 22:47:12 +00:00
|
|
|
if (subObject->objectFlags & kOFNumber) {
|
2006-06-02 02:35:04 +00:00
|
|
|
if (_language == Common::HB_ISR) {
|
|
|
|
j = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)];
|
|
|
|
k = (j % 10) * 10;
|
|
|
|
k += j / 10;
|
|
|
|
if (!(j % 10))
|
|
|
|
sprintf(buf,"0%d%s", k, stringPtr);
|
|
|
|
else
|
|
|
|
sprintf(buf,"%d%s", k, stringPtr);
|
|
|
|
} else {
|
|
|
|
sprintf(buf,"%d%s", subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)], stringPtr);
|
|
|
|
}
|
|
|
|
stringPtr = buf;
|
2006-04-17 22:47:12 +00:00
|
|
|
}
|
2006-06-02 02:35:04 +00:00
|
|
|
if (stringPtr != NULL)
|
|
|
|
printScreenText(vgaSpriteId, color, stringPtr, tl->x, tl->y, tl->width);
|
2006-04-17 22:47:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o2_mouseOff() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 181: force mouseOff
|
By now, it should be obvious that I'm trying to get rid of the o_ functions.
This is in preparation for the next stage of the cleanup.
By now, I have merged most of the o_ opcode functions into the corresponding
o1_ opcode function. There are a few pure o_ opcode functions left, but it
makes sense to keep them separate functions since they are part of groups of
other functions. Now, to get rid of the remaining o_ functions I have:
Dropped the "o_" prefix from the following functions: o_kill_sprite_simon1(),
o_kill_sprite_simon2(), o_waitForSync(), o_freezeBottom(), o_setTextColor(),
o_fadeToBlack(), o_waitForMark(), o_unk_132_helper_3(), o_unk_132_helper(),
o_clearCharacter(), o_fileError().
Renamed o_sync() to sendSync().
Renamed o_mouseOn() to scriptMouseOn(), and moved it to items.cpp
Renamed o_mouseOff() to scriptMouseOff(), and moved it to items.cpp
svn-id: r21760
2006-04-10 09:18:07 +00:00
|
|
|
scriptMouseOff();
|
2006-04-06 17:56:41 +00:00
|
|
|
changeWindow(1);
|
|
|
|
showMessageFormat("\xC");
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o2_isShortText() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 188: string2 is
|
|
|
|
uint i = getVarOrByte();
|
|
|
|
uint str = getNextStringID();
|
2006-09-29 00:50:22 +00:00
|
|
|
setScriptCondition(str < _numTextBoxes && _shortText[i] == str);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o2_clearMarks() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 189: clear_op189_flag
|
|
|
|
_marks = 0;
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o2_waitMark() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 190
|
|
|
|
uint i = getVarOrByte();
|
|
|
|
if (!(_marks & (1 << i)))
|
By now, it should be obvious that I'm trying to get rid of the o_ functions.
This is in preparation for the next stage of the cleanup.
By now, I have merged most of the o_ opcode functions into the corresponding
o1_ opcode function. There are a few pure o_ opcode functions left, but it
makes sense to keep them separate functions since they are part of groups of
other functions. Now, to get rid of the remaining o_ functions I have:
Dropped the "o_" prefix from the following functions: o_kill_sprite_simon1(),
o_kill_sprite_simon2(), o_waitForSync(), o_freezeBottom(), o_setTextColor(),
o_fadeToBlack(), o_waitForMark(), o_unk_132_helper_3(), o_unk_132_helper(),
o_clearCharacter(), o_fileError().
Renamed o_sync() to sendSync().
Renamed o_mouseOn() to scriptMouseOn(), and moved it to items.cpp
Renamed o_mouseOff() to scriptMouseOff(), and moved it to items.cpp
svn-id: r21760
2006-04-10 09:18:07 +00:00
|
|
|
waitForMark(i);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
// Feeble Files Opcodes
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_chance() {
|
2006-04-21 07:42:40 +00:00
|
|
|
// 23
|
|
|
|
uint a = getVarOrWord();
|
|
|
|
|
|
|
|
if (a == 0) {
|
|
|
|
setScriptCondition(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (a == 100) {
|
|
|
|
setScriptCondition(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((uint)_rnd.getRandomNumber(99) < a)
|
|
|
|
setScriptCondition(true);
|
|
|
|
else
|
|
|
|
setScriptCondition(false);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_jumpOut() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 37
|
|
|
|
getVarOrByte();
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptReturn(1);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_addTextBox() {
|
2006-04-08 12:06:52 +00:00
|
|
|
// 65: add hit area
|
|
|
|
uint flags = kBFTextBox | kBFBoxItem;
|
|
|
|
uint id = getVarOrWord();
|
|
|
|
uint params = id / 1000;
|
|
|
|
uint x, y, w, h, num;
|
|
|
|
|
|
|
|
id %= 1000;
|
|
|
|
|
|
|
|
if (params & 1)
|
|
|
|
flags |= kBFInvertTouch;
|
|
|
|
|
|
|
|
x = getVarOrWord();
|
|
|
|
y = getVarOrWord();
|
|
|
|
w = getVarOrWord();
|
|
|
|
h = getVarOrWord();
|
|
|
|
num = getVarOrByte();
|
2006-04-15 06:42:40 +00:00
|
|
|
if (num < _numTextBoxes)
|
2006-04-19 11:54:38 +00:00
|
|
|
defineBox(id, x, y, w, h, flags + (num << 8), 208, _dummyItem2);
|
2006-04-08 12:06:52 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_printLongText() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 70: show string from array
|
2006-04-07 01:46:43 +00:00
|
|
|
int num = getVarOrByte();
|
2006-09-29 00:50:22 +00:00
|
|
|
const char *str = (const char *)getStringPtrByID(_longText[num]);
|
2006-04-19 11:05:47 +00:00
|
|
|
sendInteractText(num, "%d. %s\n", num, str);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_addBox() {
|
2006-04-17 22:35:33 +00:00
|
|
|
// 107: add item hitarea
|
|
|
|
uint flags = 0;
|
|
|
|
uint id = getVarOrWord();
|
|
|
|
uint params = id / 1000;
|
|
|
|
uint x, y, w, h, verb;
|
|
|
|
Item *item;
|
|
|
|
|
|
|
|
id = id % 1000;
|
|
|
|
|
|
|
|
if (params & 1)
|
|
|
|
flags |= kBFInvertTouch;
|
|
|
|
if (params & 2)
|
|
|
|
flags |= kBFNoTouchName;
|
|
|
|
if (params & 4)
|
|
|
|
flags |= kBFBoxItem;
|
|
|
|
if (params & 8)
|
|
|
|
flags |= kBFTextBox;
|
|
|
|
if (params & 16)
|
|
|
|
flags |= 0x10;
|
|
|
|
|
|
|
|
x = getVarOrWord();
|
|
|
|
y = getVarOrWord();
|
|
|
|
w = getVarOrWord();
|
|
|
|
h = getVarOrWord();
|
|
|
|
item = getNextItemPtrStrange();
|
|
|
|
verb = getVarOrWord();
|
|
|
|
defineBox(id, x, y, w, h, flags, verb, item);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_oracleTextDown() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 122: oracle text down
|
|
|
|
oracleTextDown();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_oracleTextUp() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 123: oracle text up
|
|
|
|
oracleTextUp();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_ifTime() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 124: if time
|
2006-04-09 06:06:10 +00:00
|
|
|
time_t t;
|
|
|
|
|
|
|
|
uint a = getVarOrWord();
|
|
|
|
time(&t);
|
|
|
|
t -= _gameStoppedClock;
|
|
|
|
t -= a;
|
|
|
|
if (t >= _timeStore)
|
|
|
|
setScriptCondition(true);
|
|
|
|
else
|
|
|
|
setScriptCondition(false);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_playTune() {
|
2006-04-10 10:18:55 +00:00
|
|
|
// 127: usually deals with music, but is a no-op in FF.
|
|
|
|
getVarOrWord();
|
|
|
|
getVarOrWord();
|
|
|
|
getVarOrByte();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_setTime() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 131
|
2006-04-09 06:06:10 +00:00
|
|
|
time(&_timeStore);
|
|
|
|
_timeStore -= _gameStoppedClock;
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_saveUserGame() {
|
2006-04-13 14:26:46 +00:00
|
|
|
// 132: save game
|
|
|
|
_noOracleScroll = 0;
|
2006-04-20 12:01:53 +00:00
|
|
|
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
|
2006-04-13 14:26:46 +00:00
|
|
|
saveUserGame(countSaveGames() + 1 - readVariable(55));
|
2006-04-20 12:01:53 +00:00
|
|
|
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
|
2006-04-13 14:26:46 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_loadUserGame() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 133: load game
|
|
|
|
loadGame(readVariable(55));
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_listSaveGames() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 134: dummy opcode?
|
|
|
|
listSaveGames(1);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_checkCD() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 135: switch CD
|
2006-04-15 05:24:44 +00:00
|
|
|
uint disc = readVariable(97);
|
|
|
|
|
|
|
|
if (!strcmp(_gameDescription->extra, "4CD")) {
|
2006-04-20 02:23:17 +00:00
|
|
|
_sound->switchVoiceFile(gss, disc);
|
2006-04-15 05:24:44 +00:00
|
|
|
} else if (!strcmp(_gameDescription->extra, "2CD")) {
|
|
|
|
if (disc == 1 || disc == 2)
|
2006-04-20 02:23:17 +00:00
|
|
|
_sound->switchVoiceFile(gss, 1);
|
2006-04-15 05:24:44 +00:00
|
|
|
else if (disc == 3 || disc == 4)
|
2006-04-20 02:23:17 +00:00
|
|
|
_sound->switchVoiceFile(gss, 2);
|
2006-04-15 05:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
debug(0, "Switch to CD number %d", disc);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_screenTextBox() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 161: setup text
|
|
|
|
TextLocation *tl = getTextLocation(getVarOrByte());
|
|
|
|
|
|
|
|
tl->x = getVarOrWord();
|
|
|
|
tl->y = getVarOrWord();
|
|
|
|
tl->width = getVarOrWord();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_isAdjNoun() {
|
2006-04-26 19:49:13 +00:00
|
|
|
// 165: item unk1 unk2 is
|
|
|
|
Item *item = getNextItemPtr();
|
|
|
|
int16 a = getNextWord(), b = getNextWord();
|
|
|
|
if (item->adjective == a && item->noun == b)
|
|
|
|
setScriptCondition(true);
|
|
|
|
else if (a == -1 && item->noun == b)
|
|
|
|
setScriptCondition(true);
|
|
|
|
else
|
|
|
|
setScriptCondition(false);
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_hyperLinkOn() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 171: oracle hyperlink on
|
|
|
|
hyperLinkOn(getVarOrWord());
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_hyperLinkOff() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 172: oracle hyperlink off
|
|
|
|
hyperLinkOff();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_checkPaths() {
|
2006-04-13 22:29:08 +00:00
|
|
|
// 173 check paths
|
2006-05-03 05:35:08 +00:00
|
|
|
int i, count;
|
2006-04-13 22:29:08 +00:00
|
|
|
const uint8 *pathVal1 = _pathValues1;
|
|
|
|
bool result = false;
|
|
|
|
|
|
|
|
count = _variableArray2[38];
|
2006-04-18 13:32:51 +00:00
|
|
|
for (i = 0; i < count; i++) {
|
2006-05-03 05:35:08 +00:00
|
|
|
uint8 val = pathVal1[2];
|
2006-04-13 22:29:08 +00:00
|
|
|
if (val == _variableArray2[50] ||
|
|
|
|
val == _variableArray2[51] ||
|
|
|
|
val == _variableArray2[201] ||
|
|
|
|
val == _variableArray2[203] ||
|
|
|
|
val == _variableArray2[205] ||
|
|
|
|
val == _variableArray2[207] ||
|
|
|
|
val == _variableArray2[209] ||
|
|
|
|
val == _variableArray2[211] ||
|
|
|
|
val == _variableArray2[213] ||
|
|
|
|
val == _variableArray2[215] ||
|
|
|
|
val == _variableArray2[219] ||
|
|
|
|
val == _variableArray2[220] ||
|
|
|
|
val == _variableArray2[221] ||
|
|
|
|
val == _variableArray2[222] ||
|
|
|
|
val == _variableArray2[223] ||
|
|
|
|
val == _variableArray2[224] ||
|
|
|
|
val == _variableArray2[225] ||
|
|
|
|
val == _variableArray2[226]) {
|
|
|
|
result = true;
|
|
|
|
break;
|
|
|
|
}
|
2006-04-18 13:32:51 +00:00
|
|
|
pathVal1 += 4;
|
2006-04-13 22:29:08 +00:00
|
|
|
}
|
|
|
|
|
2006-05-03 05:35:08 +00:00
|
|
|
_variableArray2[52] = result;
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_screenTextPObj() {
|
2006-04-17 22:47:12 +00:00
|
|
|
// 177: inventory descriptions
|
|
|
|
uint vgaSpriteId = getVarOrByte();
|
|
|
|
uint color = getVarOrByte();
|
|
|
|
const char *string_ptr = NULL;
|
|
|
|
TextLocation *tl = NULL;
|
|
|
|
char buf[256];
|
|
|
|
|
|
|
|
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
|
|
|
|
if (subObject != NULL && subObject->objectFlags & kOFText) {
|
|
|
|
string_ptr = (const char *)getStringPtrByID(subObject->objectFlagValue[0]);
|
|
|
|
tl = getTextLocation(vgaSpriteId);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (subObject != NULL && subObject->objectFlags & kOFVoice) {
|
|
|
|
uint offs = getOffsetOfChild2Param(subObject, kOFVoice);
|
|
|
|
playSpeech(subObject->objectFlagValue[offs], vgaSpriteId);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (subObject != NULL && (subObject->objectFlags & kOFText) && _subtitles) {
|
|
|
|
if (subObject->objectFlags & kOFNumber) {
|
|
|
|
sprintf(buf, "%d%s", subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)], string_ptr);
|
|
|
|
string_ptr = buf;
|
|
|
|
}
|
|
|
|
if (string_ptr != NULL)
|
|
|
|
printScreenText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_mouseOff() {
|
2006-04-07 03:03:20 +00:00
|
|
|
// 181: force mouseOff
|
By now, it should be obvious that I'm trying to get rid of the o_ functions.
This is in preparation for the next stage of the cleanup.
By now, I have merged most of the o_ opcode functions into the corresponding
o1_ opcode function. There are a few pure o_ opcode functions left, but it
makes sense to keep them separate functions since they are part of groups of
other functions. Now, to get rid of the remaining o_ functions I have:
Dropped the "o_" prefix from the following functions: o_kill_sprite_simon1(),
o_kill_sprite_simon2(), o_waitForSync(), o_freezeBottom(), o_setTextColor(),
o_fadeToBlack(), o_waitForMark(), o_unk_132_helper_3(), o_unk_132_helper(),
o_clearCharacter(), o_fileError().
Renamed o_sync() to sendSync().
Renamed o_mouseOn() to scriptMouseOn(), and moved it to items.cpp
Renamed o_mouseOff() to scriptMouseOff(), and moved it to items.cpp
svn-id: r21760
2006-04-10 09:18:07 +00:00
|
|
|
scriptMouseOff();
|
2006-04-07 03:03:20 +00:00
|
|
|
clearName();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_loadVideo() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 182: load video file
|
2006-04-17 13:19:36 +00:00
|
|
|
const byte *filename = getStringPtrByID(getNextStringID());
|
2006-04-24 10:28:48 +00:00
|
|
|
_moviePlay->load((const char *)filename);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_playVideo() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 183: play video
|
2006-04-17 13:19:36 +00:00
|
|
|
_moviePlay->play();
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_centreScroll() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 187
|
2006-04-09 04:53:31 +00:00
|
|
|
centreScroll();
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_resetPVCount() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 191
|
|
|
|
if (getBitFlag(83)) {
|
|
|
|
_PVCount1 = 0;
|
|
|
|
_GPVCount1 = 0;
|
|
|
|
} else {
|
|
|
|
_PVCount = 0;
|
|
|
|
_GPVCount = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_setPathValues() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 192
|
|
|
|
uint8 a = getVarOrByte();
|
|
|
|
uint8 b = getVarOrByte();
|
|
|
|
uint8 c = getVarOrByte();
|
|
|
|
uint8 d = getVarOrByte();
|
|
|
|
if (getBitFlag(83)) {
|
|
|
|
_pathValues1[_PVCount1++] = a;
|
|
|
|
_pathValues1[_PVCount1++] = b;
|
|
|
|
_pathValues1[_PVCount1++] = c;
|
|
|
|
_pathValues1[_PVCount1++] = d;
|
|
|
|
} else {
|
|
|
|
_pathValues[_PVCount++] = a;
|
|
|
|
_pathValues[_PVCount++] = b;
|
|
|
|
_pathValues[_PVCount++] = c;
|
|
|
|
_pathValues[_PVCount++] = d;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_stopClock() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 193: pause clock
|
2006-04-09 06:06:10 +00:00
|
|
|
_clockStopped = time(NULL);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_restartClock() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 194: resume clock
|
2006-04-09 06:06:10 +00:00
|
|
|
if (_clockStopped != 0)
|
|
|
|
_gameStoppedClock += time(NULL) - _clockStopped;
|
|
|
|
_clockStopped = 0;
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_setColour() {
|
2006-04-15 22:37:48 +00:00
|
|
|
// 195: set palette colour
|
|
|
|
uint c = getVarOrByte() * 4;
|
2006-04-16 10:12:33 +00:00
|
|
|
uint r = getVarOrByte();
|
|
|
|
uint g = getVarOrByte();
|
|
|
|
uint b = getVarOrByte();
|
2006-04-15 22:37:48 +00:00
|
|
|
|
2006-05-05 05:53:36 +00:00
|
|
|
_displayPalette[c + 0] = r;
|
|
|
|
_displayPalette[c + 1] = g;
|
|
|
|
_displayPalette[c + 2] = b;
|
2006-04-15 22:37:48 +00:00
|
|
|
|
2006-04-16 10:12:33 +00:00
|
|
|
_paletteFlag = 2;
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_b3Set() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 196: set bit3
|
2006-04-21 06:37:28 +00:00
|
|
|
uint bit = getVarOrByte();
|
|
|
|
_bitArrayThree[bit / 16] |= (1 << (bit & 15));
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_b3Clear() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 197: clear bit3
|
2006-04-21 06:37:28 +00:00
|
|
|
uint bit = getVarOrByte();
|
|
|
|
_bitArrayThree[bit / 16] &= ~(1 << (bit & 15));
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_b3Zero() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 198: is bit3 clear
|
2006-04-21 06:37:28 +00:00
|
|
|
uint bit = getVarOrByte();
|
|
|
|
setScriptCondition((_bitArrayThree[bit / 16] & (1 << (bit & 15))) == 0);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o3_b3NotZero() {
|
2006-04-06 17:56:41 +00:00
|
|
|
// 199: is bit3 set
|
2006-04-21 06:37:28 +00:00
|
|
|
uint bit = getVarOrByte();
|
|
|
|
setScriptCondition((_bitArrayThree[bit / 16] & (1 << (bit & 15))) != 0);
|
2006-04-06 17:56:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
// Puzzle Pack Opcodes
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o4_opcode30() {
|
2006-09-29 06:24:12 +00:00
|
|
|
// 30
|
2006-09-28 23:22:07 +00:00
|
|
|
getNextItemPtr();
|
|
|
|
}
|
|
|
|
|
2006-09-29 11:07:38 +00:00
|
|
|
void AGOSEngine::o4_restoreOopsPosition() {
|
|
|
|
// 32: restore oops position
|
|
|
|
getNextItemPtr();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o4_checkTiles() {
|
2006-09-29 06:24:12 +00:00
|
|
|
// 37: for MahJongg game
|
2006-09-29 05:31:33 +00:00
|
|
|
getVarOrByte();
|
|
|
|
}
|
|
|
|
|
2006-09-29 11:07:38 +00:00
|
|
|
void AGOSEngine::o4_loadMouseImage() {
|
|
|
|
// 38: load mouse image
|
2006-09-28 23:22:07 +00:00
|
|
|
getVarOrByte();
|
|
|
|
getNextItemPtr();
|
|
|
|
}
|
|
|
|
|
2006-09-29 11:07:38 +00:00
|
|
|
void AGOSEngine::o4_setShortText() {
|
|
|
|
// 66: set item name
|
|
|
|
uint var = getVarOrByte();
|
|
|
|
uint stringId = getNextStringID();
|
|
|
|
if (var < _numTextBoxes) {
|
|
|
|
_shortText[var] = stringId;
|
|
|
|
_shortTextX[var] = getVarOrWord();
|
|
|
|
_shortTextY[var] = getVarOrWord();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::o4_animate() {
|
|
|
|
// 98: start vga
|
|
|
|
uint vga_res = getVarOrWord();
|
|
|
|
uint vgaSpriteId = getVarOrWord();
|
|
|
|
uint windowNum = getVarOrByte();
|
|
|
|
uint x = getVarOrWord();
|
|
|
|
uint y = getVarOrWord();
|
|
|
|
uint palette = getVarOrWord();
|
|
|
|
|
|
|
|
if (getBitFlag(96)) {
|
|
|
|
printf("Start Block\n");
|
|
|
|
} else {
|
|
|
|
loadSprite(windowNum, vga_res, vgaSpriteId, x, y, palette);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o4_loadHiScores() {
|
2006-09-29 11:07:38 +00:00
|
|
|
// 105: load high scores
|
2006-09-28 23:22:07 +00:00
|
|
|
getVarOrByte();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o4_checkHiScores() {
|
2006-09-29 11:07:38 +00:00
|
|
|
// 106: check high scores
|
2006-09-28 23:22:07 +00:00
|
|
|
getVarOrByte();
|
|
|
|
getVarOrByte();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o4_loadUserGame() {
|
2006-09-29 11:07:38 +00:00
|
|
|
// 133: load usergame
|
2006-09-29 05:31:33 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o4_saveOopsPosition() {
|
2006-09-29 11:07:38 +00:00
|
|
|
// 173: save oops position
|
2006-09-29 06:24:12 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o4_resetGameTime() {
|
2006-09-29 11:07:38 +00:00
|
|
|
// 187: reset game time
|
|
|
|
_gameTime = 0;
|
2006-09-29 05:31:33 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o4_resetPVCount() {
|
2006-09-29 06:24:12 +00:00
|
|
|
// 191
|
2006-09-29 05:31:33 +00:00
|
|
|
_PVCount = 0;
|
|
|
|
_GPVCount = 0;
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::o4_setPathValues() {
|
2006-09-29 06:24:12 +00:00
|
|
|
// 192
|
2006-09-29 05:31:33 +00:00
|
|
|
_pathValues[_PVCount++] = getVarOrByte();
|
|
|
|
_pathValues[_PVCount++] = getVarOrByte();
|
|
|
|
_pathValues[_PVCount++] = getVarOrByte();
|
|
|
|
_pathValues[_PVCount++] = getVarOrByte();
|
|
|
|
}
|
|
|
|
|
2006-09-29 11:07:38 +00:00
|
|
|
void AGOSEngine::o4_restartClock() {
|
|
|
|
// 194: resume clock
|
|
|
|
if (_clockStopped != 0)
|
|
|
|
_gameTime += time(NULL) - _clockStopped;
|
|
|
|
_clockStopped = 0;
|
|
|
|
}
|
|
|
|
|
2006-04-06 17:56:41 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
int AGOSEngine::runScript() {
|
2006-09-28 23:22:07 +00:00
|
|
|
int opcode;
|
2006-04-07 09:37:44 +00:00
|
|
|
bool flag;
|
2006-04-06 17:56:41 +00:00
|
|
|
|
2002-06-29 16:11:13 +00:00
|
|
|
do {
|
2005-05-06 11:37:33 +00:00
|
|
|
if (_continousMainScript)
|
|
|
|
dumpOpcode(_codePtr);
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
|
|
|
|
opcode = getVarOrWord();
|
|
|
|
if (opcode == 10000)
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
opcode = getByte();
|
|
|
|
if (opcode == 0xFF)
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
debug(1, "runScript: opcode %d", opcode);
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
if (_runScriptReturn1)
|
2002-07-07 19:06:48 +00:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
/* Invert condition? */
|
|
|
|
flag = false;
|
2006-09-28 23:22:07 +00:00
|
|
|
if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
|
|
|
|
if (opcode == 203) {
|
|
|
|
flag = true;
|
|
|
|
opcode = getVarOrWord();
|
|
|
|
if (opcode == 10000)
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (opcode == 0) {
|
|
|
|
flag = true;
|
|
|
|
opcode = getByte();
|
|
|
|
if (opcode == 0xFF)
|
|
|
|
return 0;
|
|
|
|
}
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2006-04-07 09:37:44 +00:00
|
|
|
setScriptCondition(true);
|
|
|
|
setScriptReturn(0);
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2006-04-06 17:56:41 +00:00
|
|
|
if (opcode > _numOpcodes || !_opcode_table[opcode])
|
|
|
|
error("Invalid opcode '%d' encountered", opcode);
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2006-04-07 09:37:44 +00:00
|
|
|
(this->*_opcode_table[opcode]) ();
|
|
|
|
} while (getScriptCondition() != flag && !getScriptReturn());
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2006-04-07 09:37:44 +00:00
|
|
|
return getScriptReturn();
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::scriptMouseOn() {
|
2006-04-19 07:14:03 +00:00
|
|
|
if (getGameType() == GType_FF && _mouseCursor != 5) {
|
|
|
|
resetVerbs();
|
|
|
|
_noRightClick = 0;
|
|
|
|
}
|
|
|
|
if (getGameType() == GType_SIMON2 && getBitFlag(79)) {
|
By now, it should be obvious that I'm trying to get rid of the o_ functions.
This is in preparation for the next stage of the cleanup.
By now, I have merged most of the o_ opcode functions into the corresponding
o1_ opcode function. There are a few pure o_ opcode functions left, but it
makes sense to keep them separate functions since they are part of groups of
other functions. Now, to get rid of the remaining o_ functions I have:
Dropped the "o_" prefix from the following functions: o_kill_sprite_simon1(),
o_kill_sprite_simon2(), o_waitForSync(), o_freezeBottom(), o_setTextColor(),
o_fadeToBlack(), o_waitForMark(), o_unk_132_helper_3(), o_unk_132_helper(),
o_clearCharacter(), o_fileError().
Renamed o_sync() to sendSync().
Renamed o_mouseOn() to scriptMouseOn(), and moved it to items.cpp
Renamed o_mouseOff() to scriptMouseOff(), and moved it to items.cpp
svn-id: r21760
2006-04-10 09:18:07 +00:00
|
|
|
_mouseCursor = 0;
|
2006-04-19 07:14:03 +00:00
|
|
|
}
|
By now, it should be obvious that I'm trying to get rid of the o_ functions.
This is in preparation for the next stage of the cleanup.
By now, I have merged most of the o_ opcode functions into the corresponding
o1_ opcode function. There are a few pure o_ opcode functions left, but it
makes sense to keep them separate functions since they are part of groups of
other functions. Now, to get rid of the remaining o_ functions I have:
Dropped the "o_" prefix from the following functions: o_kill_sprite_simon1(),
o_kill_sprite_simon2(), o_waitForSync(), o_freezeBottom(), o_setTextColor(),
o_fadeToBlack(), o_waitForMark(), o_unk_132_helper_3(), o_unk_132_helper(),
o_clearCharacter(), o_fileError().
Renamed o_sync() to sendSync().
Renamed o_mouseOn() to scriptMouseOn(), and moved it to items.cpp
Renamed o_mouseOff() to scriptMouseOff(), and moved it to items.cpp
svn-id: r21760
2006-04-10 09:18:07 +00:00
|
|
|
_mouseHideCount = 0;
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::scriptMouseOff() {
|
By now, it should be obvious that I'm trying to get rid of the o_ functions.
This is in preparation for the next stage of the cleanup.
By now, I have merged most of the o_ opcode functions into the corresponding
o1_ opcode function. There are a few pure o_ opcode functions left, but it
makes sense to keep them separate functions since they are part of groups of
other functions. Now, to get rid of the remaining o_ functions I have:
Dropped the "o_" prefix from the following functions: o_kill_sprite_simon1(),
o_kill_sprite_simon2(), o_waitForSync(), o_freezeBottom(), o_setTextColor(),
o_fadeToBlack(), o_waitForMark(), o_unk_132_helper_3(), o_unk_132_helper(),
o_clearCharacter(), o_fileError().
Renamed o_sync() to sendSync().
Renamed o_mouseOn() to scriptMouseOn(), and moved it to items.cpp
Renamed o_mouseOff() to scriptMouseOff(), and moved it to items.cpp
svn-id: r21760
2006-04-10 09:18:07 +00:00
|
|
|
_lockWord |= 0x8000;
|
|
|
|
vc34_setMouseOff();
|
|
|
|
_lockWord &= ~0x8000;
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::waitForMark(uint i) {
|
2005-05-06 11:37:33 +00:00
|
|
|
_exitCutscene = false;
|
2005-10-05 11:37:26 +00:00
|
|
|
while (!(_marks & (1 << i))) {
|
2005-05-06 11:37:33 +00:00
|
|
|
if (_exitCutscene) {
|
2006-04-04 10:12:22 +00:00
|
|
|
if (getBitFlag(9)) {
|
2005-12-13 00:20:11 +00:00
|
|
|
endCutscene();
|
2002-12-03 05:34:55 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
processSpecialKeys();
|
|
|
|
}
|
|
|
|
|
|
|
|
delay(10);
|
|
|
|
}
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::freezeBottom() {
|
2006-05-13 08:24:47 +00:00
|
|
|
_vgaMemBase = _vgaMemPtr;
|
|
|
|
_vgaFrozenBase = _vgaMemPtr;
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::unfreezeBottom() {
|
2006-05-13 08:24:47 +00:00
|
|
|
_vgaMemPtr = _vgaRealBase;
|
|
|
|
_vgaMemBase = _vgaRealBase;
|
|
|
|
_vgaFrozenBase = _vgaRealBase;
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::sendSync(uint a) {
|
2005-11-10 01:18:09 +00:00
|
|
|
uint16 id = to16Wrapper(a);
|
2005-10-23 11:17:15 +00:00
|
|
|
_lockWord |= 0x8000;
|
|
|
|
_vcPtr = (byte *)&id;
|
2006-04-14 09:57:43 +00:00
|
|
|
vc15_sync();
|
2005-10-23 11:17:15 +00:00
|
|
|
_lockWord &= ~0x8000;
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::setTextColor(uint color) {
|
2006-04-05 02:45:28 +00:00
|
|
|
WindowBlock *window;
|
2006-03-16 07:08:05 +00:00
|
|
|
|
2006-04-05 02:45:28 +00:00
|
|
|
window = _windowArray[_curWindow];
|
|
|
|
window->text_color = color;
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::stopAnimateSimon1(uint a) {
|
2005-11-10 01:18:09 +00:00
|
|
|
uint16 b = to16Wrapper(a);
|
2005-10-23 11:17:15 +00:00
|
|
|
_lockWord |= 0x8000;
|
2005-05-06 11:37:33 +00:00
|
|
|
_vcPtr = (byte *)&b;
|
2005-05-06 13:22:48 +00:00
|
|
|
vc60_killSprite();
|
2005-10-23 11:17:15 +00:00
|
|
|
_lockWord &= ~0x8000;
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::stopAnimateSimon2(uint a, uint b) {
|
2002-06-29 16:11:13 +00:00
|
|
|
uint16 items[2];
|
2002-07-07 19:06:48 +00:00
|
|
|
|
2005-11-10 01:18:09 +00:00
|
|
|
items[0] = to16Wrapper(a);
|
|
|
|
items[1] = to16Wrapper(b);
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_lockWord |= 0x8000;
|
|
|
|
_vcPtr = (byte *)&items;
|
2005-05-06 13:22:48 +00:00
|
|
|
vc60_killSprite();
|
2005-05-06 11:37:33 +00:00
|
|
|
_lockWord &= ~0x8000;
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
} // End of namespace AGOS
|