From 83dbcf8531c7703e3024a45e76c3794fa2327b79 Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Mon, 1 Jun 2009 01:24:17 +0000 Subject: [PATCH] LOL: some more opcodes and some minor bug fixes svn-id: r41092 --- engines/kyra/lol.h | 1 + engines/kyra/script_lol.cpp | 8 +++++++- engines/kyra/script_v1.cpp | 7 +++++-- engines/kyra/sound_lol.cpp | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 2bd33b38bcc..79fecfbd9a9 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -773,6 +773,7 @@ private: int olol_paletteFlash(EMCState *script); int olol_disableControls(EMCState *script); int olol_enableControls(EMCState *script); + int olol_shakeScene(EMCState *script); int olol_gasExplosion(EMCState *script); int olol_calcNewBlockPosition(EMCState *script); int olol_fadeScene(EMCState *script); diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index dbbafc3a541..ba0b5f4643f 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -2067,6 +2067,12 @@ int LoLEngine::olol_enableControls(EMCState *script) { return gui_enableControls(); } +int LoLEngine::olol_shakeScene(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_shakeScene(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); + shakeScene(stackPos(0), stackPos(1), stackPos(2), 1); + return 1; +} + int LoLEngine::olol_gasExplosion(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_gasExplosion(%p) (%d)", (const void *)script, stackPos(0)); processGasExplosion(stackPos(0)); @@ -2738,7 +2744,7 @@ void LoLEngine::setupOpcodeTable() { // 0xB4 Opcode(olol_enableControls); - OpcodeUnImpl(); + Opcode(olol_shakeScene); Opcode(olol_gasExplosion); Opcode(olol_calcNewBlockPosition); diff --git a/engines/kyra/script_v1.cpp b/engines/kyra/script_v1.cpp index f74c7e3560d..0f36d5d12b1 100644 --- a/engines/kyra/script_v1.cpp +++ b/engines/kyra/script_v1.cpp @@ -45,8 +45,11 @@ int KyraEngine_v1::o1_resetGameFlag(EMCState *script) { int KyraEngine_v1::o1_getRand(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getRand(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); - assert(stackPos(0) < stackPos(1)); - return _rnd.getRandomNumberRng(stackPos(0), stackPos(1)); + int min = stackPos(0); + int max = stackPos(1); + if (max < min) + SWAP(min, max); + return _rnd.getRandomNumberRng(min, max); } int KyraEngine_v1::o1_hideMouse(EMCState *script) { diff --git a/engines/kyra/sound_lol.cpp b/engines/kyra/sound_lol.cpp index 4247596399e..a14df2090a1 100644 --- a/engines/kyra/sound_lol.cpp +++ b/engines/kyra/sound_lol.cpp @@ -79,7 +79,7 @@ bool LoLEngine::snd_playCharacterSpeech(int id, int8 speaker, int) { snprintf(file2, sizeof(file2), "%s%c%c.%s", pattern1, '_', symbol, pattern2); if (_sound->isVoicePresent(file1)) newSpeechList.push_back(_sound->getVoiceStream(file1)); - if (_sound->isVoicePresent(file2)) + else if (_sound->isVoicePresent(file2)) newSpeechList.push_back(_sound->getVoiceStream(file2)); else break;