Skip to content

Commit

Permalink
GOB: Fix the display length of "You can't use that" texts in Geisha
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Aug 29, 2011
1 parent dfe9fc0 commit 5f4dad1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
30 changes: 28 additions & 2 deletions engines/gob/hotspots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ Hotspots::Hotspots(GobEngine *vm) : _vm(vm) {
_currentKey = 0;
_currentIndex = 0;
_currentId = 0;
_currentX = 0;
_currentY = 0;
}

Hotspots::~Hotspots() {
Expand Down Expand Up @@ -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];

Expand Down Expand Up @@ -415,6 +419,8 @@ void Hotspots::push(uint8 all, bool force) {
_currentKey = 0;
_currentId = 0;
_currentIndex = 0;
_currentX = 0;
_currentY = 0;

_stack.push(backup);
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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))
Expand All @@ -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))
Expand Down
4 changes: 4 additions & 0 deletions engines/gob/hotspots.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ class Hotspots {
uint32 key;
uint32 id;
uint32 index;
uint16 x;
uint16 y;
};

struct InputDesc {
Expand All @@ -178,6 +180,8 @@ class Hotspots {
uint16 _currentKey;
uint16 _currentIndex;
uint16 _currentId;
uint16 _currentX;
uint16 _currentY;

/** Add a hotspot, returning the new index. */
uint16 add(const Hotspot &hotspot);
Expand Down

0 comments on commit 5f4dad1

Please sign in to comment.