From 5f4dad1a6dcd86e29f291a8a5d48e8cd085c6bb7 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Mon, 29 Aug 2011 09:47:46 +0200 Subject: GOB: Fix the display length of "You can't use that" texts in Geisha --- engines/gob/hotspots.cpp | 30 ++++++++++++++++++++++++++++-- engines/gob/hotspots.h | 4 ++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index 96b1efbcf1..5e0af847de 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -202,6 +202,8 @@ Hotspots::Hotspots(GobEngine *vm) : _vm(vm) { _currentKey = 0; _currentIndex = 0; _currentId = 0; + _currentX = 0; + _currentY = 0; } Hotspots::~Hotspots() { @@ -385,6 +387,8 @@ void Hotspots::push(uint8 all, bool force) { backup.key = _currentKey; backup.id = _currentId; backup.index = _currentIndex; + backup.x = _currentX; + backup.y = _currentY; backup.hotspots = new Hotspot[size]; @@ -415,6 +419,8 @@ void Hotspots::push(uint8 all, bool force) { _currentKey = 0; _currentId = 0; _currentIndex = 0; + _currentX = 0; + _currentY = 0; _stack.push(backup); } @@ -445,6 +451,8 @@ void Hotspots::pop() { _currentKey = backup.key; _currentId = backup.id; _currentIndex = backup.index; + _currentX = backup.x; + _currentY = backup.y; delete[] backup.hotspots; } @@ -498,6 +506,9 @@ void Hotspots::enter(uint16 index) { (spot.getState() == (kStateFilled | kStateType2))) WRITE_VAR(17, -(spot.id & 0x0FFF)); + _currentX = _vm->_global->_inter_mouseX; + _currentY = _vm->_global->_inter_mouseY; + if (spot.funcEnter != 0) call(spot.funcEnter); } @@ -649,9 +660,22 @@ bool Hotspots::checkHotspotChanged() { // Get the current hotspot key = checkMouse(kTypeMove, id, index); - if (key == _currentKey) - // Nothing changed => nothing to do + uint16 mouseX = _vm->_global->_inter_mouseX; + uint16 mouseY = _vm->_global->_inter_mouseY; + + if (key == _currentKey) { + // Still the same hotspot, just update the mouse position + + _currentX = mouseX; + _currentY = mouseY; return false; + } + + // In Geisha, no move hotspot changes should occur when + // we didn't actually move the mouse + if (_vm->getGameType() == kGameTypeGeisha) + if ((mouseX == _currentX) && (mouseY == _currentY)) + return false; // Leave the old area if (isValid(_currentKey, _currentId,_currentIndex)) @@ -660,6 +684,8 @@ bool Hotspots::checkHotspotChanged() { _currentKey = key; _currentId = id; _currentIndex = index; + _currentX = mouseX; + _currentY = mouseY; // Enter the new one if (isValid(key, id, index)) diff --git a/engines/gob/hotspots.h b/engines/gob/hotspots.h index 8d26ad224e..b348f9cd70 100644 --- a/engines/gob/hotspots.h +++ b/engines/gob/hotspots.h @@ -158,6 +158,8 @@ private: uint32 key; uint32 id; uint32 index; + uint16 x; + uint16 y; }; struct InputDesc { @@ -178,6 +180,8 @@ private: uint16 _currentKey; uint16 _currentIndex; uint16 _currentId; + uint16 _currentX; + uint16 _currentY; /** Add a hotspot, returning the new index. */ uint16 add(const Hotspot &hotspot); -- cgit v1.2.3