diff options
author | Sylvain Dupont | 2010-10-22 20:53:25 +0000 |
---|---|---|
committer | Sylvain Dupont | 2010-10-22 20:53:25 +0000 |
commit | 66e3815963564b1070bad56e25e2f9fb5e2a039e (patch) | |
tree | 647713f73375d3252706be28b3dbb055684cfc04 /engines/toon | |
parent | 4a0ba817e58c5a1c7d17af5a79f91570dd98ca16 (diff) | |
download | scummvm-rg350-66e3815963564b1070bad56e25e2f9fb5e2a039e.tar.gz scummvm-rg350-66e3815963564b1070bad56e25e2f9fb5e2a039e.tar.bz2 scummvm-rg350-66e3815963564b1070bad56e25e2f9fb5e2a039e.zip |
TOON: Fixed Bug #3089974 and #3086015
Bug #3089974: "TOON: Two Drews when exiting King's bedroom"
Bug #3086015: "TOON: Woof doesn't idle correctly"
Most talking animation bugs are fixed with this.
The mouse is now hidden when entering a room.
svn-id: r53706
Diffstat (limited to 'engines/toon')
-rw-r--r-- | engines/toon/character.cpp | 36 | ||||
-rw-r--r-- | engines/toon/character.h | 3 | ||||
-rw-r--r-- | engines/toon/script_func.cpp | 6 | ||||
-rw-r--r-- | engines/toon/toon.cpp | 34 | ||||
-rw-r--r-- | engines/toon/toon.h | 2 |
5 files changed, 56 insertions, 25 deletions
diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp index 378cd11a9f..860b106837 100644 --- a/engines/toon/character.cpp +++ b/engines/toon/character.cpp @@ -47,6 +47,7 @@ Character::Character(ToonEngine *vm) : _vm(vm) { _facing = 0; _flags = 0; _animFlags = 0; + _isTalking = false; _id = 0; _scale = 1024; _blockingWalk = false; @@ -249,8 +250,8 @@ void Character::stopSpecialAnim() { if (_animScriptId != -1) _vm->getSceneAnimationScript(_animScriptId)->_frozen = false; - if (_sceneAnimationId != -1) - _animationInstance->setAnimation(_vm->getSceneAnimation(_sceneAnimationId)->_animation); + //if (_sceneAnimationId != -1) + // _animationInstance->setAnimation(_vm->getSceneAnimation(_sceneAnimationId)->_animation); bool needStandingAnim = (_animFlags & 0x40) != 0; @@ -348,10 +349,12 @@ void Character::update(int32 timeIncrement) { if (_animScriptId != -1) _vm->getSceneAnimationScript(_animScriptId)->_frozen = true; - + + // TODO setup backup // _animFlags |= 0x10; + _animationInstance->setAnimation(_specialAnim); _animationInstance->setFrame(0); _time = _vm->getOldMilli() + 8 * _vm->getTickLength(); } @@ -359,14 +362,11 @@ void Character::update(int32 timeIncrement) { } if ((_animFlags & 3) == 2) { - if (_vm->getCurrentLineToSay() != _lineToSayId || !_vm->getAudioManager()->voiceStillPlaying()) // || (_flags & 8)) && _vm->getAudioManager()->voiceStillPlaying()) + if ((((_animFlags & 8) == 8) && _vm->getCurrentLineToSay() != _lineToSayId) || !_vm->getAudioManager()->voiceStillPlaying()) // || (_flags & 8)) && _vm->getAudioManager()->voiceStillPlaying()) _animFlags |= 1; -// Strangerke - Commented (not used) -// } else { } - // label29 : if (_time > _vm->getOldMilli()) return; @@ -439,13 +439,13 @@ void Character::update(int32 timeIncrement) { // skipped all this part. //label78 + + #if 0 if (_id == 0) - debugC(0, 0xfff, " drew animation flag %d / frame %d", _animFlags, nextFrame); - + printf(" drew animation name %s / flag %d / frame %d \n", _specialAnim->_name, _animFlags, nextFrame); if (_id == 1) debugC(0, 0xfff, " flux animation flag %d / frame %d", _animFlags, nextFrame); - if (_id == 7) debugC(0, 0xfff, " footman animation flag %d / frame %d", _animFlags, nextFrame); #endif @@ -954,12 +954,9 @@ void Character::playAnim(int32 animId, int32 unused, int32 flags) { strcat(animName, ".CAF"); - if (_animScriptId != -1) + if (_animScriptId != -1 && (flags & 8) == 0) _vm->getSceneAnimationScript(_animScriptId)->_frozen = true; - if (_sceneAnimationId > -1) - setAnimationInstance(_vm->getSceneAnimation(_sceneAnimationId)->_animInstance); - stopSpecialAnim(); if (flags & 8) { @@ -968,7 +965,18 @@ void Character::playAnim(int32 animId, int32 unused, int32 flags) { // make the talker busy _flags |= 1; + + // wait for the character to be ready + while (_animScriptId != -1 && _animationInstance->getFrame() > 0 && _animationInstance->getAnimation() != _specialAnim) { + _vm->simpleUpdate(false); + } } + + + if (_sceneAnimationId > -1) + setAnimationInstance(_vm->getSceneAnimation(_sceneAnimationId)->_animInstance); + + _animFlags |= flags; if (_specialAnim) diff --git a/engines/toon/character.h b/engines/toon/character.h index c6cb3011f2..e4f53e731c 100644 --- a/engines/toon/character.h +++ b/engines/toon/character.h @@ -96,6 +96,8 @@ public: virtual void updateIdle(); virtual int32 getRandomIdleAnim() { return 0; } virtual void updateTimers(int32 relativeAdd); + virtual void setTalking(bool talking) { _isTalking = true; } + virtual bool isTalking() { return _isTalking; } int32 getFacingFromDirection(int32 dx, int32 dy); static const SpecialCharacterAnimation *getSpecialAnimation(int32 characterId, int32 animationId); @@ -126,6 +128,7 @@ protected: int32 _speed; int32 _lastWalkTime; int32 _numPixelToWalk; + bool _isTalking; AnimationInstance *_animationInstance; AnimationInstance *_shadowAnimationInstance; diff --git a/engines/toon/script_func.cpp b/engines/toon/script_func.cpp index bc7a234a86..1f463d065b 100644 --- a/engines/toon/script_func.cpp +++ b/engines/toon/script_func.cpp @@ -618,7 +618,10 @@ int32 ScriptFunc::sys_Cmd_In_Conversation(EMCState *state) { int32 ScriptFunc::sys_Cmd_Character_Talking(EMCState *state) { int32 characterId = stackPos(0); - return (_vm->getCurrentCharacterTalking() == characterId); + Character *character = _vm->getCharacterById(characterId); + if (character) + return character->isTalking(); + return 0; } int32 ScriptFunc::sys_Cmd_Set_Flux_Facing_Point(EMCState *state) { @@ -963,6 +966,7 @@ int32 ScriptFunc::sys_Cmd_Draw_Scene_Anim_WSA_Frame(EMCState *state) { SceneAnimation *sceneAnim = _vm->getSceneAnimation(animId); if (sceneAnim->_active) { + sceneAnim->_animInstance->setAnimation(sceneAnim->_animation); sceneAnim->_animInstance->setFrame(frame); sceneAnim->_animInstance->setAnimationRange(frame, frame); sceneAnim->_animInstance->stopAnimation(); diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp index fdb69c4cf3..3a823071e0 100644 --- a/engines/toon/toon.cpp +++ b/engines/toon/toon.cpp @@ -801,21 +801,23 @@ void ToonEngine::setPaletteEntries(uint8 *palette, int32 offset, int32 num) { _system->setPalette(vmpalette, offset, num); } -void ToonEngine::simpleUpdate() { +void ToonEngine::simpleUpdate(bool waitCharacterToTalk) { int32 elapsedTime = _system->getMillis() - _oldTimer2; _oldTimer2 = _system->getMillis(); _oldTimer = _oldTimer2; + if (!_audioManager->voiceStillPlaying() && !waitCharacterToTalk) { + _currentTextLine = 0; + _currentTextLineId = -1; + } + updateCharacters(elapsedTime); updateAnimationSceneScripts(elapsedTime); updateTimer(elapsedTime); _animationManager->update(elapsedTime); render(); - if (!_audioManager->voiceStillPlaying()) { - _currentTextLine = 0; - _currentTextLineId = -1; - } + } void ToonEngine::fixPaletteEntries(uint8 *palette, int num) { @@ -1067,7 +1069,7 @@ void ToonEngine::loadScene(int32 SceneId, bool forGameLoad) { setupGeneralPalette(); createShadowLUT(); - + state()->_mouseHidden = false; if (!forGameLoad) { @@ -1086,7 +1088,7 @@ void ToonEngine::loadScene(int32 SceneId, bool forGameLoad) { _gameState->_nextSpecialEnterX = -1; _gameState->_nextSpecialEnterY = -1; } - + _script->start(&_scriptState[0], 3); while (_script->run(&_scriptState[0])) @@ -1098,8 +1100,6 @@ void ToonEngine::loadScene(int32 SceneId, bool forGameLoad) { waitForScriptStep(); } - - state()->_mouseHidden = false; } void ToonEngine::setupGeneralPalette() { @@ -1911,7 +1911,19 @@ int32 ToonEngine::characterTalk(int32 dialogid, bool blocking) { _currentTextLineId = dialogid; if (blocking) { + Character *character = getCharacterById(talkerId); + if (character) + character->setTalking(true); + playTalkAnimOnCharacter(talkerAnimId, talkerId, true); + + // set once more the values, they may have been overwritten when the engine + // waits for the character to be ready. + _currentTextLine = myLine; + _currentTextLineCharacterId = talkerId; + _currentTextLineId = dialogid; + + } else { Character *character = getCharacterById(talkerId); if (character) @@ -1935,6 +1947,10 @@ int32 ToonEngine::characterTalk(int32 dialogid, bool blocking) { while (_audioManager->voiceStillPlaying() && !_shouldQuit) doFrame(); _gameState->_mouseHidden = oldMouseHidden && _gameState->_mouseHidden; + + Character *character = getCharacterById(talkerId); + if (character) + character->setTalking(false); } diff --git a/engines/toon/toon.h b/engines/toon/toon.h index 76425b09ca..299cb403b1 100644 --- a/engines/toon/toon.h +++ b/engines/toon/toon.h @@ -144,7 +144,7 @@ public: int32 runConversationCommand(int16 **command); void prepareConversations(); void drawConversationIcons(); - void simpleUpdate(); + void simpleUpdate(bool waitCharacterToTalk = false); int32 waitTicks(int32 numTicks, bool breakOnMouseClick); void copyToVirtualScreen(bool updateScreen = true); void getMouseEvent(); |