From 6d59856fe1c2302a5e163f3b4799c94a721e102d Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Sun, 7 Jun 2009 13:07:16 +0000 Subject: LOL: implemented two more opcodes for castle cimmeria svn-id: r41336 --- engines/kyra/lol.h | 2 ++ engines/kyra/script_lol.cpp | 35 +++++++++++++++++++++++++++++++++-- engines/kyra/sequences_lol.cpp | 7 ++++++- engines/kyra/sound_lol.cpp | 4 ++-- 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index a26af64b05..1c7c9df18d 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -714,6 +714,7 @@ private: int olol_getWallFlags(EMCState *script); int olol_changeMonsterStat(EMCState *script); int olol_getMonsterStat(EMCState *script); + int olol_releaseMonsterShapes(EMCState *script); int olol_playCharacterScriptChat(EMCState *script); int olol_playEnvironmentalSfx(EMCState *script); int olol_update(EMCState *script); @@ -724,6 +725,7 @@ private: int olol_countBlockItems(EMCState *script); int olol_characterSkillTest(EMCState *script); int olol_countAllMonsters(EMCState *script); + int olol_playEndSequence(EMCState *script); int olol_stopCharacterSpeech(EMCState *script); int olol_setPaletteBrightness(EMCState *script); int olol_calcInflictableDamage(EMCState *script); diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 549b88773d..56cfb9110f 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -1280,6 +1280,13 @@ int LoLEngine::olol_getMonsterStat(EMCState *script) { return 0; } +int LoLEngine::olol_releaseMonsterShapes(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_releaseMonsterShapes(%p)", (const void *)script); + for (int i = 0; i < 3; i++) + releaseMonsterShapes(i); + return 0; +} + int LoLEngine::olol_playCharacterScriptChat(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_playCharacterScriptChat(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); snd_stopSpeech(1); @@ -1392,6 +1399,30 @@ int LoLEngine::olol_countAllMonsters(EMCState *script){ return res; } +int LoLEngine::olol_playEndSequence(EMCState *script){ + debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_playEndSequence(%p)", (const void *)script); + + int c = 0; + if (_characters[0].id == -9) + c = 1; + else if (_characters[0].id == -5) + c = 3; + else if (_characters[0].id == -1) + c = 2; + + while (snd_updateCharacterSpeech()) + delay(_tickLength); + + _eventList.clear(); + _screen->hideMouse(); + memset(_screen->getPalette(1), 0, 768); + + showOutro(c, _monsterDifficulty == 2 ? true : false); + quitGame(); + + return 0; +} + int LoLEngine::olol_stopCharacterSpeech(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_stopCharacterSpeech(%p)", (const void *)script); snd_stopSpeech(1); @@ -2713,7 +2744,7 @@ void LoLEngine::setupOpcodeTable() { // 0x5C Opcode(olol_getMonsterStat); - OpcodeUnImpl(); + Opcode(olol_releaseMonsterShapes); Opcode(olol_playCharacterScriptChat); Opcode(olol_update); @@ -2731,7 +2762,7 @@ void LoLEngine::setupOpcodeTable() { // 0x68 Opcode(olol_countAllMonsters); - OpcodeUnImpl(); + Opcode(olol_playEndSequence); Opcode(olol_stopCharacterSpeech); Opcode(olol_setPaletteBrightness); diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp index bba384ced4..849a325560 100644 --- a/engines/kyra/sequences_lol.cpp +++ b/engines/kyra/sequences_lol.cpp @@ -799,6 +799,8 @@ void LoLEngine::showOutro(int character, bool maxDifficulty) { showCredits(); + _eventList.clear(); + switch (character) { case 0: _screen->loadBitmap("KIERAN.CPS", 3, 3, _screen->getPalette(0)); @@ -929,6 +931,7 @@ void LoLEngine::processCredits(char *t, int dimState, int page, int delayTime) { uint8 *animBlock = new uint8[40960]; assert(animBlock); memset(animBlock, 0, 40960); + int inputFlag = 0; do { while (_system->getMillis() < waitTimer && !shouldQuit()) @@ -1133,7 +1136,9 @@ void LoLEngine::processCredits(char *t, int dimState, int page, int delayTime) { } _screen->updateScreen(); - } while (countStrings && !checkInput(0) && !shouldQuit()); + inputFlag = checkInput(0); + removeInputTop(); + } while (countStrings && !(inputFlag && !(inputFlag & 0x800)) && !shouldQuit()); removeInputTop(); delete[] animBlock; diff --git a/engines/kyra/sound_lol.cpp b/engines/kyra/sound_lol.cpp index d0e34a0be6..8e2c2b3e45 100644 --- a/engines/kyra/sound_lol.cpp +++ b/engines/kyra/sound_lol.cpp @@ -160,7 +160,7 @@ void LoLEngine::snd_stopSpeech(bool setFlag) { } void LoLEngine::snd_playSoundEffect(int track, int volume) { - if (track == 1 && (_lastSfxTrack == -1 || _lastSfxTrack == 1)) + if ((track == 1 && (_lastSfxTrack == -1 || _lastSfxTrack == 1)) || shouldQuit()) return; _lastSfxTrack = track; @@ -202,7 +202,7 @@ void LoLEngine::snd_playSoundEffect(int track, int volume) { } void LoLEngine::snd_processEnvironmentalSoundEffect(int soundId, int block) { - if (!_sound->sfxEnabled()) + if (!_sound->sfxEnabled() || shouldQuit()) return; if (_environmentSfx) -- cgit v1.2.3