aboutsummaryrefslogtreecommitdiff
path: root/engines/agos/script_s1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/agos/script_s1.cpp')
-rw-r--r--engines/agos/script_s1.cpp328
1 files changed, 264 insertions, 64 deletions
diff --git a/engines/agos/script_s1.cpp b/engines/agos/script_s1.cpp
index d464833431..dd7e683147 100644
--- a/engines/agos/script_s1.cpp
+++ b/engines/agos/script_s1.cpp
@@ -33,49 +33,261 @@ extern bool isSmartphone(void);
namespace AGOS {
-void AGOSEngine_Simon1::setupOpcodes(OpcodeProc *op) {
- AGOSEngine::setupOpcodes(op);
-
- op[65] = &AGOSEngine::oww_addTextBox;
- op[66] = &AGOSEngine::oww_setShortText;
- op[67] = &AGOSEngine::oww_setLongText;
- op[70] = &AGOSEngine::oww_printLongText;
- op[83] = &AGOSEngine::oe1_rescan;
- op[88] = &AGOSEngine::o_haltAnimation;
- op[89] = &AGOSEngine::o_restartAnimation;
- op[98] = &AGOSEngine::os1_animate;
- op[99] = &AGOSEngine::oe1_stopAnimate;
- op[127] = &AGOSEngine::os1_playTune;
- op[135] = &AGOSEngine::os1_pauseGame;
- op[161] = &AGOSEngine::os1_screenTextBox;
- op[162] = &AGOSEngine::os1_screenTextMsg;
- op[163] = &AGOSEngine::os1_playEffect;
- op[164] = &AGOSEngine::oe2_getDollar2;
- op[165] = &AGOSEngine::oe2_isAdjNoun;
- op[166] = &AGOSEngine::oe2_b2Set;
- op[167] = &AGOSEngine::oe2_b2Clear;
- op[168] = &AGOSEngine::oe2_b2Zero;
- op[169] = &AGOSEngine::oe2_b2NotZero;
- op[175] = &AGOSEngine::oww_lockZones;
- op[176] = &AGOSEngine::oww_unlockZones;
- op[177] = &AGOSEngine::os1_screenTextPObj;
- op[178] = &AGOSEngine::os1_getPathPosn;
- op[179] = &AGOSEngine::os1_scnTxtLongText;
- op[180] = &AGOSEngine::os1_mouseOn;
- op[181] = &AGOSEngine::os1_mouseOff;
- op[182] = &AGOSEngine::os1_loadBeard;
- op[183] = &AGOSEngine::os1_unloadBeard;
- op[184] = &AGOSEngine::os1_unloadZone;
- op[185] = &AGOSEngine::os1_loadStrings;
- op[186] = &AGOSEngine::os1_unfreezeZones;
- op[187] = &AGOSEngine::os1_specialFade;
+#define OPCODE(x) _OPCODE(AGOSEngine_Simon1, x)
+
+void AGOSEngine_Simon1::setupOpcodes() {
+ static const OpcodeEntrySimon1 opcodes[] = {
+ /* 00 */
+ OPCODE(o_invalid),
+ OPCODE(o_at),
+ OPCODE(o_notAt),
+ OPCODE(o_invalid),
+ /* 04 */
+ OPCODE(o_invalid),
+ OPCODE(o_carried),
+ OPCODE(o_notCarried),
+ OPCODE(o_isAt),
+ /* 08 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_zero),
+ /* 12 */
+ OPCODE(o_notZero),
+ OPCODE(o_eq),
+ OPCODE(o_notEq),
+ OPCODE(o_gt),
+ /* 16 */
+ OPCODE(o_lt),
+ OPCODE(o_eqf),
+ OPCODE(o_notEqf),
+ OPCODE(o_ltf),
+ /* 20 */
+ OPCODE(o_gtf),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_chance),
+ /* 24 */
+ OPCODE(o_invalid),
+ OPCODE(o_isRoom),
+ OPCODE(o_isObject),
+ OPCODE(o_state),
+ /* 28 */
+ OPCODE(o_oflag),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_destroy),
+ /* 32 */
+ OPCODE(o_invalid),
+ OPCODE(o_place),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 36 */
+ OPCODE(o_copyff),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 40 */
+ OPCODE(o_invalid),
+ OPCODE(o_clear),
+ OPCODE(o_let),
+ OPCODE(o_add),
+ /* 44 */
+ OPCODE(o_sub),
+ OPCODE(o_addf),
+ OPCODE(o_subf),
+ OPCODE(o_mul),
+ /* 48 */
+ OPCODE(o_div),
+ OPCODE(o_mulf),
+ OPCODE(o_divf),
+ OPCODE(o_mod),
+ /* 52 */
+ OPCODE(o_modf),
+ OPCODE(o_random),
+ OPCODE(o_invalid),
+ OPCODE(o_goto),
+ /* 56 */
+ OPCODE(o_oset),
+ OPCODE(o_oclear),
+ OPCODE(o_putBy),
+ OPCODE(o_inc),
+ /* 60 */
+ OPCODE(o_dec),
+ OPCODE(o_setState),
+ OPCODE(o_print),
+ OPCODE(o_message),
+ /* 64 */
+ OPCODE(o_msg),
+ OPCODE(oww_addTextBox),
+ OPCODE(oww_setShortText),
+ OPCODE(oww_setLongText),
+ /* 68 */
+ OPCODE(o_end),
+ OPCODE(o_done),
+ OPCODE(oww_printLongText),
+ OPCODE(o_process),
+ /* 72 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 76 */
+ OPCODE(o_when),
+ OPCODE(o_if1),
+ OPCODE(o_if2),
+ OPCODE(o_isCalled),
+ /* 80 */
+ OPCODE(o_is),
+ OPCODE(o_invalid),
+ OPCODE(o_debug),
+ OPCODE(oe1_rescan),
+ /* 84 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_comment),
+ /* 88 */
+ OPCODE(o_haltAnimation),
+ OPCODE(o_restartAnimation),
+ OPCODE(o_getParent),
+ OPCODE(o_getNext),
+ /* 92 */
+ OPCODE(o_getChildren),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 96 */
+ OPCODE(o_picture),
+ OPCODE(o_loadZone),
+ OPCODE(os1_animate),
+ OPCODE(oe1_stopAnimate),
+ /* 100 */
+ OPCODE(o_killAnimate),
+ OPCODE(o_defWindow),
+ OPCODE(o_window),
+ OPCODE(o_cls),
+ /* 104 */
+ OPCODE(o_closeWindow),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_addBox),
+ /* 108 */
+ OPCODE(o_delBox),
+ OPCODE(o_enableBox),
+ OPCODE(o_disableBox),
+ OPCODE(o_moveBox),
+ /* 112 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_doIcons),
+ OPCODE(o_isClass),
+ /* 116 */
+ OPCODE(o_setClass),
+ OPCODE(o_unsetClass),
+ OPCODE(o_invalid),
+ OPCODE(o_waitSync),
+ /* 120 */
+ OPCODE(o_sync),
+ OPCODE(o_defObj),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 124 */
+ OPCODE(o_invalid),
+ OPCODE(o_here),
+ OPCODE(o_doClassIcons),
+ OPCODE(o_playTune),
+ /* 128 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_setAdjNoun),
+ OPCODE(o_invalid),
+ /* 132 */
+ OPCODE(o_saveUserGame),
+ OPCODE(o_loadUserGame),
+ OPCODE(o_invalid),
+ OPCODE(os1_pauseGame),
+ /* 136 */
+ OPCODE(o_copysf),
+ OPCODE(o_restoreIcons),
+ OPCODE(o_freezeZones),
+ OPCODE(o_placeNoIcons),
+ /* 140 */
+ OPCODE(o_clearTimers),
+ OPCODE(o_setDollar),
+ OPCODE(o_isBox),
+ OPCODE(oe2_doTable),
+ /* 144 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 148 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(oe2_storeItem),
+ /* 152 */
+ OPCODE(oe2_getItem),
+ OPCODE(oe2_bSet),
+ OPCODE(oe2_bClear),
+ OPCODE(oe2_bZero),
+ /* 156 */
+ OPCODE(oe2_bNotZero),
+ OPCODE(oe2_getOValue),
+ OPCODE(oe2_setOValue),
+ OPCODE(o_invalid),
+ /* 160 */
+ OPCODE(oe2_ink),
+ OPCODE(os1_screenTextBox),
+ OPCODE(os1_screenTextMsg),
+ OPCODE(os1_playEffect),
+ /* 164 */
+ OPCODE(oe2_getDollar2),
+ OPCODE(oe2_isAdjNoun),
+ OPCODE(oe2_b2Set),
+ OPCODE(oe2_b2Clear),
+ /* 168 */
+ OPCODE(oe2_b2Zero),
+ OPCODE(oe2_b2NotZero),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 172 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(oww_lockZones),
+ /* 176 */
+ OPCODE(oww_unlockZones),
+ OPCODE(os1_screenTextPObj),
+ OPCODE(os1_getPathPosn),
+ OPCODE(os1_scnTxtLongText),
+ /* 180 */
+ OPCODE(os1_mouseOn),
+ OPCODE(os1_mouseOff),
+ OPCODE(os1_loadBeard),
+ OPCODE(os1_unloadBeard),
+ /* 184 */
+ OPCODE(os1_unloadZone),
+ OPCODE(os1_loadStrings),
+ OPCODE(os1_unfreezeZones),
+ OPCODE(os1_specialFade),
+ };
+
+ _opcodesSimon1 = opcodes;
+ _numOpcodes = 188;
+}
+
+void AGOSEngine_Simon1::executeOpcode(int opcode) {
+ OpcodeProcSimon1 op = _opcodesSimon1[opcode].proc;
+ (this->*op) ();
}
// -----------------------------------------------------------------------
// Simon 1 Opcodes
// -----------------------------------------------------------------------
-void AGOSEngine::os1_animate() {
+void AGOSEngine_Simon1::os1_animate() {
// 98: animate
uint vgaSpriteId = getVarOrWord();
uint windowNum = getVarOrByte();
@@ -92,19 +304,7 @@ void AGOSEngine::os1_animate() {
_lockWord &= ~0x40;
}
-void AGOSEngine::os1_playTune() {
- // 127: play tune
- int music = getVarOrWord();
- int track = getVarOrWord();
-
- if (music != _lastMusicPlayed) {
- _lastMusicPlayed = music;
- loadMusic(music);
- _midi.startTrack(track);
- }
-}
-
-void AGOSEngine::os1_pauseGame() {
+void AGOSEngine_Simon1::os1_pauseGame() {
// 135: pause game
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
@@ -158,7 +358,7 @@ void AGOSEngine::os1_pauseGame() {
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
}
-void AGOSEngine::os1_screenTextBox() {
+void AGOSEngine_Simon1::os1_screenTextBox() {
// 161: setup text
TextLocation *tl = getTextLocation(getVarOrByte());
@@ -167,7 +367,7 @@ void AGOSEngine::os1_screenTextBox() {
tl->width = getVarOrWord();
}
-void AGOSEngine::os1_screenTextMsg() {
+void AGOSEngine_Simon1::os1_screenTextMsg() {
// 162: print string
uint vgaSpriteId = getVarOrByte();
uint color = getVarOrByte();
@@ -202,7 +402,7 @@ void AGOSEngine::os1_screenTextMsg() {
}
-void AGOSEngine::os1_playEffect() {
+void AGOSEngine_Simon1::os1_playEffect() {
// 163: play sound
uint soundId = getVarOrWord();
@@ -212,7 +412,7 @@ void AGOSEngine::os1_playEffect() {
_sound->playEffects(soundId);
}
-void AGOSEngine::os1_screenTextPObj() {
+void AGOSEngine_Simon1::os1_screenTextPObj() {
// 177: inventory descriptions
uint vgaSpriteId = getVarOrByte();
uint color = getVarOrByte();
@@ -253,7 +453,7 @@ void AGOSEngine::os1_screenTextPObj() {
}
}
-void AGOSEngine::os1_getPathPosn() {
+void AGOSEngine_Simon1::os1_getPathPosn() {
// 178: path find
uint x = getVarOrWord();
uint y = getVarOrWord();
@@ -302,7 +502,7 @@ void AGOSEngine::os1_getPathPosn() {
writeVariable(var_2, best_j);
}
-void AGOSEngine::os1_scnTxtLongText() {
+void AGOSEngine_Simon1::os1_scnTxtLongText() {
// 179: conversation responses and room descriptions
uint vgaSpriteId = getVarOrByte();
uint color = getVarOrByte();
@@ -324,17 +524,17 @@ void AGOSEngine::os1_scnTxtLongText() {
printScreenText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
}
-void AGOSEngine::os1_mouseOn() {
+void AGOSEngine_Simon1::os1_mouseOn() {
// 180: force mouseOn
_mouseHideCount = 0;
}
-void AGOSEngine::os1_mouseOff() {
+void AGOSEngine_Simon1::os1_mouseOff() {
// 181: force mouseOff
scriptMouseOff();
}
-void AGOSEngine::os1_loadBeard() {
+void AGOSEngine_Simon1::os1_loadBeard() {
// 182: load beard
if (_beardLoaded == false) {
_beardLoaded = true;
@@ -344,7 +544,7 @@ void AGOSEngine::os1_loadBeard() {
}
}
-void AGOSEngine::os1_unloadBeard() {
+void AGOSEngine_Simon1::os1_unloadBeard() {
// 183: unload beard
if (_beardLoaded == true) {
_beardLoaded = false;
@@ -354,7 +554,7 @@ void AGOSEngine::os1_unloadBeard() {
}
}
-void AGOSEngine::os1_unloadZone() {
+void AGOSEngine_Simon1::os1_unloadZone() {
// 184: unload zone
uint a = getVarOrWord();
VgaPointersEntry *vpe = &_vgaBufferPointers[a];
@@ -364,7 +564,7 @@ void AGOSEngine::os1_unloadZone() {
vpe->vgaFile2 = NULL;
}
-void AGOSEngine::os1_loadStrings() {
+void AGOSEngine_Simon1::os1_loadStrings() {
// 185: load sound files
_soundFileId = getVarOrWord();
if (getPlatform() == Common::kPlatformAmiga && getFeatures() & GF_TALKIE) {
@@ -376,12 +576,12 @@ void AGOSEngine::os1_loadStrings() {
}
}
-void AGOSEngine::os1_unfreezeZones() {
+void AGOSEngine_Simon1::os1_unfreezeZones() {
// 186: freeze zone
unfreezeBottom();
}
-void AGOSEngine::os1_specialFade() {
+void AGOSEngine_Simon1::os1_specialFade() {
// 187: fade to black
uint i;