Skip to content

Commit

Permalink
FREESCAPE: Ensure that the mouse is unlocked when the engine is paused
Browse files Browse the repository at this point in the history
  • Loading branch information
ccawley2011 authored and neuromancer committed Jan 8, 2023
1 parent 7c2509b commit 405585b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
18 changes: 15 additions & 3 deletions engines/freescape/freescape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,17 +416,19 @@ void FreescapeEngine::processInput() {
drawFrame();
_savedScreen = _gfx->getScreenshot();
_gfx->setViewport(_fullscreenViewArea);
g_system->lockMouse(false);
openMainMenuDialog();
g_system->lockMouse(true);
_gfx->setViewport(_viewArea);
_savedScreen->free();
delete _savedScreen;
break;
case Common::KEYCODE_SPACE:
_shootMode = !_shootMode;
if (!_shootMode)
if (!_shootMode) {
g_system->lockMouse(true);
centerCrossair();
} else {
g_system->lockMouse(false);
}
break;
case Common::KEYCODE_i:
drawInfoMenu();
Expand Down Expand Up @@ -872,5 +874,15 @@ void FreescapeEngine::removeTimers() {
g_system->getTimerManager()->removeTimerProc(&countdownCallback);
}

void FreescapeEngine::pauseEngineIntern(bool pause) {
Engine::pauseEngineIntern(pause);

// TODO: Handle the viewport here

// Unlock the mouse so that the cursor is usable when the GMM opens
if (!_shootMode) {
_system->lockMouse(!pause);
}
}

} // namespace Freescape
2 changes: 2 additions & 0 deletions engines/freescape/freescape.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ class FreescapeEngine : public Engine {
virtual Common::Error loadGameStreamExtended(Common::SeekableReadStream *stream);
Graphics::Surface *_savedScreen;

void pauseEngineIntern(bool pause) override;

// Timers
bool startCountdown(uint32 delay);
void removeTimers();
Expand Down
4 changes: 0 additions & 4 deletions engines/freescape/games/driller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1157,15 +1157,11 @@ void DrillerEngine::drawInfoMenu() {
case Common::EVENT_KEYDOWN:
if (event.kbd.keycode == Common::KEYCODE_l) {
_gfx->setViewport(_fullscreenViewArea);
g_system->lockMouse(false);
loadGameDialog();
g_system->lockMouse(true);
_gfx->setViewport(_viewArea);
} else if (event.kbd.keycode == Common::KEYCODE_s) {
_gfx->setViewport(_fullscreenViewArea);
g_system->lockMouse(false);
saveGameDialog();
g_system->lockMouse(true);
_gfx->setViewport(_viewArea);
} else if (isDOS() && event.kbd.keycode == Common::KEYCODE_t) {
// TODO
Expand Down

0 comments on commit 405585b

Please sign in to comment.