diff options
-rw-r--r-- | engines/parallaction/graphics.cpp | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 1c2cb58b5b..78d3991318 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -600,30 +600,41 @@ void Gfx::updateFloatingLabel() { return; } - int16 _si, _di; - - Common::Point cursor; - _vm->_input->getCursorPos(cursor); + struct FloatingLabelTraits { + Common::Point _offsetWithItem; + Common::Point _offsetWithoutItem; + int _minX; + int _minY; + int _maxX; + int _maxY; + } *traits; Common::Rect r; _labels[_floatingLabel]->getRect(0, r); - if (_vm->_input->_activeItem._id != 0) { - _si = cursor.x + 16 - r.width()/2; - _di = cursor.y + 34; + if (_vm->getGameType() == GType_Nippon) { + FloatingLabelTraits traits_NS = { + Common::Point(16 - r.width()/2, 34), + Common::Point(8 - r.width()/2, 21), + 0, 0, _vm->_screenWidth - r.width(), 190 + }; + traits = &traits_NS; } else { - _si = cursor.x + 8 - r.width()/2; - _di = cursor.y + 21; + // FIXME: _maxY for BRA is not constant (390), but depends on _vm->_subtitleY + FloatingLabelTraits traits_BR = { + Common::Point(34 - r.width()/2, 70), + Common::Point(16 - r.width()/2, 37), + 0, 0, _vm->_screenWidth - r.width(), 390 + }; + traits = &traits_BR; } - if (_si < 0) _si = 0; - if (_di > 190) _di = 190; - - if (r.width() + _si > _vm->_screenWidth) - _si = _vm->_screenWidth - r.width(); + Common::Point cursor; + _vm->_input->getCursorPos(cursor); + Common::Point offset = (_vm->_input->_activeItem._id) ? traits->_offsetWithItem : traits->_offsetWithoutItem; - _labels[_floatingLabel]->x = _si; - _labels[_floatingLabel]->y = _di; + _labels[_floatingLabel]->x = CLIP(cursor.x + offset.x, traits->_minX, traits->_maxX); + _labels[_floatingLabel]->y = CLIP(cursor.y + offset.y, traits->_minY, traits->_maxY); } |