aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorRobert Špalek2009-11-28 00:57:42 +0000
committerRobert Špalek2009-11-28 00:57:42 +0000
commit63a6480057677f0e5326da56f7183e55dd9b8482 (patch)
treeb5b013222ea7c1ef3e4260085d40cd44031e1189 /engines
parent68b99f1c9585e073b66286a2a05dce71bde81263 (diff)
downloadscummvm-rg350-63a6480057677f0e5326da56f7183e55dd9b8482.tar.gz
scummvm-rg350-63a6480057677f0e5326da56f7183e55dd9b8482.tar.bz2
scummvm-rg350-63a6480057677f0e5326da56f7183e55dd9b8482.zip
Hopefully fix switching to the map right after switching the location
It seems that the mouse was simply on the below line and triggered the switch to the map without the user realizing. svn-id: r46171
Diffstat (limited to 'engines')
-rw-r--r--engines/draci/game.cpp20
-rw-r--r--engines/draci/game.h5
2 files changed, 16 insertions, 9 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index 7d026e96f8..9cd3905f03 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -245,7 +245,7 @@ void Game::init() {
rememberRoomNumAsPrevious();
scheduleEnteringRoomUsingGate(_info._startRoom, 0);
_pushedNewRoom = _pushedNewGate = -1;
- _mouseChangeTick = -1;
+ _mouseChangeTick = kMouseDoNotSwitch;
}
void Game::handleOrdinaryLoop(int x, int y) {
@@ -564,15 +564,15 @@ void Game::handleStatusChangeByMouse() {
}
if (!wantsChange) {
- // Disable the timer.
- _mouseChangeTick = -1;
+ // Turn off the timer, but enable switching.
+ _mouseChangeTick = kMouseEnableSwitching;
// Otherwise the mouse signalizes that the mode should be changed.
- } else if (_mouseChangeTick == -1) {
+ } else if (_mouseChangeTick == kMouseEnableSwitching) {
// If the timer is currently disabled, this is the first time
// when the mouse left the region. Start counting.
_mouseChangeTick = _vm->_system->getMillis();
- } else if (_mouseChangeTick == -2) {
+ } else if (_mouseChangeTick == kMouseDoNotSwitch) {
// Do nothing. This exception is good when the status has just
// changed. Even if the mouse starts in the outside region
// (e.g., due to flipping the change by a key or due to
@@ -583,10 +583,8 @@ void Game::handleStatusChangeByMouse() {
if (_loopStatus == kStatusOrdinary) {
if (getRoomNum() == getMapRoom()) {
scheduleEnteringRoomUsingGate(getPreviousRoomNum(), 0);
- _mouseChangeTick = -2;
} else if (mouseY >= kScreenHeight - 1) {
scheduleEnteringRoomUsingGate(getMapRoom(), 0);
- _mouseChangeTick = -2;
} else if (mouseY == 0) {
inventoryInit();
}
@@ -801,7 +799,7 @@ void Game::inventoryInit() {
setLoopStatus(kStatusInventory);
// Don't return from the inventory mode immediately if the mouse is out.
- _mouseChangeTick = -2;
+ _mouseChangeTick = kMouseDoNotSwitch;
}
void Game::inventoryDone() {
@@ -822,7 +820,7 @@ void Game::inventoryDone() {
_itemUnderCursor = NULL;
// Don't start the inventory mode again if the mouse is on the top.
- _mouseChangeTick = -2;
+ _mouseChangeTick = kMouseDoNotSwitch;
}
void Game::inventoryDraw() {
@@ -1303,6 +1301,10 @@ void Game::enterNewRoom() {
setLoopStatus(kStatusOrdinary);
setExitLoop(false);
+ // Don't immediately switch to the map or inventory even if the mouse
+ // position tell us to.
+ _mouseChangeTick = kMouseDoNotSwitch;
+
// Set cursor state
// Need to do this after we set the palette since the cursors use it
if (_currentRoom._mouseOn) {
diff --git a/engines/draci/game.h b/engines/draci/game.h
index de22b0e2c6..8f688aeb5e 100644
--- a/engines/draci/game.h
+++ b/engines/draci/game.h
@@ -50,6 +50,11 @@ enum {
kBlackPalette = -1
};
+enum {
+ kMouseEnableSwitching = -1,
+ kMouseDoNotSwitch = -2
+};
+
// Constants tuned such that with ScummVM's default talkspeed kStandardSpeed, the speed
// computed by equation (kBaseSpeechDuration + kSpeechTimeUnit * #characters) /
// talkspeed is equal to the original game.