aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorDenis Kasak2009-07-07 15:21:41 +0000
committerDenis Kasak2009-07-07 15:21:41 +0000
commit7f3af129f218ee47f806e7672ffe4074b86194c2 (patch)
tree346b0a0a2589191ec9fe63915f742af9df4989a6 /engines
parent82e6bcea2f0cf3fb0d44cbdd6fc5ad9240ef20e2 (diff)
downloadscummvm-rg350-7f3af129f218ee47f806e7672ffe4074b86194c2.tar.gz
scummvm-rg350-7f3af129f218ee47f806e7672ffe4074b86194c2.tar.bz2
scummvm-rg350-7f3af129f218ee47f806e7672ffe4074b86194c2.zip
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).
svn-id: r42224
Diffstat (limited to 'engines')
-rw-r--r--engines/draci/game.cpp15
-rw-r--r--engines/draci/game.h14
-rw-r--r--engines/draci/mouse.cpp20
3 files changed, 48 insertions, 1 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index ab2302cae4..ddb5a58a5a 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -319,6 +319,21 @@ void Game::loadOverlays() {
}
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();
diff --git a/engines/draci/game.h b/engines/draci/game.h
index 14140f44e3..5ba0626557 100644
--- a/engines/draci/game.h
+++ b/engines/draci/game.h
@@ -106,6 +106,20 @@ public:
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();
diff --git a/engines/draci/mouse.cpp b/engines/draci/mouse.cpp
index b342487209..09216085a7 100644
--- a/engines/draci/mouse.cpp
+++ b/engines/draci/mouse.cpp
@@ -41,27 +41,45 @@ 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:
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;
}