diff options
author | Johannes Schickel | 2008-04-20 00:30:39 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-04-20 00:30:39 +0000 |
commit | fb02a030a55f7eed0b58f6ab0ba7638b48b04a14 (patch) | |
tree | 427ff27105cebd10673b48f7425972ec2ba2b050 /engines/kyra | |
parent | 6692c4613db0726727abccb9a8c71f1eb39621f9 (diff) | |
download | scummvm-rg350-fb02a030a55f7eed0b58f6ab0ba7638b48b04a14.tar.gz scummvm-rg350-fb02a030a55f7eed0b58f6ab0ba7638b48b04a14.tar.bz2 scummvm-rg350-fb02a030a55f7eed0b58f6ab0ba7638b48b04a14.zip |
Implemented opcode 49: o3_badConscienceChat.
svn-id: r31585
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/animator_v3.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/kyra_v3.h | 4 | ||||
-rw-r--r-- | engines/kyra/script_v3.cpp | 10 | ||||
-rw-r--r-- | engines/kyra/text_v3.cpp | 60 |
4 files changed, 75 insertions, 1 deletions
diff --git a/engines/kyra/animator_v3.cpp b/engines/kyra/animator_v3.cpp index 31f6d1bad3..6ba5d29003 100644 --- a/engines/kyra/animator_v3.cpp +++ b/engines/kyra/animator_v3.cpp @@ -380,6 +380,8 @@ void KyraEngine_v3::updateSceneAnim(int anim, int newFrame) { void KyraEngine_v3::setupSceneAnimObject(int animId, uint16 flags, int x, int y, int x2, int y2, int w, int h, int unk10, int specialSize, int unk14, int shape, const char *filename) { + debugC(9, kDebugLevelAnimator, "KyraEngine_v3::setupSceneAnimObject(%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, '%s')", + animId, flags, x, y, x2, y2, w, h, unk10, specialSize, unk14, shape, filename); restorePage3(); SceneAnim &anim = _sceneAnims[animId]; anim.flags = flags; diff --git a/engines/kyra/kyra_v3.h b/engines/kyra/kyra_v3.h index a0c15463ce..7d6cf6e8ed 100644 --- a/engines/kyra/kyra_v3.h +++ b/engines/kyra/kyra_v3.h @@ -460,6 +460,9 @@ private: void objectChatProcess(const char *script); void objectChatWaitToFinish(); + void badConscienceChat(const char *str, int vocHigh, int vocLow); + void badConscienceChatWaitToFinish(); + // conscience bool _badConscienceShown; int _badConscienceAnim; @@ -520,6 +523,7 @@ private: int o3_hideMouse(ScriptState *script); int o3_setMousePos(ScriptState *script); int o3_showMouse(ScriptState *script); + int o3_badConscienceChat(ScriptState *script); int o3_delay(ScriptState *script); int o3_setSceneFilename(ScriptState *script); int o3_playSoundEffect(ScriptState *script); diff --git a/engines/kyra/script_v3.cpp b/engines/kyra/script_v3.cpp index a518f480a3..061bca4c2a 100644 --- a/engines/kyra/script_v3.cpp +++ b/engines/kyra/script_v3.cpp @@ -159,6 +159,14 @@ int KyraEngine_v3::o3_showMouse(ScriptState *script) { return 0; } +int KyraEngine_v3::o3_badConscienceChat(ScriptState *script) { + debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_badConscienceChat(%p) (%d)", (const void *)script, stackPos(0)); + int id = stackPos(0); + const char *str = (const char*)getTableEntry(_useActorBuffer ? _actorFile : _sceneStrings, id); + badConscienceChat(str, _vocHigh, id); + return 0; +} + int KyraEngine_v3::o3_delay(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_delay(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); const uint32 delayTime = stackPos(0) * _tickLength; @@ -472,7 +480,7 @@ void KyraEngine_v3::setupOpcodeTable() { Opcode(o3_setMousePos), // 0x30 Opcode(o3_showMouse), - OpcodeUnImpl(), + Opcode(o3_badConscienceChat), OpcodeUnImpl(), Opcode(o3_dummy), // 0x34 diff --git a/engines/kyra/text_v3.cpp b/engines/kyra/text_v3.cpp index fd621b879d..980d6a9ee1 100644 --- a/engines/kyra/text_v3.cpp +++ b/engines/kyra/text_v3.cpp @@ -364,6 +364,7 @@ void KyraEngine_v3::objectChatWaitToFinish() { const uint32 curTime = _system->getMillis(); if ((textEnabled() && !speechEnabled() && curTime > endTime) || (speechEnabled() && !snd_voiceIsPlaying()) || skipFlag()) { + snd_stopVoice(); resetSkipFlag(); nextFrame = curTime; running = false; @@ -378,4 +379,63 @@ void KyraEngine_v3::objectChatWaitToFinish() { resetCharacterAnimDim(); } +void KyraEngine_v3::badConscienceChat(const char *str, int vocHigh, int vocLow) { + debugC(9, kDebugLevelMain, "KyraEngine_v3::badConscienceChat('%s', %d, %d)", str, vocHigh, vocLow); + if (!_badConscienceShown) + return; + + //setNextIdleAnimTimer(); + _chatVocHigh = _chatVocLow = -1; + objectChatInit(str, 1, vocHigh, vocLow); + _chatText = str; + _chatObject = 1; + badConscienceChatWaitToFinish(); + updateSceneAnim(0x0E, _badConscienceFrameTable[_badConscienceAnim+16]); + _text->restoreScreen(); + update(); + _chatText = 0; + _chatObject = -1; +} + +void KyraEngine_v3::badConscienceChatWaitToFinish() { + debugC(9, kDebugLevelMain, "KyraEngine_v3::badConscienceChatWaitToFinish()"); + if (_chatVocHigh) { + playVoice(_chatVocHigh, _chatVocLow); + _chatVocHigh = _chatVocLow = -1; + } + + bool running = true; + const uint32 endTime = _chatEndTime; + resetSkipFlag(); + + uint32 nextFrame = _system->getMillis() + _rnd.getRandomNumberRng(4, 8) * _tickLength; + + int frame = _badConscienceFrameTable[_badConscienceAnim+24]; + while (running && !_quitFlag) { + if (nextFrame < _system->getMillis()) { + ++frame; + if (_badConscienceFrameTable[_badConscienceAnim+32] < frame) + frame = _badConscienceFrameTable[_badConscienceAnim+24]; + + updateSceneAnim(0x0E, frame); + updateWithText(); + + nextFrame = _system->getMillis() + _rnd.getRandomNumberRng(4, 8) * _tickLength; + } + + updateWithText(); + + const uint32 curTime = _system->getMillis(); + if ((textEnabled() && !speechEnabled() && curTime > endTime) || (speechEnabled() && !snd_voiceIsPlaying()) || skipFlag()) { + snd_stopVoice(); + resetSkipFlag(); + nextFrame = curTime; + running = false; + } + + delay(10); + } +} + } // end of namespace Kyra + |