[Scummvm-git-logs] scummvm master -> 965027b91faa42f0e055754d5864f6cafdbcb31e
sev-
noreply at scummvm.org
Mon Jul 21 10:54:33 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
965027b91f BURIED: Add keymapper support
Commit: 965027b91faa42f0e055754d5864f6cafdbcb31e
https://github.com/scummvm/scummvm/commit/965027b91faa42f0e055754d5864f6cafdbcb31e
Author: aunnoman1 (aunnoman123 at outlook.com)
Date: 2025-07-21T12:54:30+02:00
Commit Message:
BURIED: Add keymapper support
Changed paths:
engines/buried/biochip_right.cpp
engines/buried/buried.cpp
engines/buried/buried.h
engines/buried/environ/agent3_lair.cpp
engines/buried/environ/future_apartment.cpp
engines/buried/frame_window.cpp
engines/buried/frame_window.h
engines/buried/gameui.cpp
engines/buried/gameui.h
engines/buried/main_menu.cpp
engines/buried/message.h
engines/buried/metaengine.cpp
engines/buried/navarrow.cpp
engines/buried/navarrow.h
engines/buried/overview.cpp
engines/buried/overview.h
engines/buried/scene_view.cpp
engines/buried/scene_view.h
engines/buried/sound.cpp
engines/buried/title_sequence.cpp
engines/buried/title_sequence.h
engines/buried/video_window.cpp
engines/buried/video_window.h
engines/buried/window.cpp
engines/buried/window.h
diff --git a/engines/buried/biochip_right.cpp b/engines/buried/biochip_right.cpp
index 5d6b8f66a05..b6acbe4e014 100644
--- a/engines/buried/biochip_right.cpp
+++ b/engines/buried/biochip_right.cpp
@@ -282,6 +282,8 @@ void BioChipRightWindow::onLButtonUp(const Common::Point &point, uint flags) {
_vm->_sound->playInterfaceSound(_vm->getFilePath(IDS_BC_CLOAKING_SOUND_FILENAME));
video->playToFrame(23);
+ _vm->enableCutsceneKeymap(true);
+
while (!_vm->shouldQuit() && video->getMode() != VideoWindow::kModeStopped) {
_vm->yield(video, -1);
_vm->_sound->timerCallback();
@@ -290,6 +292,8 @@ void BioChipRightWindow::onLButtonUp(const Common::Point &point, uint flags) {
_vm->_sound->timerCallback();
delete video;
+ _vm->enableCutsceneKeymap(false);
+
invalidateWindow(false);
((GameUIWindow *)_parent)->_sceneViewWindow->getGlobalFlags().bcCloakingEnabled = 1;
@@ -319,6 +323,8 @@ void BioChipRightWindow::onLButtonUp(const Common::Point &point, uint flags) {
_vm->_sound->playInterfaceSound(_vm->getFilePath(IDS_BC_CLOAKING_SOUND_FILENAME));
video->playToFrame(47);
+ _vm->enableCutsceneKeymap(true);
+
while (!_vm->shouldQuit() && video->getMode() != VideoWindow::kModeStopped) {
_vm->yield(video, -1);
_vm->_sound->timerCallback();
@@ -327,6 +333,8 @@ void BioChipRightWindow::onLButtonUp(const Common::Point &point, uint flags) {
_vm->_sound->timerCallback();
delete video;
+ _vm->enableCutsceneKeymap(false);
+
invalidateWindow(false);
((GameUIWindow *)_parent)->_sceneViewWindow->getGlobalFlags().bcCloakingEnabled = 0;
diff --git a/engines/buried/buried.cpp b/engines/buried/buried.cpp
index 107f9cdba1e..ef40b34312c 100644
--- a/engines/buried/buried.cpp
+++ b/engines/buried/buried.cpp
@@ -332,13 +332,13 @@ void BuriedEngine::processAudioVideoSkipMessages(VideoWindow *video, int soundId
for (MessageQueue::iterator it = _messageQueue.begin(); it != _messageQueue.end();) {
MessageType messageType = it->message->getMessageType();
- if (messageType == kMessageTypeKeyUp) {
- Common::KeyState keyState = ((KeyUpMessage *)it->message)->getKeyState();
+ if (messageType == kMessageTypeActionEnd) {
+ Common::CustomEventType action = ((ActionEndMessage *)it->message)->getAction();
// Send any skip keyup events to the audio/video players
- if (keyState.keycode == Common::KEYCODE_ESCAPE) {
+ if (action == kActionSkip) {
if (video)
- video->onKeyUp(keyState, ((KeyUpMessage *)it->message)->getFlags());
+ video->onActionEnd(action, ((ActionEndMessage *)it->message)->getFlags());
if (soundId >= 0)
_sound->stopSound(soundId);
@@ -348,12 +348,12 @@ void BuriedEngine::processAudioVideoSkipMessages(VideoWindow *video, int soundId
} else {
++it;
}
- } else if (messageType == kMessageTypeKeyDown) {
- Common::KeyState keyState = ((KeyDownMessage *)it->message)->getKeyState();
+ } else if (messageType == kMessageTypeActionStart) {
+ Common::CustomEventType action = ((ActionStartMessage *)it->message)->getAction();
// Erase any skip video keydown events from the queue, to avoid
// interpreting them as game quit events after the video ends
- if (keyState.keycode == Common::KEYCODE_ESCAPE) {
+ if (action == kActionSkip) {
delete it->message;
it = _messageQueue.erase(it);
} else {
@@ -419,6 +419,10 @@ void BuriedEngine::removeMouseMessages(Window *window) {
removeMessages(window, kMessageTypeMouseBegin, kMessageTypeMouseEnd);
}
+void BuriedEngine::removeActionMessages(Window *window) {
+ removeMessages(window, kMessageTypeActionRangeBegin, kMessageTypeActionRangeEnd);
+}
+
void BuriedEngine::removeAllMessages(Window *window) {
for (MessageQueue::iterator it = _messageQueue.begin(); it != _messageQueue.end();) {
if (it->dest == window) {
@@ -477,13 +481,17 @@ void BuriedEngine::pollForEvents() {
window->postMessage(new SetCursorMessage(kMessageTypeMouseMove));
break;
}
- case Common::EVENT_KEYUP:
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_END:
if (_focusedWindow)
- _focusedWindow->postMessage(new KeyUpMessage(event.kbd, 0));
+ _focusedWindow->postMessage(new ActionEndMessage(event.customType, 0));
+ break;
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+ if (_focusedWindow)
+ _focusedWindow->postMessage(new ActionStartMessage(event.customType, 0));
break;
- case Common::EVENT_KEYDOWN:
+ case Common::EVENT_KEYUP:
if (_focusedWindow)
- _focusedWindow->postMessage(new KeyDownMessage(event.kbd, 0));
+ _focusedWindow->postMessage(new KeyUpMessage(event.kbd, 0));
break;
case Common::EVENT_LBUTTONDOWN: {
Window *window = _captureWindow ? _captureWindow : _mainWindow->childWindowAtPoint(event.mouse);
@@ -642,4 +650,12 @@ void BuriedEngine::handleRestoreDialog() {
bioChipWindow->destroyBioChipViewWindow();
}
+void BuriedEngine::enableCutsceneKeymap(bool enable) {
+ Common::Keymapper *keymapper = g_system->getEventManager()->getKeymapper();
+ keymapper->getKeymap("cutscene")->setEnabled(enable);
+ keymapper->getKeymap("buried-default")->setEnabled(!enable);
+ keymapper->getKeymap("game-shortcuts")->setEnabled(!enable);
+ keymapper->getKeymap("inventory")->setEnabled(!enable);
+}
+
} // End of namespace Buried
diff --git a/engines/buried/buried.h b/engines/buried/buried.h
index 8a812d38f6e..7abb4d7ee56 100644
--- a/engines/buried/buried.h
+++ b/engines/buried/buried.h
@@ -31,6 +31,8 @@
#include "engines/engine.h"
+#include "backends/keymapper/keymapper.h"
+
class OSystem;
struct ADGameDescription;
@@ -55,6 +57,33 @@ enum {
GF_TRIAL = (1 << 4)
};
+enum BURIEDActions {
+ kActionNone,
+ kActionQuit,
+ kActionQuitToMainMenu,
+ kActionQuitToMainMenuInv,
+ kActionSkip,
+ kActionMoveUp,
+ kActionMoveLeft,
+ kActionMoveRight,
+ kActionMoveDown,
+ kActionMoveForward,
+ kActionSave,
+ kActionLoad,
+ kActionPause,
+ kActionAIComment,
+ kActionBiochipAI,
+ kActionBiochipBlank,
+ kActionBiochipCloak,
+ kActionBiochipEvidence,
+ kActionBiochipFiles,
+ kActionBiochipInterface,
+ kActionBiochipJump,
+ kActionBiochipTranslate,
+ kActionPoints,
+ kActionControl,
+};
+
class BuriedConsole;
struct GlobalFlags;
class GraphicsManager;
@@ -128,6 +157,7 @@ public:
void processAudioVideoSkipMessages(VideoWindow *video, int soundId);
void removeKeyboardMessages(Window *window);
void removeMouseMessages(Window *window);
+ void removeActionMessages(Window *window);
void removeAllMessages(Window *window);
void removeMessages(Window *window, int messageBegin, int messageEnd);
bool hasMessage(Window *window, int messageBegin, int messageEnd) const;
@@ -141,6 +171,7 @@ public:
bool isControlDown() const;
void pauseGame();
void showPoints();
+ void enableCutsceneKeymap(bool enable);
// Save/Load
bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
diff --git a/engines/buried/environ/agent3_lair.cpp b/engines/buried/environ/agent3_lair.cpp
index 8bef71c0b8f..183dd9d7836 100644
--- a/engines/buried/environ/agent3_lair.cpp
+++ b/engines/buried/environ/agent3_lair.cpp
@@ -93,6 +93,7 @@ int LairEntry::postEnterRoom(Window *viewWindow, const Location &priorLocation)
// Empty the input queue
_vm->removeMouseMessages(viewWindow);
_vm->removeKeyboardMessages(viewWindow);
+ _vm->removeActionMessages(viewWindow);
return SC_TRUE;
}
@@ -100,6 +101,7 @@ int LairEntry::postEnterRoom(Window *viewWindow, const Location &priorLocation)
// Empty the input queue
_vm->removeMouseMessages(viewWindow);
_vm->removeKeyboardMessages(viewWindow);
+ _vm->removeActionMessages(viewWindow);
// Make sure we have the proper cycle going on
_staticData.cycleStartFrame = 54;
@@ -128,6 +130,8 @@ int LairEntry::postEnterRoom(Window *viewWindow, const Location &priorLocation)
_timerStart = g_system->getMillis();
lastTimerValue = g_system->getMillis();
+ _vm->enableCutsceneKeymap(true);
+
while (!_vm->shouldQuit() && _vm->_sound->isSoundEffectPlaying(_currentSoundID)) {
if (g_system->getMillis() - lastTimerValue >= 50) {
timerCallback(viewWindow);
@@ -140,6 +144,8 @@ int LairEntry::postEnterRoom(Window *viewWindow, const Location &priorLocation)
_vm->_sound->stopSoundEffect(_currentSoundID);
+ _vm->enableCutsceneKeymap(false);
+
_vm->_gfx->setCursor(oldCursor);
((SceneViewWindow *)viewWindow)->playSynchronousAnimation(11);
oldCursor = _vm->_gfx->setCursor(kCursorWait);
@@ -157,6 +163,8 @@ int LairEntry::postEnterRoom(Window *viewWindow, const Location &priorLocation)
_timerStart = g_system->getMillis();
lastTimerValue = g_system->getMillis();
+ _vm->enableCutsceneKeymap(true);
+
while (!_vm->shouldQuit() && _vm->_sound->isSoundEffectPlaying(_currentSoundID)) {
if (g_system->getMillis() - lastTimerValue >= 50) {
timerCallback(viewWindow);
@@ -169,6 +177,8 @@ int LairEntry::postEnterRoom(Window *viewWindow, const Location &priorLocation)
_vm->_sound->stopSoundEffect(_currentSoundID);
+ _vm->enableCutsceneKeymap(false);
+
_staticData.cycleStartFrame = 0;
_staticData.cycleFrameCount = 54;
_frameCycleCount = _staticData.cycleStartFrame;
@@ -189,6 +199,7 @@ int LairEntry::postEnterRoom(Window *viewWindow, const Location &priorLocation)
// Empty the input queue
_vm->removeMouseMessages(viewWindow);
_vm->removeKeyboardMessages(viewWindow);
+ _vm->removeActionMessages(viewWindow);
_vm->_gfx->setCursor(oldCursor);
return SC_TRUE;
@@ -332,6 +343,8 @@ int LairEntry::onCharacter(Window *viewWindow, const Common::KeyState &character
if (_currentSoundID >= 0)
_vm->_sound->stopSoundEffect(_currentSoundID);
+ _vm->enableCutsceneKeymap(true);
+
_currentSoundID = _vm->_sound->playSoundEffect(_vm->getFilePath(IDS_AGENT3_VIRUS_SOUND_BASE + 5), 128, false, true);
_timerStart = g_system->getMillis();
@@ -343,6 +356,8 @@ int LairEntry::onCharacter(Window *viewWindow, const Common::KeyState &character
_vm->yield(nullptr, effectsIndexBase + _currentSoundID);
}
+ _vm->enableCutsceneKeymap(false);
+
_vm->_sound->stopSoundEffect(_currentSoundID);
((GameUIWindow *)viewWindow->getParent())->_inventoryWindow->removeItem(kItemBioChipAI);
((GameUIWindow *)viewWindow->getParent())->_inventoryWindow->addItem(kItemBioChipBlank);
diff --git a/engines/buried/environ/future_apartment.cpp b/engines/buried/environ/future_apartment.cpp
index 08d88cf16fa..027f73698fd 100644
--- a/engines/buried/environ/future_apartment.cpp
+++ b/engines/buried/environ/future_apartment.cpp
@@ -1891,6 +1891,7 @@ int ViewEnvironCart::timerCallback(Window *viewWindow) {
BuriedEngine *vm = _vm;
vm->removeMouseMessages(viewWindow);
vm->removeKeyboardMessages(viewWindow);
+ vm->removeActionMessages(viewWindow);
// Make the jump to Agent 3's lair
DestinationScene newScene;
@@ -1903,6 +1904,7 @@ int ViewEnvironCart::timerCallback(Window *viewWindow) {
vm->removeMouseMessages(viewWindow);
vm->removeKeyboardMessages(viewWindow);
+ vm->removeActionMessages(viewWindow);
}
return SC_TRUE;
diff --git a/engines/buried/frame_window.cpp b/engines/buried/frame_window.cpp
index ad3881ec69b..28411027e8e 100644
--- a/engines/buried/frame_window.cpp
+++ b/engines/buried/frame_window.cpp
@@ -27,6 +27,8 @@
#include "common/system.h"
#include "graphics/surface.h"
+#include "backends/keymapper/keymapper.h"
+
#include "buried/buried.h"
#include "buried/complete.h"
#include "buried/credits.h"
@@ -116,11 +118,15 @@ bool FrameWindow::showTitleSequence() {
_vm->removeMouseMessages(this);
_vm->removeMouseMessages(video);
+ _vm->enableCutsceneKeymap(true);
+
while (!_vm->shouldQuit() && video->getMode() != VideoWindow::kModeStopped && !_vm->hasMessage(this, kMessageTypeLButtonDown, kMessageTypeLButtonDown))
_vm->yield(video, -1);
delete video;
+ _vm->enableCutsceneKeymap(false);
+
invalidateWindow();
return true;
}
@@ -129,6 +135,11 @@ bool FrameWindow::showMainMenu() {
_gameInProgress = false;
_atMainMenu = true;
+ Common::Keymapper *keymapper = g_system->getEventManager()->getKeymapper();
+ keymapper->disableAllGameKeymaps();
+ keymapper->getKeymap("buried-default")->setEnabled(true);
+ keymapper->getKeymap("main-menu")->setEnabled(true);
+
// If we still have a child window, delete it now
delete _mainChildWindow;
_mainChildWindow = nullptr;
@@ -154,6 +165,11 @@ bool FrameWindow::returnToMainMenu() {
_gameInProgress = false;
_atMainMenu = true;
+ Common::Keymapper *keymapper = g_system->getEventManager()->getKeymapper();
+ keymapper->disableAllGameKeymaps();
+ keymapper->getKeymap("buried-default")->setEnabled(true);
+ keymapper->getKeymap("main-menu")->setEnabled(true);
+
// Kill the ambient and restart it
_vm->_sound->restart();
_vm->_sound->setAmbientSound();
@@ -201,6 +217,7 @@ bool FrameWindow::showClosingScreen() {
_vm->removeMouseMessages(this);
_vm->removeKeyboardMessages(this);
+ _vm->removeActionMessages(this);
// If we still have a child window, delete it now
delete _mainChildWindow;
@@ -219,8 +236,10 @@ bool FrameWindow::showClosingScreen() {
// Empty the input queue
_vm->removeMouseMessages(this);
_vm->removeKeyboardMessages(this);
+ _vm->removeActionMessages(this);
_vm->removeMouseMessages(_mainChildWindow);
_vm->removeKeyboardMessages(_mainChildWindow);
+ _vm->removeActionMessages(_mainChildWindow);
return true;
}
@@ -252,6 +271,9 @@ bool FrameWindow::startNewGame(bool walkthrough, bool introMovie) {
_mainChildWindow->showWindow(kWindowShow);
setFocus();
+ Common::Keymapper *keymapper = g_system->getEventManager()->getKeymapper();
+ keymapper->getKeymap("main-menu")->setEnabled(false);
+
if (introMovie)
((GameUIWindow *)_mainChildWindow)->startNewGameIntro(walkthrough);
else
@@ -352,24 +374,36 @@ bool FrameWindow::onEraseBackground() {
return true;
}
-void FrameWindow::onKeyDown(const Common::KeyState &key, uint flags) {
- _controlDown = (key.flags & Common::KBD_CTRL) != 0;
+void FrameWindow::onActionStart(const Common::CustomEventType &action, uint flags) {
+ if (action == kActionControl)
+ _controlDown = true;
- if (key.keycode == Common::KEYCODE_ESCAPE) {
+ switch (action) {
+ case kActionQuitToMainMenu:
if (_gameInProgress || !_atMainMenu) {
// Ask if the player wants to return
if (_vm->runQuitDialog())
showMainMenu();
- } else {
- // Quit from the main menu
- _vm->quitGame();
}
+ break;
+ case kActionQuit:
+ // Quit from the main menu
+ _vm->quitGame();
+ break;
+ default:
+ break;
}
}
-void FrameWindow::onKeyUp(const Common::KeyState &key, uint flags) {
- _controlDown = (key.flags & Common::KBD_CTRL) != 0;
+void FrameWindow::onActionEnd(const Common::CustomEventType &action, uint flags) {
+ if (action == kActionControl)
+ _controlDown = false;
+ if (_mainChildWindow)
+ _mainChildWindow->sendMessage(new ActionEndMessage(action, flags));
+}
+
+void FrameWindow::onKeyUp(const Common::KeyState &key, uint flags) {
if (_mainChildWindow)
_mainChildWindow->sendMessage(new KeyUpMessage(key, flags));
}
@@ -403,6 +437,12 @@ void FrameWindow::loadFromState(const Location &location, GlobalFlags &flags, Co
setFocus();
}
+ Common::Keymapper *keymapper = g_system->getEventManager()->getKeymapper();
+ keymapper->disableAllGameKeymaps();
+ keymapper->getKeymap("buried-default")->setEnabled(true);
+ keymapper->getKeymap("game-shortcuts")->setEnabled(true);
+ keymapper->getKeymap("inventory")->setEnabled(true);
+
GameUIWindow *gameUI = (GameUIWindow *)_mainChildWindow;
// Set the flags
diff --git a/engines/buried/frame_window.h b/engines/buried/frame_window.h
index f6c1d2cfd1a..f4a488498ff 100644
--- a/engines/buried/frame_window.h
+++ b/engines/buried/frame_window.h
@@ -51,7 +51,8 @@ public:
bool setTimerPause(bool pause);
bool onEraseBackground();
- void onKeyDown(const Common::KeyState &key, uint flags);
+ void onActionStart(const Common::CustomEventType &action, uint flags);
+ void onActionEnd(const Common::CustomEventType &action, uint flags);
void onKeyUp(const Common::KeyState &key, uint flags);
void onTimer(uint timer);
void onKillFocus(Window *newWindow);
diff --git a/engines/buried/gameui.cpp b/engines/buried/gameui.cpp
index 026c15f5c7e..86c9f4470a3 100644
--- a/engines/buried/gameui.cpp
+++ b/engines/buried/gameui.cpp
@@ -42,6 +42,8 @@
#include "common/system.h"
#include "graphics/surface.h"
+#include "backends/keymapper/keymapper.h"
+
namespace Buried {
GameUIWindow::GameUIWindow(BuriedEngine *vm, Window *parent) : Window(vm, parent) {
@@ -76,6 +78,10 @@ bool GameUIWindow::startNewGame(bool walkthrough) {
_sceneViewWindow->showWindow(kWindowShow);
_sceneViewWindow->startNewGame(walkthrough);
+ Common::Keymapper *keymapper = g_system->getEventManager()->getKeymapper();
+ keymapper->getKeymap("game-shortcuts")->setEnabled(true);
+ keymapper->getKeymap("inventory")->setEnabled(true);
+
return true;
}
@@ -94,11 +100,15 @@ bool GameUIWindow::startNewGameIntro(bool walkthrough) {
_vm->_sound->stop();
video->playVideo();
+ _vm->enableCutsceneKeymap(true);
+
while (!_vm->shouldQuit() && video->getMode() != VideoWindow::kModeStopped)
_vm->yield(video, -1);
delete video;
+ _vm->enableCutsceneKeymap(false);
+
if (_vm->shouldQuit())
return false;
@@ -113,6 +123,7 @@ bool GameUIWindow::startNewGameIntro(bool walkthrough) {
_sceneViewWindow->showWindow(kWindowShow);
_sceneViewWindow->startNewGameIntro(walkthrough);
+ _vm->enableCutsceneKeymap(false);
return true;
}
@@ -291,50 +302,47 @@ void GameUIWindow::onEnable(bool enable) {
_vm->removeMouseMessages(this);
}
-void GameUIWindow::onKeyUp(const Common::KeyState &key, uint flags) {
+void GameUIWindow::onActionEnd(const Common::CustomEventType &action, uint flags) {
const bool cloakingDisabled = _sceneViewWindow->getGlobalFlags().bcCloakingEnabled != 1;
const bool interfaceMenuActive = (_bioChipRightWindow->getCurrentBioChip() == kItemBioChipInterface);
- switch (key.keycode) {
- case Common::KEYCODE_KP4:
- case Common::KEYCODE_LEFT:
- case Common::KEYCODE_KP6:
- case Common::KEYCODE_RIGHT:
- case Common::KEYCODE_KP2:
- case Common::KEYCODE_DOWN:
- case Common::KEYCODE_KP8:
- case Common::KEYCODE_UP:
- case Common::KEYCODE_KP5:
+ switch (action) {
+ case kActionMoveLeft:
+ case kActionMoveRight:
+ case kActionMoveDown:
+ case kActionMoveUp:
+ case kActionMoveForward:
if (_navArrowWindow->isWindowEnabled())
- _navArrowWindow->sendMessage(new KeyUpMessage(key, flags));
+ _navArrowWindow->sendMessage(new ActionEndMessage(action, flags));
break;
- case Common::KEYCODE_s:
- if ((key.flags & Common::KBD_CTRL) && cloakingDisabled && !interfaceMenuActive) {
+ case kActionSave:
+ if (cloakingDisabled && !interfaceMenuActive) {
_vm->handleSaveDialog();
((FrameWindow *)_vm->_mainWindow)->_controlDown = false;
- } else if (_sceneViewWindow)
- _sceneViewWindow->sendMessage(new KeyUpMessage(key, flags));
+ }
break;
- case Common::KEYCODE_o:
- case Common::KEYCODE_l:
- if ((key.flags & Common::KBD_CTRL) && cloakingDisabled && !interfaceMenuActive) {
+ case kActionLoad:
+ if (cloakingDisabled && !interfaceMenuActive) {
_vm->handleRestoreDialog();
((FrameWindow *)_vm->_mainWindow)->_controlDown = false;
- } else if (_sceneViewWindow)
- _sceneViewWindow->sendMessage(new KeyUpMessage(key, flags));
+ }
break;
- case Common::KEYCODE_p:
- if ((key.flags & Common::KBD_CTRL) && cloakingDisabled && !interfaceMenuActive) {
+ case kActionPause:
+ if (cloakingDisabled && !interfaceMenuActive) {
_vm->pauseGame();
((FrameWindow *)_vm->_mainWindow)->_controlDown = false;
- } else if (_sceneViewWindow)
- _sceneViewWindow->sendMessage(new KeyUpMessage(key, flags));
+ }
break;
default:
if (_sceneViewWindow)
- _sceneViewWindow->sendMessage(new KeyUpMessage(key, flags));
+ _sceneViewWindow->sendMessage(new ActionEndMessage(action, flags));
break;
}
}
+void GameUIWindow::onKeyUp(const Common::KeyState &key, uint flags) {
+ if (_sceneViewWindow)
+ _sceneViewWindow->sendMessage(new KeyUpMessage(key, flags));
+}
+
} // End of namespace Buried
diff --git a/engines/buried/gameui.h b/engines/buried/gameui.h
index 54820e3f8d8..c5790f7a47b 100644
--- a/engines/buried/gameui.h
+++ b/engines/buried/gameui.h
@@ -56,6 +56,7 @@ public:
void onPaint();
void onEnable(bool enable);
void onKeyUp(const Common::KeyState &key, uint flags);
+ void onActionEnd(const Common::CustomEventType &action, uint flags);
NavArrowWindow *_navArrowWindow;
LiveTextWindow *_liveTextWindow;
diff --git a/engines/buried/main_menu.cpp b/engines/buried/main_menu.cpp
index 0d3f7dfa1a5..7a5b209ed98 100644
--- a/engines/buried/main_menu.cpp
+++ b/engines/buried/main_menu.cpp
@@ -33,6 +33,8 @@
#include "common/error.h"
#include "graphics/surface.h"
+#include "backends/keymapper/keymapper.h"
+
namespace Buried {
enum {
@@ -110,6 +112,8 @@ bool MainMenuWindow::showMainMenu() {
_vm->removeKeyboardMessages(this);
_vm->removeKeyboardMessages(_parent);
+ _vm->removeActionMessages(this);
+ _vm->removeActionMessages(_parent);
showWindow(kWindowShow);
invalidateWindow();
@@ -205,6 +209,10 @@ void MainMenuWindow::onLButtonUp(const Common::Point &point, uint flags) {
// Play the intro movie
VideoWindow *video = new VideoWindow(_vm, this);
+ Common::Keymapper *keymapper = g_system->getEventManager()->getKeymapper();
+ keymapper->disableAllGameKeymaps();
+ keymapper->getKeymap("cutscene")->setEnabled(true);
+
if (video->openVideo("BITDATA/INTRO/INTRO_O.BTV")) {
video->setWindowPos(nullptr, 104, 145, 0, 0, kWindowPosNoSize | kWindowPosNoZOrder);
video->enableWindow(false);
@@ -220,6 +228,10 @@ void MainMenuWindow::onLButtonUp(const Common::Point &point, uint flags) {
delete video;
+ keymapper->getKeymap("cutscene")->setEnabled(false);
+ keymapper->getKeymap("main-menu")->setEnabled(true);
+ keymapper->getKeymap("buried-default")->setEnabled(true);
+
if (_vm->shouldQuit())
return;
@@ -230,7 +242,12 @@ void MainMenuWindow::onLButtonUp(const Common::Point &point, uint flags) {
}
return;
case BUTTON_RESTORE_GAME:
- _vm->loadGameDialog();
+ if(_vm->loadGameDialog()) {
+ Common::Keymapper *keymapper = g_system->getEventManager()->getKeymapper();
+ keymapper->getKeymap("main-menu")->setEnabled(false);
+ keymapper->getKeymap("game-shortcuts")->setEnabled(true);
+ keymapper->getKeymap("inventory")->setEnabled(true);
+ }
return;
case BUTTON_CREDITS:
((FrameWindow *)_parent)->showCredits();
diff --git a/engines/buried/message.h b/engines/buried/message.h
index 25f1b7359ee..236766d1472 100644
--- a/engines/buried/message.h
+++ b/engines/buried/message.h
@@ -22,6 +22,7 @@
#ifndef BURIED_MESSAGE_H
#define BURIED_MESSAGE_H
+#include "common/events.h"
#include "common/keyboard.h"
#include "common/rect.h"
@@ -45,12 +46,16 @@ enum MessageType {
kMessageTypeRButtonDown,
kMessageTypeSetCursor,
kMessageTypeEnable,
+ kMessageTypeActionStart,
+ kMessageTypeActionEnd,
// Ranges of messages
kMessageTypeMouseBegin = kMessageTypeMouseMove,
kMessageTypeMouseEnd = kMessageTypeRButtonDown,
kMessageTypeKeyBegin = kMessageTypeKeyUp,
- kMessageTypeKeyEnd = kMessageTypeKeyDown
+ kMessageTypeKeyEnd = kMessageTypeKeyDown,
+ kMessageTypeActionRangeBegin = kMessageTypeActionStart,
+ kMessageTypeActionRangeEnd = kMessageTypeActionEnd
};
@@ -95,6 +100,19 @@ private:
uint _flags;
};
+template <MessageType type>
+class ActionMessage : public MessageTypeIntern<type> {
+public:
+ ActionMessage(const Common::CustomEventType &action, uint flags) : _action(action), _flags(flags) {}
+
+ Common::CustomEventType getAction() const { return _action; }
+ uint getFlags() const { return _flags; }
+
+private:
+ Common::CustomEventType _action;
+ uint _flags;
+};
+
// Types for everything that falls under one of the above categories
typedef KeyMessage<kMessageTypeKeyUp> KeyUpMessage;
typedef KeyMessage<kMessageTypeKeyDown> KeyDownMessage;
@@ -104,6 +122,8 @@ typedef MouseMessage<kMessageTypeLButtonDown> LButtonDownMessage;
typedef MouseMessage<kMessageTypeMButtonUp> MButtonUpMessage;
typedef MouseMessage<kMessageTypeRButtonUp> RButtonUpMessage;
typedef MouseMessage<kMessageTypeRButtonDown> RButtonDownMessage;
+typedef ActionMessage<kMessageTypeActionStart> ActionStartMessage;
+typedef ActionMessage<kMessageTypeActionEnd> ActionEndMessage;
// ...and the rest
class SetCursorMessage : public MessageTypeIntern<kMessageTypeSetCursor> {
diff --git a/engines/buried/metaengine.cpp b/engines/buried/metaengine.cpp
index c6de121e7d5..3648d0b8e12 100644
--- a/engines/buried/metaengine.cpp
+++ b/engines/buried/metaengine.cpp
@@ -30,6 +30,10 @@
#include "buried/buried.h"
#include "buried/detection.h"
+#include "backends/keymapper/action.h"
+#include "backends/keymapper/keymapper.h"
+#include "backends/keymapper/standard-actions.h"
+
namespace Buried {
static const ADExtraGuiOptionsMap optionsList[] = {
@@ -107,6 +111,7 @@ public:
// We set a standard target because saves are compatible among all versions
return AdvancedMetaEngine::getSavegameFile(saveGameIdx, "buried");
}
+ Common::KeymapArray initKeymaps(const char *target) const override;
};
bool BuriedMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -121,6 +126,183 @@ Common::Error BuriedMetaEngine::createInstance(OSystem *syst, Engine **engine, c
return Common::kNoError;
}
+Common::KeymapArray BuriedMetaEngine::initKeymaps(const char *target) const {
+ using namespace Common;
+ using namespace Buried;
+
+ Keymap *engineKeyMap = new Keymap(Keymap::kKeymapTypeGame, "buried-default", _("Default keymappings"));
+ Keymap *cutSceneKeyMap = new Keymap(Keymap::kKeymapTypeGame, "cutscene", _("Cutscene keymappings"));
+ Keymap *mainMenuKeyMap = new Keymap(Keymap::kKeymapTypeGame, "main-menu", _("Main menu keymappings"));
+ Keymap *gameKeyMap = new Keymap(Keymap::kKeymapTypeGame, "game-shortcuts", _("Game keymappings"));
+ Keymap *inventoryKeyMap = new Keymap(Keymap::kKeymapTypeGame, "inventory", _("Inventory keymappings"));
+
+ Action *act;
+
+ act = new Action(kStandardActionLeftClick, _("Select / Interact"));
+ act->setLeftClickEvent();
+ act->addDefaultInputMapping("MOUSE_LEFT");
+ act->addDefaultInputMapping("JOY_A");
+ engineKeyMap->addAction(act);
+
+ // I18N: This action refers to the control key on the keyboard.
+ act = new Action("CTRL", _("Control key"));
+ act->setCustomEngineActionEvent(kActionControl);
+ act->addDefaultInputMapping("LCTRL");
+ act->addDefaultInputMapping("RCTRL");
+ engineKeyMap->addAction(act);
+
+ act = new Action("QUIT", _("Quit"));
+ act->setCustomEngineActionEvent(kActionQuit);
+ act->addDefaultInputMapping("ESCAPE");
+ mainMenuKeyMap->addAction(act);
+
+ if (ConfMan.getBool("skip_support", target)) {
+ act = new Action("SKIP", _("Skip cutscene"));
+ act->setCustomEngineActionEvent(kActionSkip);
+ act->addDefaultInputMapping("ESCAPE");
+ act->addDefaultInputMapping("JOY_Y");
+ cutSceneKeyMap->addAction(act);
+ }
+
+ act = new Action("PAUSE", _("Pause"));
+ act->setCustomEngineActionEvent(kActionPause);
+ act->addDefaultInputMapping("C+p");
+ act->addDefaultInputMapping("JOY_LEFT_SHOULDER");
+ gameKeyMap->addAction(act);
+
+ act = new Action("QUITMENU", _("Quit to main menu"));
+ act->setCustomEngineActionEvent(kActionQuitToMainMenu);
+ act->addDefaultInputMapping("ESCAPE");
+ act->addDefaultInputMapping("JOY_B");
+ gameKeyMap->addAction(act);
+
+ act = new Action("SAVE", _("Save game"));
+ act->setCustomEngineActionEvent(kActionSave);
+ act->addDefaultInputMapping("C+s");
+ gameKeyMap->addAction(act);
+
+ act = new Action("LOAD", _("Load game"));
+ act->setCustomEngineActionEvent(kActionLoad);
+ act->addDefaultInputMapping("C+l");
+ act->addDefaultInputMapping("C+o");
+ gameKeyMap->addAction(act);
+
+ act = new Action("MOVEUP", _("Look up"));
+ act->setCustomEngineActionEvent(kActionMoveUp);
+ act->addDefaultInputMapping("UP");
+ act->addDefaultInputMapping("KP8");
+ act->addDefaultInputMapping("JOY_UP");
+ gameKeyMap->addAction(act);
+
+ act = new Action("MOVEDOWN", _("Look down"));
+ act->setCustomEngineActionEvent(kActionMoveDown);
+ act->addDefaultInputMapping("DOWN");
+ act->addDefaultInputMapping("KP2");
+ act->addDefaultInputMapping("JOY_DOWN");
+ gameKeyMap->addAction(act);
+
+ act = new Action("MOVELEFT", _("Look left"));
+ act->setCustomEngineActionEvent(kActionMoveLeft);
+ act->addDefaultInputMapping("LEFT");
+ act->addDefaultInputMapping("KP4");
+ act->addDefaultInputMapping("JOY_LEFT");
+ gameKeyMap->addAction(act);
+
+ act = new Action("MOVERIGHT", _("Look right"));
+ act->setCustomEngineActionEvent(kActionMoveRight);
+ act->addDefaultInputMapping("RIGHT");
+ act->addDefaultInputMapping("KP6");
+ act->addDefaultInputMapping("JOY_RIGHT");
+ gameKeyMap->addAction(act);
+
+ act = new Action("MOVEFORWARD", _("Move forward"));
+ act->setCustomEngineActionEvent(kActionMoveForward);
+ act->addDefaultInputMapping("KP5");
+ act->addDefaultInputMapping("JOY_X");
+ gameKeyMap->addAction(act);
+
+ act = new Action("QUITMENUINV", _("Quit to main menu"));
+ act->setCustomEngineActionEvent(kActionQuitToMainMenuInv);
+ act->addDefaultInputMapping("C+q");
+ gameKeyMap->addAction(act);
+
+ // I18N: AI is Artificial Intelligence
+ act = new Action("AICOMMENTS", _("Replay last AI comment"));
+ act->setCustomEngineActionEvent(kActionAIComment);
+ act->addDefaultInputMapping("SPACE");
+ act->addDefaultInputMapping("JOY_RIGHT_SHOULDER");
+ inventoryKeyMap->addAction(act);
+
+ // I18N: The game has an inventory with a list of biochips. This action is used to switch the equipped biochip to the Artificial Intelligence biochip.
+ act = new Action("BIOAI", _("Biochip AI"));
+ act->setCustomEngineActionEvent(kActionBiochipAI);
+ act->addDefaultInputMapping("C+a");
+ inventoryKeyMap->addAction(act);
+
+ // I18N: The game has an inventory with a list of biochips. This action is used to switch the equipped biochip to the blank biochip.
+ act = new Action("BIOBLANK", _("Biochip blank"));
+ act->setCustomEngineActionEvent(kActionBiochipBlank);
+ act->addDefaultInputMapping("C+b");
+ inventoryKeyMap->addAction(act);
+
+ // I18N: The game has an inventory with a list of biochips. This action is used to switch the equipped biochip to the cloak biochip.
+ act = new Action("BIOCLOAK", _("Biochip cloak"));
+ act->setCustomEngineActionEvent(kActionBiochipCloak);
+ act->addDefaultInputMapping("C+c");
+ inventoryKeyMap->addAction(act);
+
+ // I18N: The game has an inventory with a list of biochips. This action is used to switch the equipped biochip to the evidence biochip.
+ act = new Action("BIOEVIDENCE", _("Biochip evidence"));
+ act->setCustomEngineActionEvent(kActionBiochipEvidence);
+ act->addDefaultInputMapping("C+e");
+ inventoryKeyMap->addAction(act);
+
+ // I18N: The game has an inventory with a list of biochips. This action is used to switch the equipped biochip to the files biochip.
+ act = new Action("BIOFILES", _("Biochip files"));
+ act->setCustomEngineActionEvent(kActionBiochipFiles);
+ act->addDefaultInputMapping("C+f");
+ inventoryKeyMap->addAction(act);
+
+ // I18N: The game has an inventory with a list of biochips. This action is used to switch the equipped biochip to the interface biochip.
+ act = new Action("BIOINTERFACE", _("Biochip interface"));
+ act->setCustomEngineActionEvent(kActionBiochipInterface);
+ act->addDefaultInputMapping("C+i");
+ inventoryKeyMap->addAction(act);
+
+ // I18N: The game has an inventory with a list of biochips. This action is used to switch the equipped biochip to the jump biochip.
+ act = new Action("BIOJUMP", _("Biochip jump"));
+ act->setCustomEngineActionEvent(kActionBiochipJump);
+ act->addDefaultInputMapping("C+j");
+ inventoryKeyMap->addAction(act);
+
+ // I18N: The game has an inventory with a list of biochips. This action is used to switch the equipped biochip to the translate biochip.
+ act = new Action("BIOTRANSLATE", _("Biochip translate"));
+ act->setCustomEngineActionEvent(kActionBiochipTranslate);
+ act->addDefaultInputMapping("C+t");
+ inventoryKeyMap->addAction(act);
+
+ // I18N: Shows a summary of collected points in the game.
+ act = new Action("SHOWPOINTS", _("Show points"));
+ act->setCustomEngineActionEvent(kActionPoints);
+ act->addDefaultInputMapping("C+d");
+ inventoryKeyMap->addAction(act);
+
+ Common::KeymapArray keymaps(5);
+
+ keymaps[0] = engineKeyMap;
+ keymaps[1] = cutSceneKeyMap;
+ keymaps[2] = mainMenuKeyMap;
+ keymaps[3] = gameKeyMap;
+ keymaps[4] = inventoryKeyMap;
+
+ cutSceneKeyMap->setEnabled(false);
+ mainMenuKeyMap->setEnabled(false);
+ gameKeyMap->setEnabled(false);
+ inventoryKeyMap->setEnabled(false);
+
+ return keymaps;
+}
+
#if PLUGIN_ENABLED_DYNAMIC(BURIED)
REGISTER_PLUGIN_DYNAMIC(BURIED, PLUGIN_TYPE_ENGINE, BuriedMetaEngine);
#else
diff --git a/engines/buried/navarrow.cpp b/engines/buried/navarrow.cpp
index 08e50f9192a..be54eef5289 100644
--- a/engines/buried/navarrow.cpp
+++ b/engines/buried/navarrow.cpp
@@ -200,29 +200,25 @@ void NavArrowWindow::onLButtonDown(const Common::Point &point, uint flags) {
}
}
-void NavArrowWindow::onKeyUp(const Common::KeyState &key, uint flags) {
- switch (key.keycode) {
- case Common::KEYCODE_KP4:
- case Common::KEYCODE_LEFT:
+void NavArrowWindow::onActionEnd(const Common::CustomEventType &action, uint flags) {
+ switch (action) {
+ case kActionMoveLeft:
if (_arrowStatus[1] == BUTTON_ENABLED)
((GameUIWindow *)_parent)->_sceneViewWindow->moveInDirection(kDirectionLeft);
break;
- case Common::KEYCODE_KP6:
- case Common::KEYCODE_RIGHT:
+ case kActionMoveRight:
if (_arrowStatus[2] == BUTTON_ENABLED)
((GameUIWindow *)_parent)->_sceneViewWindow->moveInDirection(kDirectionRight);
break;
- case Common::KEYCODE_KP2:
- case Common::KEYCODE_DOWN:
+ case kActionMoveDown:
if (_arrowStatus[3] == BUTTON_ENABLED)
((GameUIWindow *)_parent)->_sceneViewWindow->moveInDirection(kDirectionDown);
break;
- case Common::KEYCODE_KP8:
- case Common::KEYCODE_UP:
+ case kActionMoveUp:
if (_arrowStatus[0] == BUTTON_ENABLED)
((GameUIWindow *)_parent)->_sceneViewWindow->moveInDirection(kDirectionUp);
break;
- case Common::KEYCODE_KP5:
+ case kActionMoveForward:
if (_arrowStatus[4] == BUTTON_ENABLED)
((GameUIWindow *)_parent)->_sceneViewWindow->moveInDirection(kDirectionForward);
break;
diff --git a/engines/buried/navarrow.h b/engines/buried/navarrow.h
index f5da0a1ac5f..78789af0e07 100644
--- a/engines/buried/navarrow.h
+++ b/engines/buried/navarrow.h
@@ -47,7 +47,7 @@ public:
void onPaint();
void onEnable(bool enable);
void onLButtonDown(const Common::Point &point, uint flags);
- void onKeyUp(const Common::KeyState &key, uint flags);
+ void onActionEnd(const Common::CustomEventType &action, uint flags);
enum {
BUTTON_DISABLED = 0,
diff --git a/engines/buried/overview.cpp b/engines/buried/overview.cpp
index f2e76032e7d..fb89cd0ea0c 100644
--- a/engines/buried/overview.cpp
+++ b/engines/buried/overview.cpp
@@ -109,6 +109,10 @@ void OverviewWindow::onKeyUp(const Common::KeyState &key, uint flags) {
_vm->_sound->stopInterfaceSound();
}
+void OverviewWindow::onActionEnd(const Common::CustomEventType &action, uint flags) {
+ _vm->_sound->stopInterfaceSound();
+}
+
void OverviewWindow::onTimer(uint timer) {
_vm->_sound->timerCallback();
diff --git a/engines/buried/overview.h b/engines/buried/overview.h
index 88a7831cb71..c59dc014d14 100644
--- a/engines/buried/overview.h
+++ b/engines/buried/overview.h
@@ -44,6 +44,7 @@ public:
bool onEraseBackground();
void onLButtonUp(const Common::Point &point, uint flags);
void onKeyUp(const Common::KeyState &key, uint flags);
+ void onActionEnd(const Common::CustomEventType &action, uint flags);
void onTimer(uint timer);
private:
diff --git a/engines/buried/scene_view.cpp b/engines/buried/scene_view.cpp
index 07eefab152f..bd3cefe80ba 100644
--- a/engines/buried/scene_view.cpp
+++ b/engines/buried/scene_view.cpp
@@ -744,6 +744,8 @@ bool SceneViewWindow::timeSuitJump(int destination) {
_vm->_sound->setAmbientSound();
_vm->_sound->playInterfaceSound(_vm->getFilePath(IDS_BC_JUMP_AUDIO_FILENAME));
+ _vm->enableCutsceneKeymap(true);
+
// Play the movie
jumpMovie->playToFrame(24);
@@ -752,6 +754,8 @@ bool SceneViewWindow::timeSuitJump(int destination) {
_vm->_sound->timerCallback();
}
+ _vm->enableCutsceneKeymap(false);
+
if (_vm->shouldQuit())
return true;
@@ -791,12 +795,16 @@ bool SceneViewWindow::timeSuitJump(int destination) {
_vm->_sound->stop();
+ _vm->enableCutsceneKeymap(true);
+
// Play the movie
jumpMovie->playVideo();
while (!_vm->shouldQuit() && jumpMovie->getMode() != VideoWindow::kModeStopped)
_vm->yield(jumpMovie.get(), -1);
+ _vm->enableCutsceneKeymap(false);
+
if (_vm->shouldQuit())
return true;
@@ -876,6 +884,8 @@ bool SceneViewWindow::timeSuitJump(int destination) {
startEnvironmentAmbient(oldLocation.timeZone, oldLocation.environment, newLocation.timeZone, newLocation.environment);
_vm->_sound->playInterfaceSound(_vm->getFilePath(IDS_BC_JUMP_AUDIO_FILENAME));
+ _vm->enableCutsceneKeymap(true);
+
// Play the movie
jumpMovie->seekToFrame(24);
jumpMovie->playToFrame(48);
@@ -885,6 +895,8 @@ bool SceneViewWindow::timeSuitJump(int destination) {
_vm->_sound->timerCallback();
}
+ _vm->enableCutsceneKeymap(false);
+
if (_vm->shouldQuit())
return true;
@@ -1053,6 +1065,8 @@ bool SceneViewWindow::videoTransition(const Location &location, DestinationScene
if (audioStream)
_vm->_sound->stop();
+ _vm->enableCutsceneKeymap(true);
+
animationMovie->seekToFrame(destinationData.transitionStartFrame);
animationMovie->showWindow(kWindowShow);
animationMovie->playToFrame(destinationData.transitionStartFrame + destinationData.transitionLength - 1);
@@ -1062,6 +1076,8 @@ bool SceneViewWindow::videoTransition(const Location &location, DestinationScene
_vm->_sound->timerCallback();
}
+ _vm->enableCutsceneKeymap(false);
+
if (_vm->shouldQuit()) {
newBackground->free();
delete newBackground;
@@ -1123,12 +1139,16 @@ bool SceneViewWindow::walkTransition(const Location &location, const Destination
// Start the footsteps
_vm->_sound->startFootsteps(destinationData.transitionData);
+ _vm->enableCutsceneKeymap(true);
+
_walkMovie->playToFrame(destinationData.transitionStartFrame + destinationData.transitionLength - 1);
while (!_vm->shouldQuit() && _walkMovie->getMode() != VideoWindow::kModeStopped) {
_vm->yield(_walkMovie, -1);
_vm->_sound->timerCallback();
}
+ _vm->enableCutsceneKeymap(false);
+
if (_vm->shouldQuit()) {
newBackground->free();
delete newBackground;
@@ -1489,6 +1509,7 @@ bool SceneViewWindow::playSynchronousAnimation(int animationID) {
// Empty the input queue
_vm->removeMouseMessages(this);
_vm->removeKeyboardMessages(this);
+ _vm->removeActionMessages(this);
// Stop background sound if the video has sound
if (animDatabase[i].audioStreamCount > 0)
@@ -1496,16 +1517,21 @@ bool SceneViewWindow::playSynchronousAnimation(int animationID) {
animationMovie->playToFrame(animDatabase[i].startFrame + animDatabase[i].frameCount - 1);
+ _vm->enableCutsceneKeymap(true);
+
while (!_vm->shouldQuit() && animationMovie->getMode() != VideoWindow::kModeStopped) {
_vm->yield(animationMovie.get(), -1);
_vm->_sound->timerCallback();
}
+ _vm->enableCutsceneKeymap(false);
+
if (_vm->shouldQuit())
return true;
_vm->removeMouseMessages(this);
_vm->removeKeyboardMessages(this);
+ _vm->removeActionMessages(this);
// Restart background sound if the video had sound
if (animDatabase[i].audioStreamCount > 0)
@@ -1535,10 +1561,13 @@ bool SceneViewWindow::playSynchronousAnimationExtern(int animationID) {
// Empty the input queue
_vm->removeMouseMessages(this);
_vm->removeKeyboardMessages(this);
+ _vm->removeActionMessages(this);
_vm->_sound->stop();
animationMovie->playVideo();
+ _vm->enableCutsceneKeymap(true);
+
while (!_vm->shouldQuit() && animationMovie->getMode() != VideoWindow::kModeStopped) {
_vm->yield(animationMovie.get(), -1);
_vm->_sound->timerCallback();
@@ -1547,9 +1576,12 @@ bool SceneViewWindow::playSynchronousAnimationExtern(int animationID) {
if (_vm->shouldQuit())
return true;
+ _vm->enableCutsceneKeymap(false);
+
_vm->_sound->restart();
_vm->removeMouseMessages(this);
_vm->removeKeyboardMessages(this);
+ _vm->removeActionMessages(this);
if (_currentScene && _currentScene->movieCallback(this, animationMovie.get(), animationID, MOVIE_STOPPED) == SC_FALSE)
return false;
@@ -1599,11 +1631,14 @@ bool SceneViewWindow::playPlacedSynchronousAnimation(int animationID, int left,
// Empty the input queue
_vm->removeMouseMessages(this);
_vm->removeKeyboardMessages(this);
+ _vm->removeActionMessages(this);
// Stop background sound if the video has sound
if (animDatabase[i].audioStreamCount > 0)
_vm->_sound->stop();
+ _vm->enableCutsceneKeymap(true);
+
animationMovie->playToFrame(animDatabase[i].startFrame + animDatabase[i].frameCount - 1);
while (!_vm->shouldQuit() && animationMovie->getMode() != VideoWindow::kModeStopped) {
@@ -1611,11 +1646,14 @@ bool SceneViewWindow::playPlacedSynchronousAnimation(int animationID, int left,
_vm->_sound->timerCallback();
}
+ _vm->enableCutsceneKeymap(false);
+
if (_vm->shouldQuit())
return true;
_vm->removeMouseMessages(this);
_vm->removeKeyboardMessages(this);
+ _vm->removeActionMessages(this);
// Restart background sound if the video had sound
if (animDatabase[i].audioStreamCount > 0)
@@ -1672,11 +1710,14 @@ bool SceneViewWindow::playClippedSynchronousAnimation(int animationID, int left,
// Empty the input queue
_vm->removeMouseMessages(this);
_vm->removeKeyboardMessages(this);
+ _vm->removeActionMessages(this);
// Stop background sound if the video has sound
if (animDatabase[i].audioStreamCount > 0)
_vm->_sound->stop();
+ _vm->enableCutsceneKeymap(true);
+
animationMovie->playToFrame(animDatabase[i].startFrame + animDatabase[i].frameCount - 1);
while (!_vm->shouldQuit() && animationMovie->getMode() != VideoWindow::kModeStopped) {
@@ -1684,11 +1725,14 @@ bool SceneViewWindow::playClippedSynchronousAnimation(int animationID, int left,
_vm->_sound->timerCallback();
}
+ _vm->enableCutsceneKeymap(false);
+
if (_vm->shouldQuit())
return true;
_vm->removeMouseMessages(this);
_vm->removeKeyboardMessages(this);
+ _vm->removeActionMessages(this);
// Restart background sound if the video had sound
if (animDatabase[i].audioStreamCount > 0)
@@ -2246,75 +2290,69 @@ void SceneViewWindow::onMouseMove(const Common::Point &point, uint flags) {
_currentScene->mouseMove(this, point);
}
-void SceneViewWindow::onKeyUp(const Common::KeyState &key, uint flags) {
- switch (key.keycode) {
- case Common::KEYCODE_a:
- if ((key.flags & Common::KBD_CTRL) && ((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipAI)) {
+void SceneViewWindow::onActionEnd(const Common::CustomEventType &action, uint flags) {
+ switch (action) {
+ case kActionBiochipAI:
+ if (((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipAI)) {
((GameUIWindow *)_parent)->_bioChipRightWindow->changeCurrentBioChip(kItemBioChipAI);
return;
}
break;
- case Common::KEYCODE_b:
- if ((key.flags & Common::KBD_CTRL) && ((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipBlank)) {
+ case kActionBiochipBlank:
+ if (((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipBlank)) {
((GameUIWindow *)_parent)->_bioChipRightWindow->changeCurrentBioChip(kItemBioChipBlank);
return;
}
break;
- case Common::KEYCODE_c:
- if ((key.flags & Common::KBD_CTRL) && ((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipCloak)) {
+ case kActionBiochipCloak:
+ if (((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipCloak)) {
((GameUIWindow *)_parent)->_bioChipRightWindow->changeCurrentBioChip(kItemBioChipCloak);
return;
}
break;
- case Common::KEYCODE_e:
- if ((key.flags & Common::KBD_CTRL) && ((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipEvidence)) {
+ case kActionBiochipEvidence:
+ if (((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipEvidence)) {
((GameUIWindow *)_parent)->_bioChipRightWindow->changeCurrentBioChip(kItemBioChipEvidence);
return;
}
break;
- case Common::KEYCODE_f:
- if ((key.flags & Common::KBD_CTRL) && ((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipFiles)) {
+ case kActionBiochipFiles:
+ if (((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipFiles)) {
((GameUIWindow *)_parent)->_bioChipRightWindow->changeCurrentBioChip(kItemBioChipFiles);
return;
}
break;
- case Common::KEYCODE_i:
- if ((key.flags & Common::KBD_CTRL) && ((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipInterface)) {
+ case kActionBiochipInterface:
+ if (((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipInterface)) {
((GameUIWindow *)_parent)->_bioChipRightWindow->changeCurrentBioChip(kItemBioChipInterface);
return;
}
break;
- case Common::KEYCODE_j:
- if ((key.flags & Common::KBD_CTRL) && ((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipJump)) {
+ case kActionBiochipJump:
+ if (((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipJump)) {
((GameUIWindow *)_parent)->_bioChipRightWindow->changeCurrentBioChip(kItemBioChipJump);
return;
}
break;
- case Common::KEYCODE_t:
- if ((key.flags & Common::KBD_CTRL) && ((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipTranslate)) {
+ case kActionBiochipTranslate:
+ if (((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipTranslate)) {
((GameUIWindow *)_parent)->_bioChipRightWindow->changeCurrentBioChip(kItemBioChipTranslate);
return;
}
break;
- case Common::KEYCODE_q:
- if (key.flags & Common::KBD_CTRL) {
- // Return to main menu
- if (_vm->runQuitDialog())
- ((FrameWindow *)_vm->_mainWindow)->showMainMenu();
- ((FrameWindow *)_vm->_mainWindow)->_controlDown = false;
- return;
- }
- break;
- case Common::KEYCODE_d:
- if (key.flags & Common::KBD_CTRL) {
- // Current points (ScummVM enhancement - Agent evaluation
- // from death screens)
- _vm->showPoints();
- ((FrameWindow *)_vm->_mainWindow)->_controlDown = false;
- return;
- }
- break;
- case Common::KEYCODE_SPACE:
+ case kActionQuitToMainMenuInv:
+ // Return to main menu
+ if (_vm->runQuitDialog())
+ ((FrameWindow *)_vm->_mainWindow)->showMainMenu();
+ ((FrameWindow *)_vm->_mainWindow)->_controlDown = false;
+ return;
+ case kActionPoints:
+ // Current points (ScummVM enhancement - Agent evaluation
+ // from death screens)
+ _vm->showPoints();
+ ((FrameWindow *)_vm->_mainWindow)->_controlDown = false;
+ return;
+ case kActionAIComment:
if (((GameUIWindow *)_parent)->_inventoryWindow->isItemInInventory(kItemBioChipAI) && _globalFlags.bcCloakingEnabled != 1) {
if (!_lastAICommentFileName.empty()) {
if (!_vm->_sound->isAsynchronousAICommentPlaying()) {
@@ -2331,7 +2369,9 @@ void SceneViewWindow::onKeyUp(const Common::KeyState &key, uint flags) {
default:
break;
}
+}
+void SceneViewWindow::onKeyUp(const Common::KeyState &key, uint flags) {
if (_currentScene)
_currentScene->onCharacter(this, key);
}
diff --git a/engines/buried/scene_view.h b/engines/buried/scene_view.h
index 037f36961f7..30413ff4825 100644
--- a/engines/buried/scene_view.h
+++ b/engines/buried/scene_view.h
@@ -140,6 +140,7 @@ public:
void onLButtonUp(const Common::Point &point, uint flags);
void onMouseMove(const Common::Point &point, uint flags);
+ void onActionEnd(const Common::CustomEventType &action, uint flags);
void onKeyUp(const Common::KeyState &key, uint flags);
bool isScenePresent() { return _currentScene != 0; }
diff --git a/engines/buried/sound.cpp b/engines/buried/sound.cpp
index 86ec6362c59..997d3911822 100644
--- a/engines/buried/sound.cpp
+++ b/engines/buried/sound.cpp
@@ -350,6 +350,8 @@ bool SoundManager::playSynchronousAIComment(const Common::Path &fileName) {
// Play the file
bool retVal = _soundData[kAIVoiceIndex]->start();
+ _vm->enableCutsceneKeymap(true);
+
while (retVal && !_vm->shouldQuit() && _soundData[kAIVoiceIndex]->isPlaying()) {
timerCallback();
_vm->yield(nullptr, kAIVoiceIndex);
@@ -359,6 +361,8 @@ bool SoundManager::playSynchronousAIComment(const Common::Path &fileName) {
delete _soundData[kAIVoiceIndex];
_soundData[kAIVoiceIndex] = new Sound();
+ _vm->enableCutsceneKeymap(false);
+
// Return success
return true;
}
@@ -443,6 +447,8 @@ bool SoundManager::playSynchronousSoundEffect(const Common::Path &fileName, int
if (soundChannel < 0)
return false;
+ _vm->enableCutsceneKeymap(true);
+
// Otherwise, assume the sound has started playing and enter a wait and see loop until
// the sound finishes playing
do {
@@ -453,6 +459,8 @@ bool SoundManager::playSynchronousSoundEffect(const Common::Path &fileName, int
// One last callback check
timerCallback();
+ _vm->enableCutsceneKeymap(false);
+
// Reset the cursor
_vm->_gfx->setCursor(oldCursor);
g_system->updateScreen();
diff --git a/engines/buried/title_sequence.cpp b/engines/buried/title_sequence.cpp
index a43da76d6be..af35e592427 100644
--- a/engines/buried/title_sequence.cpp
+++ b/engines/buried/title_sequence.cpp
@@ -154,6 +154,10 @@ void TitleSequenceWindow::onKeyUp(const Common::KeyState &key, uint flags) {
_exitNow = true;
}
+void TitleSequenceWindow::onActionEnd(const Common::CustomEventType &action, uint flags) {
+ _exitNow = true;
+}
+
void TitleSequenceWindow::onTimer(uint timer) {
if (_exitNow || (_currentMovie && _currentMovie->getMode() == VideoWindow::kModeStopped)) {
// Destroy all resources
diff --git a/engines/buried/title_sequence.h b/engines/buried/title_sequence.h
index e171609ae34..85fcb5c03b8 100644
--- a/engines/buried/title_sequence.h
+++ b/engines/buried/title_sequence.h
@@ -48,6 +48,7 @@ public:
void onMButtonUp(const Common::Point &point, uint flags);
void onRButtonUp(const Common::Point &point, uint flags);
void onKeyUp(const Common::KeyState &key, uint flags);
+ void onActionEnd(const Common::CustomEventType &action, uint flags);
void onTimer(uint timer);
private:
diff --git a/engines/buried/video_window.cpp b/engines/buried/video_window.cpp
index d26969ddeea..c00324df41f 100644
--- a/engines/buried/video_window.cpp
+++ b/engines/buried/video_window.cpp
@@ -199,8 +199,8 @@ void VideoWindow::onPaint() {
}
}
-void VideoWindow::onKeyUp(const Common::KeyState &key, uint flags) {
- if (key.keycode == Common::KEYCODE_ESCAPE)
+void VideoWindow::onActionEnd(const Common::CustomEventType &action, uint flags) {
+ if (action == kActionSkip)
stopVideo();
}
diff --git a/engines/buried/video_window.h b/engines/buried/video_window.h
index 6a006800d0f..ccf1c0fa78e 100644
--- a/engines/buried/video_window.h
+++ b/engines/buried/video_window.h
@@ -71,7 +71,7 @@ public:
// Window interface
void onPaint();
- void onKeyUp(const Common::KeyState &key, uint flags);
+ void onActionEnd(const Common::CustomEventType &action, uint flags);
private:
Video::VideoDecoder *_video;
diff --git a/engines/buried/window.cpp b/engines/buried/window.cpp
index 31676d410fc..4e57f19d8be 100644
--- a/engines/buried/window.cpp
+++ b/engines/buried/window.cpp
@@ -79,12 +79,15 @@ Common::Rect Window::getAbsoluteRect() const {
void Window::sendMessage(Message *message) {
switch (message->getMessageType()) {
+ case kMessageTypeActionStart:
+ onActionStart(((ActionStartMessage *)message)->getAction(), ((ActionStartMessage *)message)->getFlags());
+ break;
+ case kMessageTypeActionEnd:
+ onActionEnd(((ActionEndMessage *)message)->getAction(), ((ActionEndMessage *)message)->getFlags());
+ break;
case kMessageTypeKeyUp:
onKeyUp(((KeyUpMessage *)message)->getKeyState(), ((KeyUpMessage *)message)->getFlags());
break;
- case kMessageTypeKeyDown:
- onKeyDown(((KeyDownMessage *)message)->getKeyState(), ((KeyDownMessage *)message)->getFlags());
- break;
case kMessageTypeTimer:
onTimer(((TimerMessage *)message)->getTimer());
break;
diff --git a/engines/buried/window.h b/engines/buried/window.h
index 7c47eabdec1..7351216813a 100644
--- a/engines/buried/window.h
+++ b/engines/buried/window.h
@@ -22,6 +22,7 @@
#ifndef BURIED_WINDOW_H
#define BURIED_WINDOW_H
+#include "common/events.h"
#include "common/rect.h"
#include "common/list.h"
@@ -41,7 +42,8 @@ public:
// The message types used by Buried in Time's windows
virtual bool onEraseBackground() { return false; }
- virtual void onKeyDown(const Common::KeyState &key, uint flags) {}
+ virtual void onActionStart(const Common::CustomEventType &action, uint flags) {}
+ virtual void onActionEnd(const Common::CustomEventType &action, uint flags) {}
virtual void onKeyUp(const Common::KeyState &key, uint flags) {}
virtual void onTimer(uint timer) {}
virtual void onKillFocus(Window *newWindow) {}
More information about the Scummvm-git-logs
mailing list