diff options
author | Robert Špalek | 2009-10-03 22:07:18 +0000 |
---|---|---|
committer | Robert Špalek | 2009-10-03 22:07:18 +0000 |
commit | 3035ca2fd3e5457aedb30dfc002c6bb1303fbbf4 (patch) | |
tree | 141fec42cbfc4a0446d48e3091afc0d945dd8916 | |
parent | c0773975f54dd862fa7d68df900236ea63a6b509 (diff) | |
download | scummvm-rg350-3035ca2fd3e5457aedb30dfc002c6bb1303fbbf4.tar.gz scummvm-rg350-3035ca2fd3e5457aedb30dfc002c6bb1303fbbf4.tar.bz2 scummvm-rg350-3035ca2fd3e5457aedb30dfc002c6bb1303fbbf4.zip |
Let Ctrl-Left click behave like Right lick in Dragon History.
Also, started implementing Advanced Engine Features:
- pause support
- RTL support
svn-id: r44575
-rw-r--r-- | engines/draci/detection.cpp | 3 | ||||
-rw-r--r-- | engines/draci/draci.cpp | 66 | ||||
-rw-r--r-- | engines/draci/draci.h | 10 | ||||
-rw-r--r-- | engines/draci/mouse.cpp | 10 | ||||
-rw-r--r-- | engines/draci/mouse.h | 5 |
5 files changed, 77 insertions, 17 deletions
diff --git a/engines/draci/detection.cpp b/engines/draci/detection.cpp index 37e1af6a85..3fe37ead53 100644 --- a/engines/draci/detection.cpp +++ b/engines/draci/detection.cpp @@ -115,7 +115,8 @@ bool DraciMetaEngine::hasFeature(MetaEngineFeature f) const { } bool Draci::DraciEngine::hasFeature(EngineFeature f) const { - return false; + return (f == kSupportsSubtitleOptions) || + (f == kSupportsRTL); } bool DraciMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp index aaf24430ff..14deb60603 100644 --- a/engines/draci/draci.cpp +++ b/engines/draci/draci.cpp @@ -173,21 +173,24 @@ int DraciEngine::init() { return Common::kNoError; } -bool DraciEngine::handleEvents() { +void DraciEngine::handleEvents() { Common::Event event; - bool quit = false; while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_QUIT: + case Common::EVENT_RTL: _game->setQuit(true); break; case Common::EVENT_KEYDOWN: - if (event.kbd.keycode == Common::KEYCODE_RIGHT) { + switch (event.kbd.keycode) { + case Common::KEYCODE_RIGHT: _game->scheduleEnteringRoomUsingGate(_game->nextRoomNum(), 0); - } else if (event.kbd.keycode == Common::KEYCODE_LEFT) { + break; + case Common::KEYCODE_LEFT: _game->scheduleEnteringRoomUsingGate(_game->prevRoomNum(), 0); - } else if (event.kbd.keycode == Common::KEYCODE_ESCAPE) { + break; + case Common::KEYCODE_ESCAPE: { const int escRoom = _game->getRoomNum() != _game->getMapRoom() ? _game->getEscRoom() : _game->getPreviousRoomNum(); @@ -202,16 +205,20 @@ bool DraciEngine::handleEvents() { // End any currently running GPL programs _script->endCurrentProgram(); } - } else if (event.kbd.keycode == Common::KEYCODE_m) { + break; + } + case Common::KEYCODE_m: if (_game->getLoopStatus() == kStatusOrdinary) { const int new_room = _game->getRoomNum() != _game->getMapRoom() ? _game->getMapRoom() : _game->getPreviousRoomNum(); _game->scheduleEnteringRoomUsingGate(new_room, 0); } - } else if (event.kbd.keycode == Common::KEYCODE_w) { + break; + case Common::KEYCODE_w: // Show walking map toggle _showWalkingMap = !_showWalkingMap; - } else if (event.kbd.keycode == Common::KEYCODE_i) { + break; + case Common::KEYCODE_i: if (_game->getLoopStatus() == kStatusInventory && _game->getLoopSubstatus() == kSubstatusOrdinary) { _game->inventoryDone(); @@ -219,6 +226,31 @@ bool DraciEngine::handleEvents() { _game->getLoopSubstatus() == kSubstatusOrdinary) { _game->inventoryInit(); } + break; + case Common::KEYCODE_LCTRL: + debugC(6, kDraciGeneralDebugLevel, "Left Ctrl down"); + _mouse->downModifier(0); + break; + case Common::KEYCODE_RCTRL: + debugC(6, kDraciGeneralDebugLevel, "Right Ctrl down"); + _mouse->downModifier(1); + break; + default: + break; + } + break; + case Common::EVENT_KEYUP: + switch (event.kbd.keycode) { + case Common::KEYCODE_LCTRL: + debugC(6, kDraciGeneralDebugLevel, "Left Ctrl up"); + _mouse->upModifier(0); + break; + case Common::KEYCODE_RCTRL: + debugC(6, kDraciGeneralDebugLevel, "Right Ctrl up"); + _mouse->upModifier(1); + break; + default: + break; } break; default: @@ -234,9 +266,8 @@ bool DraciEngine::handleEvents() { } else if (!_showWalkingMap && _anims->getAnimation(kWalkingMapOverlay)->isPlaying()) { _anims->stop(kWalkingMapOverlay); } - - return quit; } + DraciEngine::~DraciEngine() { // Dispose your resources here @@ -275,4 +306,19 @@ Common::Error DraciEngine::run() { return Common::kNoError; } +void DraciEngine::pauseEngineIntern(bool pause) { + Engine::pauseEngineIntern(pause); + if (pause) { + _anims->pauseAnimations(); + } else { + _anims->unpauseAnimations(); + } +} + +void DraciEngine::syncSoundSettings() { + Engine::syncSoundSettings(); + + // TODO: update our volumes +} + } // End of namespace Draci diff --git a/engines/draci/draci.h b/engines/draci/draci.h index 926742732b..7876025b9d 100644 --- a/engines/draci/draci.h +++ b/engines/draci/draci.h @@ -43,14 +43,16 @@ namespace Draci { class DraciEngine : public Engine { public: DraciEngine(OSystem *syst, const ADGameDescription *gameDesc); - ~DraciEngine(); + virtual ~DraciEngine(); int init(); - Common::Error run(); + virtual Common::Error run(); - bool hasFeature(Engine::EngineFeature f) const; + virtual bool hasFeature(Engine::EngineFeature f) const; + virtual void pauseEngineIntern(bool pause); + virtual void syncSoundSettings(); - bool handleEvents(); + void handleEvents(); Screen *_screen; Mouse *_mouse; diff --git a/engines/draci/mouse.cpp b/engines/draci/mouse.cpp index f5eb2bbf4d..69943faa3c 100644 --- a/engines/draci/mouse.cpp +++ b/engines/draci/mouse.cpp @@ -34,6 +34,7 @@ Mouse::Mouse(DraciEngine *vm) { _y = 0; _lButton = false; _rButton = false; + _modifierState = 0; _cursorType = kNormalCursor; _vm = vm; } @@ -41,8 +42,13 @@ Mouse::Mouse(DraciEngine *vm) { void Mouse::handleEvent(Common::Event event) { switch (event.type) { case Common::EVENT_LBUTTONDOWN: - debugC(6, kDraciGeneralDebugLevel, "Left button down (x: %u y: %u)", _x, _y); - _lButton = true; + if (!(_modifierState & 3)) { + debugC(6, kDraciGeneralDebugLevel, "Left button down (x: %u y: %u)", _x, _y); + _lButton = true; + } else { // any Ctrl pressed + debugC(6, kDraciGeneralDebugLevel, "Ctrl-Left button down (x: %u y: %u)", _x, _y); + _rButton = true; + } break; case Common::EVENT_LBUTTONUP: diff --git a/engines/draci/mouse.h b/engines/draci/mouse.h index 629a7634d5..82a577b9d6 100644 --- a/engines/draci/mouse.h +++ b/engines/draci/mouse.h @@ -62,12 +62,17 @@ public: void lButtonSet(bool state) { _lButton = state; } void rButtonSet(bool state) { _rButton = state; } + // Updates the current state of modifiers. The indexes are: 0=left Ctrl, 1=right Ctrl. + void downModifier(int index) { _modifierState |= 1 << index; } + void upModifier(int index) { _modifierState &= ~(1 << index); } + uint16 getPosX() const { return _x; } uint16 getPosY() const { return _y; } private: uint16 _x, _y; bool _lButton, _rButton; + int _modifierState; CursorType _cursorType; DraciEngine *_vm; }; |