aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/kyra/kyra_v2.h6
-rw-r--r--engines/kyra/script_v2.cpp76
-rw-r--r--engines/kyra/staticres.cpp12
3 files changed, 90 insertions, 4 deletions
diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h
index 7a1c3e7044..5f83846382 100644
--- a/engines/kyra/kyra_v2.h
+++ b/engines/kyra/kyra_v2.h
@@ -1031,11 +1031,13 @@ protected:
int o2_blockInRegion(ScriptState *script);
int o2_blockOutRegion(ScriptState *script);
int o2_setCauldronState(ScriptState *script);
+ int o2_showPickUpString(ScriptState *script);
int o2_getRand(ScriptState *script);
int o2_setDeathHandlerFlag(ScriptState *script);
int o2_setDrawNoShapeFlag(ScriptState *script);
int o2_showLetter(ScriptState *script);
int o2_fillRect(ScriptState *script);
+ int o2_waitForConfirmationClick(ScriptState *script);
int o2_encodeShape(ScriptState *script);
int o2_defineRoomEntrance(ScriptState *script);
int o2_runTemporaryScript(ScriptState *script);
@@ -1083,6 +1085,8 @@ protected:
int o2_setTimerCountdown(ScriptState *script);
int o2_processPaletteIndex(ScriptState *script);
int o2_updateTwoSceneAnims(ScriptState *script);
+ int o2_getRainbowRoomData(ScriptState *script);
+ int o2_drawSceneShapeEx(ScriptState *script);
int o2_getBoolFromStack(ScriptState *script);
int o2_setVocHigh(ScriptState *script);
int o2_getVocHigh(ScriptState *script);
@@ -1187,6 +1191,8 @@ protected:
Sequence *_sequences;
NestedSequence *_nSequences;
+ static const uint8 _rainbowRoomData[];
+
// color code related vars
int _colorCodeFlag1;
int _colorCodeFlag2;
diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp
index beedeb41b0..b7a5965aa0 100644
--- a/engines/kyra/script_v2.cpp
+++ b/engines/kyra/script_v2.cpp
@@ -857,6 +857,27 @@ int KyraEngine_v2::o2_setCauldronState(ScriptState *script) {
return 0;
}
+int KyraEngine_v2::o2_showPickUpString(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_showPickUpString(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+ const int item = stackPos(0);
+
+ int string = 0;
+ if (stackPos(1) == 1) {
+ if (_lang == 1)
+ string = getItemCommandStringPickUp(item);
+ else
+ string = 7;
+ } else {
+ if (_lang == 1)
+ string = getItemCommandStringInv(item);
+ else
+ string = 8;
+ }
+
+ updateCommandLineEx(item+54, string, 0xD6);
+ return 0;
+}
+
int KyraEngine_v2::o2_getRand(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getRand(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
assert(stackPos(0) < stackPos(1));
@@ -941,6 +962,30 @@ int KyraEngine_v2::o2_fillRect(ScriptState *script) {
return 0;
}
+int KyraEngine_v2::o2_waitForConfirmationClick(ScriptState *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_encodeShape(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_encodeShape(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1),
stackPos(2), stackPos(3), stackPos(4));
@@ -1489,6 +1534,29 @@ int KyraEngine_v2::o2_updateTwoSceneAnims(ScriptState *script) {
return 0;
}
+int KyraEngine_v2::o2_getRainbowRoomData(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getRainbowRoomData(%p) (%d)", (const void *)script, stackPos(0));
+ return _rainbowRoomData[stackPos(0)];
+}
+
+int KyraEngine_v2::o2_drawSceneShapeEx(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_drawSceneShapeEx(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3));
+ const int itemShape = stackPos(0) + 64;
+ const int x = stackPos(1);
+ const int y = stackPos(2);
+ const bool skipFronUpdate = (stackPos(3) != 0);
+
+ _screen->drawShape(2, _sceneShapeTable[6], x, y, 2, 0);
+ _screen->drawShape(2, getShapePtr(itemShape), x+2, y+2, 2, 0);
+
+ if (!skipFronUpdate) {
+ _screen->copyRegion(x, y, x, y, 0x15, 0x14, 2, 0, Screen::CR_NO_P_CHECK);
+ _screen->updateScreen();
+ }
+
+ return 0;
+}
+
int KyraEngine_v2::o2_getBoolFromStack(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getBoolFromStack(%p) ()", (const void *)script);
return stackPos(0) ? 1 : 0;
@@ -1707,7 +1775,7 @@ void KyraEngine_v2::setupOpcodeTable() {
Opcode(o2_blockOutRegion),
OpcodeUnImpl(),
Opcode(o2_setCauldronState),
- OpcodeUnImpl(),
+ Opcode(o2_showPickUpString),
// 0x60
Opcode(o2_getRand),
OpcodeUnImpl(),
@@ -1722,7 +1790,7 @@ void KyraEngine_v2::setupOpcodeTable() {
OpcodeUnImpl(),
OpcodeUnImpl(),
OpcodeUnImpl(),
- OpcodeUnImpl(),
+ Opcode(o2_waitForConfirmationClick),
// 0x6c
Opcode(o2_encodeShape),
Opcode(o2_defineRoomEntrance),
@@ -1790,8 +1858,8 @@ void KyraEngine_v2::setupOpcodeTable() {
Opcode(o2_processPaletteIndex),
// 0xa0
Opcode(o2_updateTwoSceneAnims),
- OpcodeUnImpl(),
- OpcodeUnImpl(),
+ Opcode(o2_getRainbowRoomData),
+ Opcode(o2_drawSceneShapeEx),
Opcode(o2_getBoolFromStack),
// 0xa4
OpcodeUnImpl(),
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index dea7fe24b8..71c13cc932 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -1600,6 +1600,18 @@ const int16 KyraEngine_v2::_flaskTable[] = {
0x1B, 0x39, 0x1A, 0x3A, 0x4D, 0x72, -1
};
+const uint8 KyraEngine_v2::_rainbowRoomData[] = {
+ 0x02, 0xA9, 0x9E, 0x75, 0x73, 0x17, 0x00, 0xA0,
+ 0x08, 0x01, 0x19, 0x9F, 0x66, 0x05, 0x22, 0x7D,
+ 0x20, 0x25, 0x1D, 0x64, 0xA0, 0x78, 0x85, 0x3B,
+ 0x3C, 0x5E, 0x38, 0x45, 0x8F, 0x61, 0xA1, 0x71,
+ 0x47, 0x77, 0x86, 0x41, 0xA2, 0x5F, 0x03, 0x72,
+ 0x83, 0x9E, 0x84, 0x8E, 0xAD, 0xA8, 0x04, 0x79,
+ 0xAA, 0xA3, 0x06, 0x27, 0x8F, 0x9F, 0x0A, 0x76,
+ 0x46, 0x1E, 0x24, 0x63, 0x18, 0x69, 0x39, 0x1F,
+ 0x7E, 0xAD, 0x28, 0x60, 0x67, 0x21, 0x84, 0x34
+};
+
// kyra 3 static res
const char *KyraEngine_v3::_soundList[] = {