diff options
author | lukaslw | 2014-07-02 17:29:42 +0200 |
---|---|---|
committer | lukaslw | 2014-07-02 17:29:42 +0200 |
commit | 92f3d72f19a54b7af627c5956bcdeacc05d715ac (patch) | |
tree | 856390b070c67183792568b3514894742c9b5698 | |
parent | 355b7a3e3b041d5cfbb0bba2ada253456de7c167 (diff) | |
download | scummvm-rg350-92f3d72f19a54b7af627c5956bcdeacc05d715ac.tar.gz scummvm-rg350-92f3d72f19a54b7af627c5956bcdeacc05d715ac.tar.bz2 scummvm-rg350-92f3d72f19a54b7af627c5956bcdeacc05d715ac.zip |
PRINCE: doTalkAnim(), talkHero() update
-rw-r--r-- | engines/prince/prince.cpp | 45 | ||||
-rw-r--r-- | engines/prince/script.cpp | 4 | ||||
-rw-r--r-- | engines/prince/script.h | 2 |
3 files changed, 43 insertions, 8 deletions
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index 6445113cd6..5b0cea3066 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -2335,30 +2335,59 @@ void PrinceEngine::talkHero(int slot, const char *s) { Text &text = _textSlots[slot]; int lines = calcText(s); int time = lines * 30; - int x, y; if (slot == 0) { text._color = 220; // test this _mainHero->_state = Hero::TALK; _mainHero->_talkTime = time; - x = _mainHero->_middleX - _picWindowX; - y = _mainHero->_middleY - _mainHero->_scaledFrameYSize; + text._x = _mainHero->_middleX - _picWindowX; + text._y = _mainHero->_middleY - _mainHero->_scaledFrameYSize; } else { text._color = 220; // test this ! _secondHero->_state = Hero::TALK; _secondHero->_talkTime = time; - x = _secondHero->_middleX - _picWindowX; - y = _secondHero->_middleY - _secondHero->_scaledFrameYSize; + text._x = _secondHero->_middleX - _picWindowX; + text._y = _secondHero->_middleY - _secondHero->_scaledFrameYSize; } text._time = time; // changed by SETSPECVOICE? text._str = s; - text._x = x; - text._y = y; _interpreter->increaseString(); } void PrinceEngine::doTalkAnim(int animNumber, int slot, AnimType animType) { - //TODO + Text &text = _textSlots[slot]; + int lines = calcText((const char *)_interpreter->getGlobalString()); + int time = lines * 30; + if (animType == kNormalAnimation) { + Anim &normAnim = _normAnimList[animNumber]; + if (normAnim._animData != nullptr) { + if (!normAnim._state) { + if (normAnim._currW && normAnim._currH) { + text._color = _flags->getFlagValue(Flags::KOLOR); + text._x = normAnim._currX + normAnim._currW / 2; + text._y = normAnim._currY - 10; + } + } + } + } else if (animType == kBackgroundAnimation) { + if (animNumber < _backAnimList.size()) { + int currAnim = _backAnimList[animNumber]._seq._currRelative; + Anim &backAnim = _backAnimList[animNumber].backAnims[currAnim]; + if (backAnim._animData != nullptr) { + if (!backAnim._state) { + if (backAnim._currW && backAnim._currH) { + text._color = _flags->getFlagValue(Flags::KOLOR); + text._x = backAnim._currX + backAnim._currW / 2; + text._y = backAnim._currY - 10; + } + } + } + } + } else { + error("doTalkAnim() - wrong animType: %d", animType); + } + text._time = time; + text._str = (const char *)_interpreter->getGlobalString(); _interpreter->increaseString(); } diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp index 7f5a069556..2c4d8b66c2 100644 --- a/engines/prince/script.cpp +++ b/engines/prince/script.cpp @@ -522,6 +522,10 @@ void Interpreter::setCurrentString(uint32 value) { _currentString = value; } +byte *Interpreter::getGlobalString() { + return _string; +} + void Interpreter::increaseString() { while (*_string) { _string++; diff --git a/engines/prince/script.h b/engines/prince/script.h index ddb68087f4..25c71bf6a1 100644 --- a/engines/prince/script.h +++ b/engines/prince/script.h @@ -185,6 +185,8 @@ public: uint32 getCurrentString(); void setCurrentString(uint32 value); + byte *getGlobalString(); + void increaseString(); private: |