From bbabe2b06b479fb5775b55c0de7b10df7ff67501 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Mar 2014 14:20:04 -0400 Subject: MADS: Fix positioning of kernel messages --- engines/mads/messages.cpp | 19 ++++++++++++------- engines/mads/messages.h | 2 -- engines/mads/player.h | 8 ++++---- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 592dd4bd28..6dde40bbda 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -36,7 +36,6 @@ KernelMessages::KernelMessages(MADSEngine *vm): _vm(vm) { } _talkFont = _vm->_font->getFont(FONT_CONVERSATION); - word_8469E = 0; } KernelMessages::~KernelMessages() { @@ -89,7 +88,8 @@ int KernelMessages::add(const Common::Point &pt, uint fontColor, uint8 flags, int KernelMessages::addQuote(int quoteId, int abortTimers, uint32 timeout) { Common::String quoteStr = _vm->_game->getQuote(quoteId); - return add(Common::Point(), 0x1110, KMSG_PLAYER_TIMEOUT | KMSG_CENTER_ALIGN, abortTimers, timeout, quoteStr); + return add(Common::Point(), 0x1110, KMSG_PLAYER_TIMEOUT | KMSG_CENTER_ALIGN, + abortTimers, timeout, quoteStr); } void KernelMessages::scrollMessage(int msgIndex, int numTicks, bool quoted) { @@ -203,10 +203,16 @@ void KernelMessages::processText(int msgIndex) { } } + Player &player = _vm->_game->_player; if (msg._flags & KMSG_PLAYER_TIMEOUT) { - if (word_8469E != 0) { - warning("TODO: KernelMessages::processText"); - // TODO: Figure out various flags + if (player._visible3) { + SpriteAsset &asset = *_vm->_game->_scene._sprites[player._spritesStart + player._spritesIdx]; + MSprite *frame = asset.getFrame(player._frameNum - 1); + + int yAmount = player._currentScale * player._yScale / 100; + x1 = player._playerPos.x; + y1 = (frame->h * player._currentScale / -100) + yAmount + + player._playerPos.y - 15; } else { x1 = 160; y1 = 78; @@ -222,11 +228,10 @@ void KernelMessages::processText(int msgIndex) { ++msg._msgOffset; msg._msg.setChar(msg._asciiChar2, msg._msgOffset); msg._asciiChar = msg._msg[msg._msgOffset]; - msg._asciiChar2 = msg._msg[msg._msgOffset + 1]; + msg._asciiChar2 = !msg._asciiChar ? '\0' : msg._msg[msg._msgOffset + 1]; if (!msg._asciiChar) { // End of message - msg._msg.setChar('\0', msg._msgOffset); msg._flags &= ~KMSG_SCROLL; } else if (msg._flags & KMSG_QUOTED) { msg._msg.setChar('"', msg._msgOffset); diff --git a/engines/mads/messages.h b/engines/mads/messages.h index 205cbf8f30..8fb75953f6 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -71,8 +71,6 @@ private: MADSEngine *_vm; Common::Array _entries; Font *_talkFont; -public: - int word_8469E; public: KernelMessages(MADSEngine *vm); ~KernelMessages(); diff --git a/engines/mads/player.h b/engines/mads/player.h index 8bc0ae73a1..d7e074afc8 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -40,11 +40,7 @@ private: MADSEngine *_vm; bool _highSprites; bool _spriteSetsPresent[PLAYER_SPRITES_FILE_COUNT]; - int _currentDepth; - int _currentScale; int _frameOffset; - int _frameNum; - int _yScale; int _frameCount; int _frameListIndex; int _actionIndex; @@ -111,6 +107,7 @@ public: bool _visible; bool _priorVisible; bool _visible3; + int _frameNum; Common::Point _playerPos; Common::Point _destPos; Common::Point _posChange; @@ -126,6 +123,9 @@ public: int _unk3; bool _unk4; bool _forceRefresh; + int _yScale; + int _currentDepth; + int _currentScale; Common::String _spritesPrefix; int _routeCount; int _routeOffset; -- cgit v1.2.3