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 :))
This commit is contained in:
parent
4b13982116
commit
47ae908589
5 changed files with 31 additions and 16 deletions
|
@ -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
|
||||
|
|
|
@ -64,7 +64,9 @@ protected:
|
|||
void unpackRle(byte *source, byte *dest);
|
||||
|
||||
void fetchAudioChunks();
|
||||
|
||||
|
||||
bool handleInput();
|
||||
|
||||
};
|
||||
|
||||
} // End of namespace Toltecs
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue