diff options
| -rw-r--r-- | engines/draci/game.cpp | 16 | ||||
| -rw-r--r-- | engines/draci/walking.cpp | 21 | ||||
| -rw-r--r-- | engines/draci/walking.h | 3 | 
3 files changed, 25 insertions, 15 deletions
| diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 350499fc06..99d94040e2 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -1095,22 +1095,8 @@ void Game::loadRoom(int roomNum) {  	f = _vm->_paletteArchive->getFile(_currentRoom._palette);  	_vm->_screen->setPalette(f->_data, 0, kNumColours); -	// HACK: Create a visible overlay from the walking map so we can test it -	byte *wlk = new byte[kScreenWidth * kScreenHeight]; -	memset(wlk, 255, kScreenWidth * kScreenHeight); - -	for (uint i = 0; i < kScreenWidth; ++i) { -		for (uint j = 0; j < kScreenHeight; ++j) { -			if (_walkingMap.isWalkable(i, j)) { -				wlk[j * kScreenWidth + i] = 2; -			} -		} -	} - -	Sprite *ov = new Sprite(wlk, kScreenWidth, kScreenHeight, 0, 0, false); -        delete[] wlk; -  	Animation *map = _vm->_anims->addAnimation(kWalkingMapOverlay, 255, false); +	Sprite *ov = _walkingMap.constructDrawableOverlay();  	map->addFrame(ov, NULL);  } diff --git a/engines/draci/walking.cpp b/engines/draci/walking.cpp index 699c6d6731..3c903f4ca4 100644 --- a/engines/draci/walking.cpp +++ b/engines/draci/walking.cpp @@ -26,6 +26,8 @@  #include "common/stream.h"  #include "draci/walking.h" +#include "draci/screen.h" +#include "draci/sprite.h"  namespace Draci { @@ -56,6 +58,25 @@ bool WalkingMap::isWalkable(int x, int y) const {  	return mapByte & (1 << pixelIndex % 8);  } +Sprite *WalkingMap::constructDrawableOverlay() { +	// HACK: Create a visible overlay from the walking map so we can test it +	byte *wlk = new byte[kScreenWidth * kScreenHeight]; +	memset(wlk, 255, kScreenWidth * kScreenHeight); + +	for (uint i = 0; i < kScreenWidth; ++i) { +		for (uint j = 0; j < kScreenHeight; ++j) { +			if (isWalkable(i, j)) { +				wlk[j * kScreenWidth + i] = 2; +			} +		} +	} + +	Sprite *ov = new Sprite(wlk, kScreenWidth, kScreenHeight, 0, 0, false); +        delete[] wlk; + +	return ov; +} +  /**   * @brief For a given point, find a nearest walkable point on the walking map   * diff --git a/engines/draci/walking.h b/engines/draci/walking.h index a2bb9a7410..2a7f27dd80 100644 --- a/engines/draci/walking.h +++ b/engines/draci/walking.h @@ -30,6 +30,8 @@  namespace Draci { +class Sprite; +  class WalkingMap {  public:  	WalkingMap() : _realWidth(0), _realHeight(0), _deltaX(1), _deltaY(1), @@ -37,6 +39,7 @@ public:  	void load(const byte *data, uint length);  	bool isWalkable(int x, int y) const; +	Sprite *constructDrawableOverlay();  	Common::Point findNearestWalkable(int x, int y, Common::Rect searchRect) const;  private: | 
