aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Kasak2009-07-18 01:11:45 +0000
committerDenis Kasak2009-07-18 01:11:45 +0000
commit8e1f29630869481f88911476d900f421fa0c2164 (patch)
treeac34409f6c37693cad52c74af4a4a3bc37511bf1
parentaa82c39857513525d5212b543f4438f916409250 (diff)
downloadscummvm-rg350-8e1f29630869481f88911476d900f421fa0c2164.tar.gz
scummvm-rg350-8e1f29630869481f88911476d900f421fa0c2164.tar.bz2
scummvm-rg350-8e1f29630869481f88911476d900f421fa0c2164.zip
Removed room switching hack from Mouse and re-added it to DraciEngine::go() (right arrow switches to the next room, left to the previous.
svn-id: r42577
-rw-r--r--engines/draci/draci.cpp7
-rw-r--r--engines/draci/game.h10
-rw-r--r--engines/draci/mouse.cpp13
3 files changed, 12 insertions, 18 deletions
diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp
index f090e587d8..b2b0083c22 100644
--- a/engines/draci/draci.cpp
+++ b/engines/draci/draci.cpp
@@ -28,6 +28,7 @@
#include "common/config-manager.h"
#include "common/events.h"
#include "common/file.h"
+#include "common/keyboard.h"
#include "graphics/cursorman.h"
#include "graphics/font.h"
@@ -176,6 +177,12 @@ int DraciEngine::go() {
case Common::EVENT_QUIT:
quit = true;
break;
+ case Common::EVENT_KEYDOWN:
+ if (event.kbd.keycode == Common::KEYCODE_RIGHT)
+ _game->changeRoom(_game->nextRoomNum());
+ else if (event.kbd.keycode == Common::KEYCODE_LEFT)
+ _game->changeRoom(_game->prevRoomNum());
+ break;
default:
_mouse->handleEvent(event);
}
diff --git a/engines/draci/game.h b/engines/draci/game.h
index 276efa1356..0c3dddae20 100644
--- a/engines/draci/game.h
+++ b/engines/draci/game.h
@@ -135,6 +135,7 @@ struct Room {
class Game {
public:
+
Game(DraciEngine *vm);
~Game();
@@ -142,11 +143,10 @@ public:
void loop();
void changeRoom(uint roomNum);
-
int getRoomNum();
// HACK: this is only for testing
- void incRoomNum() {
+ int nextRoomNum() {
int n = _currentRoom._roomNum;
n = n < 37 ? n+1 : n;
@@ -154,11 +154,11 @@ public:
if (n == 30)
++n;
- _currentRoom._roomNum = n;
+ return n;
}
// HACK: same as above
- void decRoomNum() {
+ int prevRoomNum() {
int n = _currentRoom._roomNum;
n = n > 0 ? n-1 : n;
@@ -166,7 +166,7 @@ public:
if (n == 30)
--n;
- _currentRoom._roomNum = n;
+ return n;
}
void loadRoom(int roomNum);
diff --git a/engines/draci/mouse.cpp b/engines/draci/mouse.cpp
index 4a02f47444..352dbf4e80 100644
--- a/engines/draci/mouse.cpp
+++ b/engines/draci/mouse.cpp
@@ -41,18 +41,11 @@ Mouse::Mouse(DraciEngine *vm) {
void Mouse::handleEvent(Common::Event event) {
_x = (uint16) event.mouse.x;
_y = (uint16) event.mouse.y;
- int room;
switch (event.type) {
case Common::EVENT_LBUTTONDOWN:
debugC(6, kDraciGeneralDebugLevel, "Left button down (x: %u y: %u)", _x, _y);
_lButton = true;
-
- // HACK: We change to the next room when the left mouse button is pressed.
- // This is only for testing.
- _vm->_game->incRoomNum();
- room = _vm->_game->getRoomNum();
- _vm->_game->changeRoom(room);
break;
case Common::EVENT_LBUTTONUP:
@@ -63,12 +56,6 @@ void Mouse::handleEvent(Common::Event event) {
case Common::EVENT_RBUTTONDOWN:
debugC(6, kDraciGeneralDebugLevel, "Right button down (x: %u y: %u)", _x, _y);
_rButton = true;
-
- // HACK: We change to the previous room when the right mouse button is pressed.
- // This is only for testing.
- _vm->_game->decRoomNum();
- room = _vm->_game->getRoomNum();
- _vm->_game->changeRoom(room);
break;
case Common::EVENT_RBUTTONUP: