[Scummvm-cvs-logs] SF.net SVN: scummvm:[42577] scummvm/branches/gsoc2009-draci/engines/draci

dkasak13 at users.sourceforge.net dkasak13 at users.sourceforge.net
Sat Jul 18 03:11:45 CEST 2009


Revision: 42577
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42577&view=rev
Author:   dkasak13
Date:     2009-07-18 01:11:45 +0000 (Sat, 18 Jul 2009)

Log Message:
-----------
Removed room switching hack from Mouse and re-added it to DraciEngine::go() (right arrow switches to the next room, left to the previous.

Modified Paths:
--------------
    scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp
    scummvm/branches/gsoc2009-draci/engines/draci/game.h
    scummvm/branches/gsoc2009-draci/engines/draci/mouse.cpp

Modified: scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp	2009-07-18 00:53:31 UTC (rev 42576)
+++ scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp	2009-07-18 01:11:45 UTC (rev 42577)
@@ -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 @@
 			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);
 			}		

Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/game.h	2009-07-18 00:53:31 UTC (rev 42576)
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.h	2009-07-18 01:11:45 UTC (rev 42577)
@@ -135,6 +135,7 @@
 class Game {
 
 public:
+
 	Game(DraciEngine *vm);
 	~Game();
 
@@ -142,11 +143,10 @@
 	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 @@
 		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 @@
 		if (n == 30)
 			--n;
 
-		_currentRoom._roomNum = n;
+		return n;
 	}
 
 	void loadRoom(int roomNum);

Modified: scummvm/branches/gsoc2009-draci/engines/draci/mouse.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/mouse.cpp	2009-07-18 00:53:31 UTC (rev 42576)
+++ scummvm/branches/gsoc2009-draci/engines/draci/mouse.cpp	2009-07-18 01:11:45 UTC (rev 42577)
@@ -41,18 +41,11 @@
 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 @@
 	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:


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