diff options
author | Benjamin Haisch | 2008-10-20 19:54:29 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2011-11-20 22:43:07 +0100 |
commit | 47ae9085899a41f5ed5204183b008d4bff7c4a31 (patch) | |
tree | 8a703106bf39476bd39b64a45ceac93786ca8fad | |
parent | 4b13982116828453efd4a445328d455d9b820149 (diff) | |
download | scummvm-rg350-47ae9085899a41f5ed5204183b008d4bff7c4a31.tar.gz scummvm-rg350-47ae9085899a41f5ed5204183b008d4bff7c4a31.tar.bz2 scummvm-rg350-47ae9085899a41f5ed5204183b008d4bff7c4a31.zip |
TOLTECS: - Fixed Screen::updateTalkText (text x position was read incorrectly and font color wasn't nibble-swapped)
- Hooked up the movie player; movies can be aborted with Escape (not with mouse clicks at the moment because I was too lazy to implement it; funny, writing this explanation probably took longer :))
-rw-r--r-- | engines/toltecs/movie.cpp | 26 | ||||
-rw-r--r-- | engines/toltecs/movie.h | 4 | ||||
-rw-r--r-- | engines/toltecs/screen.cpp | 4 | ||||
-rw-r--r-- | engines/toltecs/script.cpp | 3 | ||||
-rw-r--r-- | engines/toltecs/toltecs.cpp | 10 |
5 files changed, 31 insertions, 16 deletions
diff --git a/engines/toltecs/movie.cpp b/engines/toltecs/movie.cpp index 6e59882efc..2813c0ea69 100644 --- a/engines/toltecs/movie.cpp +++ b/engines/toltecs/movie.cpp @@ -148,7 +148,7 @@ void MoviePlayer::playMovie(uint resIndex) { case 7: // setup subtitle parameters _vm->_screen->_talkTextY = READ_LE_UINT16(chunkBuffer + 0); _vm->_screen->_talkTextX = READ_LE_UINT16(chunkBuffer + 2); - _vm->_screen->_talkTextFontColor = chunkBuffer[4]; + _vm->_screen->_talkTextFontColor = ((chunkBuffer[4] << 4) & 0xF0) | ((chunkBuffer[4] >> 4) & 0x0F); debug(0, "_talkTextX = %d; _talkTextY = %d; _talkTextFontColor = %d", _vm->_screen->_talkTextX, _vm->_screen->_talkTextY, _vm->_screen->_talkTextFontColor); break; @@ -157,12 +157,15 @@ void MoviePlayer::playMovie(uint resIndex) { _vm->_screen->finishTalkTextItems(); break; default: - error("Unknown chunk type %d at %08X", chunkType, _vm->_arc->pos() - 5 - chunkSize); + error("MoviePlayer::playMovie(%04X) Unknown chunk type %d at %08X", resIndex, chunkType, _vm->_arc->pos() - 5 - chunkSize); } delete[] chunkBuffer; _vm->_arc->seek(movieOffset, SEEK_SET); + + if (!handleInput()) + break; } @@ -238,5 +241,24 @@ void MoviePlayer::unpackRle(byte *source, byte *dest) { } } +bool MoviePlayer::handleInput() { + Common::Event event; + Common::EventManager *eventMan = g_system->getEventManager(); + while (eventMan->pollEvent(event)) { + switch (event.type) { + case Common::EVENT_KEYDOWN: + if (event.kbd.keycode == Common::KEYCODE_ESCAPE) + return false; + break; + case Common::EVENT_QUIT: + g_system->quit(); + return false; + break; + default: + break; + } + } + return true; +} } // End of namespace Toltecs diff --git a/engines/toltecs/movie.h b/engines/toltecs/movie.h index 40b1f2ea27..abb7532491 100644 --- a/engines/toltecs/movie.h +++ b/engines/toltecs/movie.h @@ -64,7 +64,9 @@ protected: void unpackRle(byte *source, byte *dest); void fetchAudioChunks(); - + + bool handleInput(); + }; } // End of namespace Toltecs diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp index cde0138be3..d70cda3351 100644 --- a/engines/toltecs/screen.cpp +++ b/engines/toltecs/screen.cpp @@ -364,12 +364,12 @@ void Screen::updateTalkText(int16 slotIndex, int16 slotOffset) { while (1) { if (*textData == 0x0A) { - x = CLIP<int16>(textData[3], 120, _talkTextMaxWidth); + x = CLIP<int16>(READ_LE_UINT16(&textData[3]), 120, _talkTextMaxWidth); y = CLIP<int16>(READ_LE_UINT16(&textData[1]), 4, _vm->_cameraHeight - 16); maxWidth = 624 - ABS(x - 320) * 2; textData += 4; } else if (*textData == 0x14) { - item->color = textData[1]; + item->color = ((textData[1] << 4) & 0xF0) | ((textData[1] >> 4) & 0x0F); textData += 2; } else if (*textData == 0x19) { durationModifier = textData[1]; diff --git a/engines/toltecs/script.cpp b/engines/toltecs/script.cpp index 4f50ca265b..18942ec863 100644 --- a/engines/toltecs/script.cpp +++ b/engines/toltecs/script.cpp @@ -36,6 +36,7 @@ #include "toltecs/toltecs.h" #include "toltecs/animation.h" +#include "toltecs/movie.h" #include "toltecs/palette.h" #include "toltecs/resource.h" #include "toltecs/script.h" @@ -920,7 +921,7 @@ void ScriptInterpreter::execKernelOpcode(uint16 kernelOpcode) { case 65:// TODO { debug(0, "o2_playMovie(%d, %d)", arg16(3), arg16(5)); - // TODO: Enable once the player is ready: _vm->_moviePlayer->playMovie() + _vm->_moviePlayer->playMovie(arg16(3)); break; } diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp index 3aa160ac72..4691d23cb2 100644 --- a/engines/toltecs/toltecs.cpp +++ b/engines/toltecs/toltecs.cpp @@ -345,16 +345,6 @@ void ToltecsEngine::setCamera(int16 x, int16 y) { _screen->finishTalkTextItems(); - /* - // TODO: Fix checks; sometimes cameraY ended up being negative - - if (x > _sceneWidth) - x = _sceneWidth; - - if (y > _sceneHeight - _cameraHeight) - y = _sceneHeight - _cameraHeight; - */ - _screen->clearSprites(); _cameraX = x; |