[Scummvm-cvs-logs] SF.net SVN: scummvm:[42546] scummvm/branches/gsoc2009-draci/engines/draci
dkasak13 at users.sourceforge.net
dkasak13 at users.sourceforge.net
Fri Jul 17 02:20:57 CEST 2009
Revision: 42546
http://scummvm.svn.sourceforge.net/scummvm/?rev=42546&view=rev
Author: dkasak13
Date: 2009-07-17 00:20:57 +0000 (Fri, 17 Jul 2009)
Log Message:
-----------
* Added Game::loop()
* Added WalkingMap::isWalkable()
* Renamed remaining _priority identifiers to _z which were left by mistake in the previous commit
Modified Paths:
--------------
scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp
scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
scummvm/branches/gsoc2009-draci/engines/draci/game.h
scummvm/branches/gsoc2009-draci/engines/draci/script.cpp
Modified: scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp 2009-07-17 00:10:10 UTC (rev 42545)
+++ scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp 2009-07-17 00:20:57 UTC (rev 42546)
@@ -155,6 +155,7 @@
_mouse->handleEvent(event);
}
}
+ _game->loop();
_anims->drawScene(_screen->getSurface());
_screen->copyToScreen();
_system->delayMillis(20);
Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/game.cpp 2009-07-17 00:10:10 UTC (rev 42545)
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.cpp 2009-07-17 00:20:57 UTC (rev 42546)
@@ -146,6 +146,17 @@
_vm->_mouse->setCursorType(kNormalCursor);
}
+void Game::loop() {
+
+ if (_currentRoom._mouseOn) {
+ int x = _vm->_mouse->getPosX();
+ int y = _vm->_mouse->getPosY();
+ if (_vm->_mouse->lButtonPressed() && _currentRoom._walkingMap.isWalkable(x, y)) {
+ debugC(4, kDraciLogicDebugLevel, "Walk to x: %d y: %d", x, y);
+ }
+ }
+}
+
void Game::loadRoom(int roomNum) {
BAFile *f;
@@ -427,4 +438,17 @@
delete[] _program._bytecode;
}
+bool WalkingMap::isWalkable(int x, int y) {
+
+ // Convert to map pixels
+ x = x / _deltaX;
+ y = y / _deltaY;
+
+ int pixelIndex = _mapWidth * y + x;
+ int byteIndex = pixelIndex / 8;
+ int mapByte = _data[byteIndex];
+
+ return mapByte & (1 << pixelIndex % 8);
+}
+
}
Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/game.h 2009-07-17 00:10:10 UTC (rev 42545)
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.h 2009-07-17 00:20:57 UTC (rev 42546)
@@ -60,6 +60,8 @@
_realWidth = mapReader.readUint16LE();
_realHeight = mapReader.readUint16LE();
+ _deltaX = mapReader.readUint16LE();
+ _deltaY = mapReader.readUint16LE();
_mapWidth = mapReader.readUint16LE();
_mapHeight = mapReader.readUint16LE();
_byteWidth = mapReader.readUint16LE();
@@ -68,6 +70,7 @@
_data = data + mapReader.pos();
}
+ bool isWalkable(int x, int y);
private:
int _realWidth, _realHeight;
@@ -137,6 +140,7 @@
~Game();
void init();
+ void loop();
void changeRoom(uint roomNum);
@@ -186,7 +190,7 @@
uint16 *_dialogOffsets;
byte *_iconStatus;
GameObject *_objects;
- Room _currentRoom;
+ Room _currentRoom;
};
} // End of namespace Draci
Modified: scummvm/branches/gsoc2009-draci/engines/draci/script.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/script.cpp 2009-07-17 00:10:10 UTC (rev 42545)
+++ scummvm/branches/gsoc2009-draci/engines/draci/script.cpp 2009-07-17 00:20:57 UTC (rev 42546)
@@ -270,7 +270,7 @@
GameObject *obj = _vm->_game->getObject(objID);
- _vm->_game->loadAnimation(animID, obj->_priority);
+ _vm->_game->loadAnimation(animID, obj->_z);
obj->_anims.push_back(animID);
}
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