aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2008-05-03 20:02:51 +0000
committerJohannes Schickel2008-05-03 20:02:51 +0000
commit7e3ce73a584b04bbe18832c2f7f1dac1e30d98b6 (patch)
treef4f684e1adae92daf0e9edecec7ddc42fdde8639
parentf6239f1db645c86fb4f072f7e901ac30c75f71a0 (diff)
downloadscummvm-rg350-7e3ce73a584b04bbe18832c2f7f1dac1e30d98b6.tar.gz
scummvm-rg350-7e3ce73a584b04bbe18832c2f7f1dac1e30d98b6.tar.bz2
scummvm-rg350-7e3ce73a584b04bbe18832c2f7f1dac1e30d98b6.zip
Moved more opcodes to KyraEngine_v2.
svn-id: r31845
-rw-r--r--engines/kyra/kyra_hof.h6
-rw-r--r--engines/kyra/kyra_mr.h6
-rw-r--r--engines/kyra/kyra_v2.h6
-rw-r--r--engines/kyra/script_hof.cpp99
-rw-r--r--engines/kyra/script_mr.cpp112
-rw-r--r--engines/kyra/script_v2.cpp94
6 files changed, 110 insertions, 213 deletions
diff --git a/engines/kyra/kyra_hof.h b/engines/kyra/kyra_hof.h
index 6e1656e638..1b49d42004 100644
--- a/engines/kyra/kyra_hof.h
+++ b/engines/kyra/kyra_hof.h
@@ -740,7 +740,6 @@ protected:
int o2_getTimerDelay(EMCState *script);
//int o2_playSoundEffect(EMCState *script);
int o2_delaySecs(EMCState *script);
- int o2_delay(EMCState *script);
int o2_setTimerDelay(EMCState *script);
int o2_setScaleTableItem(EMCState *script);
int o2_setDrawLayerTableItem(EMCState *script);
@@ -758,7 +757,6 @@ protected:
int o2_enableSceneAnim(EMCState *script);
int o2_restoreInventoryGfx(EMCState *script);
int o2_setSceneAnimPos2(EMCState *script);
- int o2_update(EMCState *script);
int o2_fadeScenePal(EMCState *script);
int o2_enterNewSceneEx(EMCState *script);
int o2_switchScene(EMCState *script);
@@ -775,14 +773,11 @@ protected:
int o2_blockOutRegion(EMCState *script);
int o2_setCauldronState(EMCState *script);
int o2_showItemString(EMCState *script);
- int o2_getRand(EMCState *script);
int o2_isAnySoundPlaying(EMCState *script);
- int o2_setDeathHandlerFlag(EMCState *script);
int o2_setDrawNoShapeFlag(EMCState *script);
int o2_setRunFlag(EMCState *script);
int o2_showLetter(EMCState *script);
int o2_fillRect(EMCState *script);
- int o2_waitForConfirmationClick(EMCState *script);
int o2_encodeShape(EMCState *script);
int o2_defineSceneAnim(EMCState *script);
int o2_updateSceneAnim(EMCState *script);
@@ -792,7 +787,6 @@ protected:
int o2_zanthRandomChat(EMCState *script);
int o2_setupDialogue(EMCState *script);
int o2_getDlgIndex(EMCState *script);
- int o2_defineRoom(EMCState *script);
int o2_addCauldronStateTableEntry(EMCState *script);
int o2_setCountDown(EMCState *script);
int o2_getCountDown(EMCState *script);
diff --git a/engines/kyra/kyra_mr.h b/engines/kyra/kyra_mr.h
index 33755870ba..028208ae6f 100644
--- a/engines/kyra/kyra_mr.h
+++ b/engines/kyra/kyra_mr.h
@@ -528,7 +528,6 @@ private:
int o3_badConscienceChat(EMCState *script);
int o3_wipeDownMouseItem(EMCState *script);
int o3_setMalcolmsMood(EMCState *script);
- int o3_delay(EMCState *script);
int o3_updateScore(EMCState *script);
int o3_makeSecondChanceSave(EMCState *script);
int o3_setSceneFilename(EMCState *script);
@@ -539,7 +538,6 @@ private:
int o3_checkInRect(EMCState *script);
int o3_updateConversations(EMCState *script);
int o3_setSceneDim(EMCState *script);
- int o3_update(EMCState *script);
int o3_setSceneAnimPosAndFrame(EMCState *script);
int o3_removeItemInstances(EMCState *script);
int o3_disableInventory(EMCState *script);
@@ -554,12 +552,9 @@ private:
int o3_getScore(EMCState *script);
int o3_blockOutRegion(EMCState *script);
int o3_showSceneStringsMessage(EMCState *script);
- int o3_getRand(EMCState *script);
- int o3_setDeathHandler(EMCState *script);
int o3_showGoodConscience(EMCState *script);
int o3_goodConscienceChat(EMCState *script);
int o3_hideGoodConscience(EMCState *script);
- int o3_waitForConfirmationClick(EMCState *script);
int o3_defineSceneAnim(EMCState *script);
int o3_updateSceneAnim(EMCState *script);
int o3_runActorScript(EMCState *script);
@@ -567,7 +562,6 @@ private:
int o3_malcolmRandomChat(EMCState *script);
int o3_setDlgIndex(EMCState *script);
int o3_getDlgIndex(EMCState *script);
- int o3_defineScene(EMCState *script);
int o3_setConversationState(EMCState *script);
int o3_getConversationState(EMCState *script);
int o3_changeChapter(EMCState *script);
diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h
index 265c4dcfbe..3f68c71ae7 100644
--- a/engines/kyra/kyra_v2.h
+++ b/engines/kyra/kyra_v2.h
@@ -369,9 +369,15 @@ protected:
int o2_addSpecialExit(EMCState *script);
int o2_setMousePos(EMCState *script);
int o2_showMouse(EMCState *script);
+ int o2_delay(EMCState *script);
+ int o2_update(EMCState *script);
+ int o2_getRand(EMCState *script);
+ int o2_setDeathHandler(EMCState *script);
+ int o2_waitForConfirmationClick(EMCState *script);
int o2_defineRoomEntrance(EMCState *script);
int o2_runAnimationScript(EMCState *script);
int o2_setSpecialSceneScriptRunTime(EMCState *script);
+ int o2_defineScene(EMCState *script);
int o2_setSpecialSceneScriptState(EMCState *script);
int o2_clearSpecialSceneScriptState(EMCState *script);
int o2_querySpecialSceneScriptState(EMCState *script);
diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp
index e276eb2a55..a0f278ef4c 100644
--- a/engines/kyra/script_hof.cpp
+++ b/engines/kyra/script_hof.cpp
@@ -519,29 +519,6 @@ int KyraEngine_HoF::o2_delaySecs(EMCState *script) {
return 0;
}
-int KyraEngine_HoF::o2_delay(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_delay(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
- if (stackPos(1)) {
- uint32 maxWaitTime = _system->getMillis() + stackPos(0) * _tickLength;
- while (_system->getMillis() < maxWaitTime) {
- int inputFlag = checkInput(0);
- removeInputTop();
-
- if (inputFlag == 198 || inputFlag == 199)
- return 1;
-
- if (_chatText)
- updateWithText();
- else
- update();
- _system->delayMillis(10);
- }
- } else {
- delay(stackPos(0) * _tickLength, true);
- }
- return 0;
-}
-
int KyraEngine_HoF::o2_setTimerDelay(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_setTimerDelay(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
_timer->setDelay(stackPos(0), stackPos(1));
@@ -687,20 +664,6 @@ int KyraEngine_HoF::o2_setSceneAnimPos2(EMCState *script) {
return 0;
}
-int KyraEngine_HoF::o2_update(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_update(%p) (%d)", (const void *)script, stackPos(0));
-
- int times = stackPos(0);
- while (times--) {
- if (_chatText)
- updateWithText();
- else
- update();
- }
-
- return 0;
-}
-
int KyraEngine_HoF::o2_fadeScenePal(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_fadeScenePal(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
fadeScenePal(stackPos(0), stackPos(1));
@@ -851,23 +814,11 @@ int KyraEngine_HoF::o2_showItemString(EMCState *script) {
return 0;
}
-int KyraEngine_HoF::o2_getRand(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_getRand(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
- assert(stackPos(0) < stackPos(1));
- return _rnd.getRandomNumberRng(stackPos(0), stackPos(1));
-}
-
int KyraEngine_HoF::o2_isAnySoundPlaying(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_isAnySoundPlaying(%p) ()", (const void *)script);
return _sound->voiceIsPlaying();
}
-int KyraEngine_HoF::o2_setDeathHandlerFlag(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_setDeathHandlerFlag(%p) (%d)", (const void *)script, stackPos(0));
- _deathHandler = stackPos(0);
- return 0;
-}
-
int KyraEngine_HoF::o2_setDrawNoShapeFlag(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_setDrawNoShapeFlag(%p) (%d)", (const void *)script, stackPos(0));
_drawNoShapeFlag = (stackPos(0) != 0);
@@ -949,30 +900,6 @@ int KyraEngine_HoF::o2_fillRect(EMCState *script) {
return 0;
}
-int KyraEngine_HoF::o2_waitForConfirmationClick(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_waitForConfirmationClick(%p) (%d)", (const void *)script, stackPos(0));
- resetSkipFlag();
- uint32 maxWaitTime = _system->getMillis() + stackPos(0) * _tickLength;
-
- while (_system->getMillis() < maxWaitTime) {
- int inputFlag = checkInput(0);
- removeInputTop();
-
- if (inputFlag == 198 || inputFlag == 199) {
- _sceneScriptState.regs[1] = _mouseX;
- _sceneScriptState.regs[2] = _mouseY;
- return 0;
- }
-
- update();
- _system->delayMillis(10);
- }
-
- _sceneScriptState.regs[1] = _mouseX;
- _sceneScriptState.regs[2] = _mouseY;
- return 1;
-}
-
int KyraEngine_HoF::o2_encodeShape(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_encodeShape(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1),
stackPos(2), stackPos(3), stackPos(4));
@@ -1090,28 +1017,6 @@ int KyraEngine_HoF::o2_getDlgIndex(EMCState *script) {
return _mainCharacter.dlgIndex;
}
-int KyraEngine_HoF::o2_defineRoom(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_defineRoom(%p) (%d, '%s', %d, %d, %d, %d, %d, %d)", (const void *)script,
- stackPos(0), stackPosString(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7));
- SceneDesc *scene = &_sceneList[stackPos(0)];
- strcpy(scene->filename1, stackPosString(1));
- scene->exit1 = stackPos(2);
- scene->exit2 = stackPos(3);
- scene->exit3 = stackPos(4);
- scene->exit4 = stackPos(5);
- scene->flags = stackPos(6);
- scene->sound = stackPos(7);
-
- if (_mainCharacter.sceneId == stackPos(0)) {
- _sceneExit1 = scene->exit1;
- _sceneExit2 = scene->exit2;
- _sceneExit3 = scene->exit3;
- _sceneExit4 = scene->exit4;
- }
-
- return 0;
-}
-
int KyraEngine_HoF::o2_addCauldronStateTableEntry(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_addCauldronStateTableEntry(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
return addToCauldronStateTable(stackPos(0), stackPos(1)) ? 1 : 0;
@@ -1773,7 +1678,7 @@ void KyraEngine_HoF::setupOpcodeTable() {
// 0x60
Opcode(o2_getRand);
Opcode(o2_isAnySoundPlaying);
- Opcode(o2_setDeathHandlerFlag);
+ Opcode(o2_setDeathHandler);
Opcode(o2_setDrawNoShapeFlag);
// 0x64
Opcode(o2_setRunFlag);
@@ -1802,7 +1707,7 @@ void KyraEngine_HoF::setupOpcodeTable() {
Opcode(o2_setupDialogue);
// 0x78
Opcode(o2_getDlgIndex);
- Opcode(o2_defineRoom);
+ Opcode(o2_defineScene);
Opcode(o2_addCauldronStateTableEntry);
Opcode(o2_setCountDown);
// 0x7c
diff --git a/engines/kyra/script_mr.cpp b/engines/kyra/script_mr.cpp
index 98e8c2a7a5..f7063999a8 100644
--- a/engines/kyra/script_mr.cpp
+++ b/engines/kyra/script_mr.cpp
@@ -304,29 +304,6 @@ int KyraEngine_MR::o3_setMalcolmsMood(EMCState *script) {
return (_malcolmsMood = stackPos(0));
}
-int KyraEngine_MR::o3_delay(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_delay(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
- if (stackPos(1)) {
- uint32 maxWaitTime = _system->getMillis() + stackPos(0) * _tickLength;
- while (_system->getMillis() < maxWaitTime) {
- int inputFlag = checkInput(0);
- removeInputTop();
-
- if (inputFlag == 198 || inputFlag == 199)
- return 1;
-
- if (_chatText)
- updateWithText();
- else
- update();
- _system->delayMillis(10);
- }
- } else {
- delay(stackPos(0) * _tickLength, true);
- }
- return 0;
-}
-
int KyraEngine_MR::o3_updateScore(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_updateScore(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
return updateScore(stackPos(0), stackPos(1)) ? 1 : 0;
@@ -671,17 +648,6 @@ int KyraEngine_MR::o3_setSceneAnimPosAndFrame(EMCState *script) {
return 0;
}
-int KyraEngine_MR::o3_update(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_update(%p) (%d)", (const void *)script, stackPos(0));
- for (int times = stackPos(0); times != 0; --times) {
- if (_chatText)
- updateWithText();
- else
- update();
- }
- return 0;
-}
-
int KyraEngine_MR::o3_removeItemInstances(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_removeItemInstances(%p) (%d)", (const void *)script, stackPos(0));
const int16 item = stackPos(0);
@@ -814,18 +780,6 @@ int KyraEngine_MR::o3_showSceneStringsMessage(EMCState *script) {
return 0;
}
-int KyraEngine_MR::o3_getRand(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_getRand(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
- assert(stackPos(0) < stackPos(1));
- return _rnd.getRandomNumberRng(stackPos(0), stackPos(1));
-}
-
-int KyraEngine_MR::o3_setDeathHandler(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setDeathHandler(%p) (%d)", (const void *)script, stackPos(0));
- _deathHandler = stackPos(0);
- return 0;
-}
-
int KyraEngine_MR::o3_showGoodConscience(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_showGoodConscience(%p) ()", (const void *)script);
showGoodConscience();
@@ -846,30 +800,6 @@ int KyraEngine_MR::o3_hideGoodConscience(EMCState *script) {
return 0;
}
-int KyraEngine_MR::o3_waitForConfirmationClick(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o2_waitForConfirmationClick(%p) (%d)", (const void *)script, stackPos(0));
- resetSkipFlag();
- uint32 maxWaitTime = _system->getMillis() + stackPos(0) * _tickLength;
-
- while (_system->getMillis() < maxWaitTime) {
- int inputFlag = checkInput(0);
- removeInputTop();
-
- if (inputFlag == 198 || inputFlag == 199) {
- _sceneScriptState.regs[1] = _mouseX;
- _sceneScriptState.regs[2] = _mouseY;
- return 0;
- }
-
- update();
- _system->delayMillis(10);
- }
-
- _sceneScriptState.regs[1] = _mouseX;
- _sceneScriptState.regs[2] = _mouseY;
- return 1;
-}
-
int KyraEngine_MR::o3_defineSceneAnim(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_defineSceneAnim(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, '%s')",
(const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7),
@@ -989,32 +919,6 @@ int KyraEngine_MR::o3_getDlgIndex(EMCState *script) {
return _mainCharacter.dlgIndex;
}
-int KyraEngine_MR::o3_defineScene(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_defineScene(%p) (%d, '%s', %d, %d, %d, %d, %d, %d)",
- (const void *)script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7));
- const int scene = stackPos(0);
- strcpy(_sceneList[scene].filename1, stackPosString(1));
- _sceneList[scene].filename1[9] = 0;
- strcpy(_sceneList[scene].filename2, stackPosString(1));
- _sceneList[scene].filename2[9] = 0;
-
- _sceneList[scene].exit1 = stackPos(2);
- _sceneList[scene].exit2 = stackPos(3);
- _sceneList[scene].exit3 = stackPos(4);
- _sceneList[scene].exit4 = stackPos(5);
- _sceneList[scene].flags = stackPos(6);
- _sceneList[scene].sound = stackPos(7);
-
- if (_mainCharacter.sceneId == scene) {
- _sceneExit1 = _sceneList[scene].exit1;
- _sceneExit2 = _sceneList[scene].exit2;
- _sceneExit3 = _sceneList[scene].exit3;
- _sceneExit4 = _sceneList[scene].exit4;
- }
-
- return 0;
-}
-
int KyraEngine_MR::o3_setConversationState(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setConversationState(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
int id = stackPos(0);
@@ -1288,7 +1192,7 @@ void KyraEngine_MR::setupOpcodeTable() {
Opcode(o3_setMalcolmsMood);
Opcode(o3_playSoundEffect);
Opcode(o3_dummy);
- Opcode(o3_delay);
+ Opcode(o2_delay);
// 0x38
Opcode(o3_updateScore);
Opcode(o3_makeSecondChanceSave);
@@ -1313,7 +1217,7 @@ void KyraEngine_MR::setupOpcodeTable() {
Opcode(o3_dummy);
Opcode(o3_dummy);
Opcode(o3_setSceneAnimPosAndFrame);
- Opcode(o3_update);
+ Opcode(o2_update);
// 0x4c
Opcode(o3_removeItemInstances);
Opcode(o3_dummy);
@@ -1340,9 +1244,9 @@ void KyraEngine_MR::setupOpcodeTable() {
Opcode(o3_showSceneStringsMessage);
OpcodeUnImpl();
// 0x60
- Opcode(o3_getRand);
+ Opcode(o2_getRand);
Opcode(o3_dummy);
- Opcode(o3_setDeathHandler);
+ Opcode(o2_setDeathHandler);
Opcode(o3_showGoodConscience);
// 0x64
Opcode(o3_goodConscienceChat);
@@ -1353,7 +1257,7 @@ void KyraEngine_MR::setupOpcodeTable() {
Opcode(o3_dummy);
Opcode(o3_dummy);
Opcode(o3_dummy);
- Opcode(o3_waitForConfirmationClick);
+ Opcode(o2_waitForConfirmationClick);
// 0x6c
Opcode(o3_dummy);
Opcode(o2_defineRoomEntrance);
@@ -1371,7 +1275,7 @@ void KyraEngine_MR::setupOpcodeTable() {
Opcode(o3_setDlgIndex);
// 0x78
Opcode(o3_getDlgIndex);
- Opcode(o3_defineScene);
+ Opcode(o2_defineScene);
Opcode(o3_setConversationState);
OpcodeUnImpl();
// 0x7c
@@ -1448,7 +1352,7 @@ void KyraEngine_MR::setupOpcodeTable() {
Opcode(o3_dummy);
// 0x0a
Opcode(o2a_setResetFrame);
- Opcode(o3_getRand);
+ Opcode(o2_getRand);
Opcode(o3_getMalcolmShapes);
Opcode(o3_dummy);
@@ -1456,7 +1360,7 @@ void KyraEngine_MR::setupOpcodeTable() {
// 0x00
Opcode(o3d_updateAnim);
Opcode(o3d_delay);
- Opcode(o3_getRand);
+ Opcode(o2_getRand);
Opcode(o2_queryGameFlag);
// 0x04
Opcode(o3_dummy);
diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp
index 10504b2b1e..2f16a23731 100644
--- a/engines/kyra/script_v2.cpp
+++ b/engines/kyra/script_v2.cpp
@@ -140,6 +140,76 @@ int KyraEngine_v2::o2_showMouse(EMCState *script) {
return 0;
}
+int KyraEngine_v2::o2_delay(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_delay(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+ if (stackPos(1)) {
+ uint32 maxWaitTime = _system->getMillis() + stackPos(0) * _tickLength;
+ while (_system->getMillis() < maxWaitTime) {
+ int inputFlag = checkInput(0);
+ removeInputTop();
+
+ if (inputFlag == 198 || inputFlag == 199)
+ return 1;
+
+ if (_chatText)
+ updateWithText();
+ else
+ update();
+ _system->delayMillis(10);
+ }
+ } else {
+ delay(stackPos(0) * _tickLength, true);
+ }
+ return 0;
+}
+
+int KyraEngine_v2::o2_update(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_update(%p) (%d)", (const void *)script, stackPos(0));
+ for (int times = stackPos(0); times != 0; --times) {
+ if (_chatText)
+ updateWithText();
+ else
+ update();
+ }
+ return 0;
+}
+
+int KyraEngine_v2::o2_getRand(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getRand(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+ assert(stackPos(0) < stackPos(1));
+ return _rnd.getRandomNumberRng(stackPos(0), stackPos(1));
+}
+
+int KyraEngine_v2::o2_setDeathHandler(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setDeathHandler(%p) (%d)", (const void *)script, stackPos(0));
+ _deathHandler = stackPos(0);
+ return 0;
+}
+
+int KyraEngine_v2::o2_waitForConfirmationClick(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_waitForConfirmationClick(%p) (%d)", (const void *)script, stackPos(0));
+ resetSkipFlag();
+ uint32 maxWaitTime = _system->getMillis() + stackPos(0) * _tickLength;
+
+ while (_system->getMillis() < maxWaitTime) {
+ int inputFlag = checkInput(0);
+ removeInputTop();
+
+ if (inputFlag == 198 || inputFlag == 199) {
+ _sceneScriptState.regs[1] = _mouseX;
+ _sceneScriptState.regs[2] = _mouseY;
+ return 0;
+ }
+
+ update();
+ _system->delayMillis(10);
+ }
+
+ _sceneScriptState.regs[1] = _mouseX;
+ _sceneScriptState.regs[2] = _mouseY;
+ return 1;
+}
+
int KyraEngine_v2::o2_defineRoomEntrance(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_defineRoomEntrance(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
switch (stackPos(0)) {
@@ -184,6 +254,30 @@ int KyraEngine_v2::o2_setSpecialSceneScriptRunTime(EMCState *script) {
return 0;
}
+int KyraEngine_v2::o2_defineScene(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_defineScene(%p) (%d, '%s', %d, %d, %d, %d, %d, %d)",
+ (const void *)script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7));
+ const int scene = stackPos(0);
+ strcpy(_sceneList[scene].filename1, stackPosString(1));
+ strcpy(_sceneList[scene].filename2, stackPosString(1));
+
+ _sceneList[scene].exit1 = stackPos(2);
+ _sceneList[scene].exit2 = stackPos(3);
+ _sceneList[scene].exit3 = stackPos(4);
+ _sceneList[scene].exit4 = stackPos(5);
+ _sceneList[scene].flags = stackPos(6);
+ _sceneList[scene].sound = stackPos(7);
+
+ if (_mainCharacter.sceneId == scene) {
+ _sceneExit1 = _sceneList[scene].exit1;
+ _sceneExit2 = _sceneList[scene].exit2;
+ _sceneExit3 = _sceneList[scene].exit3;
+ _sceneExit4 = _sceneList[scene].exit4;
+ }
+
+ return 0;
+}
+
int KyraEngine_v2::o2_setSpecialSceneScriptState(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setSpecialSceneScriptState(%p) (%d)", (const void *)script, stackPos(0));
_specialSceneScriptState[stackPos(0)] = 1;