diff options
author | Denis Kasak | 2009-07-17 00:20:57 +0000 |
---|---|---|
committer | Denis Kasak | 2009-07-17 00:20:57 +0000 |
commit | e419110569067fe98a0b009ee5a7e90b507aea49 (patch) | |
tree | 4e34afa654ad1685cfb07a308c5300061ec31c74 /engines/draci/game.cpp | |
parent | c420a4fba13e8f1307b2325d22d2a928d95d1cee (diff) | |
download | scummvm-rg350-e419110569067fe98a0b009ee5a7e90b507aea49.tar.gz scummvm-rg350-e419110569067fe98a0b009ee5a7e90b507aea49.tar.bz2 scummvm-rg350-e419110569067fe98a0b009ee5a7e90b507aea49.zip |
* Added Game::loop()
* Added WalkingMap::isWalkable()
* Renamed remaining _priority identifiers to _z which were left by mistake in the previous commit
svn-id: r42546
Diffstat (limited to 'engines/draci/game.cpp')
-rw-r--r-- | engines/draci/game.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 53c0f903fc..d80408b649 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -146,6 +146,17 @@ void Game::init() { _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 @@ GameObject::~GameObject() { 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); +} + } |