mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-09 04:16:34 +00:00
Implementing switching to/from the map room by mouse
svn-id: r45872
This commit is contained in:
parent
5aaf66641b
commit
fc0c195ea3
@ -232,6 +232,7 @@ void Game::init() {
|
|||||||
rememberRoomNumAsPrevious();
|
rememberRoomNumAsPrevious();
|
||||||
scheduleEnteringRoomUsingGate(_info._startRoom, 0);
|
scheduleEnteringRoomUsingGate(_info._startRoom, 0);
|
||||||
_pushedNewRoom = _pushedNewGate = -1;
|
_pushedNewRoom = _pushedNewGate = -1;
|
||||||
|
_mouseChangeTick = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::handleOrdinaryLoop(int x, int y) {
|
void Game::handleOrdinaryLoop(int x, int y) {
|
||||||
@ -539,45 +540,56 @@ void Game::loop(LoopSubstatus substatus, bool shouldExit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Game::handleStatusChangeByMouse() {
|
void Game::handleStatusChangeByMouse() {
|
||||||
|
const int mouseY = _vm->_mouse->getPosY();
|
||||||
bool wantsChange = false;
|
bool wantsChange = false;
|
||||||
if (_loopStatus == kStatusOrdinary) {
|
if (_loopStatus == kStatusOrdinary) {
|
||||||
wantsChange = _vm->_mouse->getPosY() == 0;
|
if (getRoomNum() == getMapRoom()) {
|
||||||
|
wantsChange = mouseY >= kScreenHeight - 1;
|
||||||
|
} else {
|
||||||
|
wantsChange = mouseY == 0 || mouseY >= kScreenHeight - 1;
|
||||||
|
}
|
||||||
} else if (_loopStatus == kStatusInventory) {
|
} else if (_loopStatus == kStatusInventory) {
|
||||||
wantsChange = _animUnderCursor != _inventoryAnim && !_itemUnderCursor && _vm->_mouse->getPosY() != 0;
|
wantsChange = _animUnderCursor != _inventoryAnim && !_itemUnderCursor && mouseY != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wantsChange) {
|
if (!wantsChange) {
|
||||||
// Disable the timer.
|
// Disable the timer.
|
||||||
_mouseChangeTick = -1;
|
_mouseChangeTick = -1;
|
||||||
} else {
|
|
||||||
if (_mouseChangeTick == -1) {
|
// Otherwise the mouse signalizes that the mode should be changed.
|
||||||
// If the timer is currently disabled, this is the
|
} else if (_mouseChangeTick == -1) {
|
||||||
// first time when the mouse left the region. Start
|
// If the timer is currently disabled, this is the first time
|
||||||
// counting.
|
// when the mouse left the region. Start counting.
|
||||||
_mouseChangeTick = _vm->_system->getMillis();
|
_mouseChangeTick = _vm->_system->getMillis();
|
||||||
} else if (_mouseChangeTick == -2) {
|
} else if (_mouseChangeTick == -2) {
|
||||||
// Do nothing. This exception is good when the
|
// Do nothing. This exception is good when the status has just
|
||||||
// inventory visibility flag is flipped by the key 'I'
|
// changed. Even if the mouse starts in the outside region
|
||||||
// instead of by moving the mouse. Even if the mouse
|
// (e.g., due to flipping the change by a key or due to
|
||||||
// starts in the outside region, the timeout won't kick
|
// flipping back being triggered by the same hot area), the
|
||||||
// in until it moves into the inside region for the
|
// timeout won't kick in until it moves into the inside region
|
||||||
// first time.
|
// for the first time.
|
||||||
} else if (_vm->_system->getMillis() - _mouseChangeTick >= kStatusChangeTimeout) {
|
} else if (_vm->_system->getMillis() - _mouseChangeTick >= kStatusChangeTimeout) {
|
||||||
if (_loopStatus == kStatusOrdinary) {
|
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();
|
inventoryInit();
|
||||||
} else {
|
|
||||||
inventoryDone();
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
inventoryDone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't implement the original game player's main
|
// We don't implement the original game player's main menu that pops up
|
||||||
// menu that pops up when the mouse gets to the bottom
|
// when the mouse gets to the bottom of the screen. It contains icons
|
||||||
// of the screen. It contains icons for displaying the map,
|
// for displaying the map, loading/saving the game, quiting the game,
|
||||||
// loading/saving the game, quiting the game, and displaying the
|
// and displaying the credits. The essential options are implemented
|
||||||
// credits. The essential options are implemented in ScummVM's main
|
// in ScummVM's main menu, I don't wanna implement the credits, and so
|
||||||
// menu, I don't wanna implement the credits, and for map we key the
|
// I allocate the whole bottom line for switching to/from the map.
|
||||||
// key 'M'.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::updateOrdinaryCursor() {
|
void Game::updateOrdinaryCursor() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user