[Scummvm-cvs-logs] SF.net SVN: scummvm:[42224] scummvm/branches/gsoc2009-draci/engines/draci
dkasak13 at users.sourceforge.net
dkasak13 at users.sourceforge.net
Tue Jul 7 17:21:42 CEST 2009
Revision: 42224
http://scummvm.svn.sourceforge.net/scummvm/?rev=42224&view=rev
Author: dkasak13
Date: 2009-07-07 15:21:41 +0000 (Tue, 07 Jul 2009)
Log Message:
-----------
mplemented changing rooms properly (overlays and objects' animations are deleted before a new room is loaded) and set up a quick demonstration (left click advances to the next room, right click goes back).
Modified Paths:
--------------
scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
scummvm/branches/gsoc2009-draci/engines/draci/game.h
scummvm/branches/gsoc2009-draci/engines/draci/mouse.cpp
Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/game.cpp 2009-07-07 14:52:36 UTC (rev 42223)
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.cpp 2009-07-07 15:21:41 UTC (rev 42224)
@@ -319,6 +319,21 @@
}
void Game::changeRoom(uint roomNum) {
+ _vm->_roomsArchive->clearCache();
+ _vm->_anims->deleteOverlays();
+
+ int oldRoomNum = _currentRoom._roomNum;
+
+ for (uint i = 0; i < _info->_numObjects; ++i) {
+ GameObject *obj = &_objects[i];
+
+ if (i != 0 && obj->_location == oldRoomNum) {
+ for (uint j = 0; j < obj->_numSeq; ++j) {
+ _vm->_anims->deleteAnimation(obj->_seqTab[j]);
+ }
+ }
+ }
+
_currentRoom._roomNum = roomNum;
loadRoom(roomNum);
loadOverlays();
Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/game.h 2009-07-07 14:52:36 UTC (rev 42223)
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.h 2009-07-07 15:21:41 UTC (rev 42224)
@@ -106,6 +106,20 @@
int getRoomNum();
+ // HACK: this is only for testing
+ void incRoomNum() {
+ int n = _currentRoom._roomNum;
+ n = n < 25 ? n+1 : n;
+ _currentRoom._roomNum = n;
+ }
+
+ // HACK: same as above
+ void decRoomNum() {
+ int n = _currentRoom._roomNum;
+ n = n > 0 ? n-1 : n;
+ _currentRoom._roomNum = n;
+ }
+
void loadRoom(uint roomNum);
int loadAnimation(uint animNum);
void loadOverlays();
Modified: scummvm/branches/gsoc2009-draci/engines/draci/mouse.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/mouse.cpp 2009-07-07 14:52:36 UTC (rev 42223)
+++ scummvm/branches/gsoc2009-draci/engines/draci/mouse.cpp 2009-07-07 15:21:41 UTC (rev 42224)
@@ -41,27 +41,45 @@
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:
debugC(6, kDraciGeneralDebugLevel, "Left button up (x: %u y: %u)", _x, _y);
_lButton = false;
break;
+
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:
debugC(6, kDraciGeneralDebugLevel, "Right button up (x: %u y: %u)", _x, _y);
_rButton = false;
break;
+
case Common::EVENT_MOUSEMOVE:
setPosition(_x, _y);
break;
+
default:
break;
}
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