[Scummvm-cvs-logs] SF.net SVN: scummvm:[44575] scummvm/trunk/engines/draci
spalek at users.sourceforge.net
spalek at users.sourceforge.net
Sun Oct 4 00:07:19 CEST 2009
Revision: 44575
http://scummvm.svn.sourceforge.net/scummvm/?rev=44575&view=rev
Author: spalek
Date: 2009-10-03 22:07:18 +0000 (Sat, 03 Oct 2009)
Log Message:
-----------
Let Ctrl-Left click behave like Right lick in Dragon History.
Also, started implementing Advanced Engine Features:
- pause support
- RTL support
Modified Paths:
--------------
scummvm/trunk/engines/draci/detection.cpp
scummvm/trunk/engines/draci/draci.cpp
scummvm/trunk/engines/draci/draci.h
scummvm/trunk/engines/draci/mouse.cpp
scummvm/trunk/engines/draci/mouse.h
Modified: scummvm/trunk/engines/draci/detection.cpp
===================================================================
--- scummvm/trunk/engines/draci/detection.cpp 2009-10-03 21:49:09 UTC (rev 44574)
+++ scummvm/trunk/engines/draci/detection.cpp 2009-10-03 22:07:18 UTC (rev 44575)
@@ -115,7 +115,8 @@
}
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 {
Modified: scummvm/trunk/engines/draci/draci.cpp
===================================================================
--- scummvm/trunk/engines/draci/draci.cpp 2009-10-03 21:49:09 UTC (rev 44574)
+++ scummvm/trunk/engines/draci/draci.cpp 2009-10-03 22:07:18 UTC (rev 44575)
@@ -173,21 +173,24 @@
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 @@
// 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,8 +226,33 @@
_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:
_mouse->handleEvent(event);
}
@@ -234,9 +266,8 @@
} else if (!_showWalkingMap && _anims->getAnimation(kWalkingMapOverlay)->isPlaying()) {
_anims->stop(kWalkingMapOverlay);
}
+}
- return quit;
-}
DraciEngine::~DraciEngine() {
// Dispose your resources here
@@ -275,4 +306,19 @@
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
Modified: scummvm/trunk/engines/draci/draci.h
===================================================================
--- scummvm/trunk/engines/draci/draci.h 2009-10-03 21:49:09 UTC (rev 44574)
+++ scummvm/trunk/engines/draci/draci.h 2009-10-03 22:07:18 UTC (rev 44575)
@@ -43,14 +43,16 @@
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;
Modified: scummvm/trunk/engines/draci/mouse.cpp
===================================================================
--- scummvm/trunk/engines/draci/mouse.cpp 2009-10-03 21:49:09 UTC (rev 44574)
+++ scummvm/trunk/engines/draci/mouse.cpp 2009-10-03 22:07:18 UTC (rev 44575)
@@ -34,6 +34,7 @@
_y = 0;
_lButton = false;
_rButton = false;
+ _modifierState = 0;
_cursorType = kNormalCursor;
_vm = vm;
}
@@ -41,8 +42,13 @@
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:
Modified: scummvm/trunk/engines/draci/mouse.h
===================================================================
--- scummvm/trunk/engines/draci/mouse.h 2009-10-03 21:49:09 UTC (rev 44574)
+++ scummvm/trunk/engines/draci/mouse.h 2009-10-03 22:07:18 UTC (rev 44575)
@@ -62,12 +62,17 @@
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;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list