diff options
author | Benjamin Haisch | 2008-08-25 12:53:39 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2011-11-20 22:43:06 +0100 |
commit | 6a83d7d85136158329e3df2a705f09d189ee9e05 (patch) | |
tree | 60b60a8db3ec3fd03bd18acba9223837e1786bee /engines/toltecs | |
parent | 367be5b3453a86aece7c259cacfa42cfaa07de74 (diff) | |
download | scummvm-rg350-6a83d7d85136158329e3df2a705f09d189ee9e05.tar.gz scummvm-rg350-6a83d7d85136158329e3df2a705f09d189ee9e05.tar.bz2 scummvm-rg350-6a83d7d85136158329e3df2a705f09d189ee9e05.zip |
TOLTECS: Cancel all talkText items when camera position is changed (fixes some crashes and odd behaviour)
Diffstat (limited to 'engines/toltecs')
-rw-r--r-- | engines/toltecs/screen.cpp | 6 | ||||
-rw-r--r-- | engines/toltecs/screen.h | 1 | ||||
-rw-r--r-- | engines/toltecs/toltecs.cpp | 21 |
3 files changed, 21 insertions, 7 deletions
diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp index cad29ddd76..c74b4c5dcd 100644 --- a/engines/toltecs/screen.cpp +++ b/engines/toltecs/screen.cpp @@ -817,6 +817,12 @@ int16 Screen::getTalkTextDuration() { return _talkTextItems[_talkTextItemNum].duration; } +void Screen::finishTextDrawItems() { + for (int16 i = 0; i <= _talkTextItemNum; i++) { + _talkTextItems[i].duration = 0; + } +} + void Screen::registerFont(uint fontIndex, uint resIndex) { _fontResIndexArray[fontIndex] = resIndex; } diff --git a/engines/toltecs/screen.h b/engines/toltecs/screen.h index cc0cc00405..a30c863f33 100644 --- a/engines/toltecs/screen.h +++ b/engines/toltecs/screen.h @@ -328,6 +328,7 @@ public: void addTalkTextRect(Font &font, int16 x, int16 &y, int16 length, int16 width, TalkTextItem *item); void drawTalkTextItems(); int16 getTalkTextDuration(); + void finishTextDrawItems(); // Font/text void registerFont(uint fontIndex, uint resIndex); diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp index d85df45a2d..6bc13401f7 100644 --- a/engines/toltecs/toltecs.cpp +++ b/engines/toltecs/toltecs.cpp @@ -188,8 +188,11 @@ void ToltecsEngine::loadScene(uint resIndex) { } void ToltecsEngine::updateScreen() { - // TODO + // FIXME: Quick hack, sometimes cameraY was negative (the code in updateCamera was at fault) + if (_cameraY < 0) _cameraY = 0; + + // TODO: Optimize redraw by using dirty rectangles byte *destp = _screen->_frontScreen; byte *srcp = _screen->_backScreen + _cameraX + _cameraY * _sceneWidth; for (uint y = 0; y < MIN<uint>(_cameraHeight, 400); y++) { @@ -295,13 +298,17 @@ void ToltecsEngine::updateInput() { void ToltecsEngine::setCamera(int16 x, int16 y) { - // TODO font_sub_4B5BB() - + _screen->finishTextDrawItems(); + + /* + // TODO: Fix checks; sometimes cameraY ended up being negative + if (x > _sceneWidth) x = _sceneWidth; if (y > _sceneHeight - _cameraHeight) y = _sceneHeight - _cameraHeight; + */ // TODO DirtyRect clearing stuff @@ -332,7 +339,7 @@ void ToltecsEngine::scrollCameraUp(int16 delta) { _newCameraY = 0; else _newCameraY -= delta; - // TODO: font_sub_4B5BB(); + _screen->finishTextDrawItems(); } } @@ -343,7 +350,7 @@ void ToltecsEngine::scrollCameraDown(int16 delta) { delta += (_sceneHeight - _cameraHeight) - (delta + _newCameraY); _newCameraY += delta; debug(0, "ToltecsEngine::scrollCameraDown() _newCameraY = %d; delta = %d", _newCameraY, delta); - // TODO: font_sub_4B5BB(); + _screen->finishTextDrawItems(); } } @@ -353,7 +360,7 @@ void ToltecsEngine::scrollCameraLeft(int16 delta) { _newCameraX = 0; else _newCameraX -= delta; - // TODO: font_sub_4B5BB(); + _screen->finishTextDrawItems(); } } @@ -364,7 +371,7 @@ void ToltecsEngine::scrollCameraRight(int16 delta) { delta += (_sceneWidth - 640) - (delta + _newCameraX); _newCameraX += delta; debug(0, "ToltecsEngine::scrollCameraRight() _newCameraX = %d; delta = %d", _newCameraY, delta); - // TODO: font_sub_4B5BB(); + _screen->finishTextDrawItems(); } } |