[Scummvm-cvs-logs] SF.net SVN: scummvm:[45525] scummvm/trunk/engines/draci

spalek at users.sourceforge.net spalek at users.sourceforge.net
Fri Oct 30 08:26:43 CET 2009


Revision: 45525
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45525&view=rev
Author:   spalek
Date:     2009-10-30 07:26:43 +0000 (Fri, 30 Oct 2009)

Log Message:
-----------
Move drawing of walking map to walking.cpp

Modified Paths:
--------------
    scummvm/trunk/engines/draci/game.cpp
    scummvm/trunk/engines/draci/walking.cpp
    scummvm/trunk/engines/draci/walking.h

Modified: scummvm/trunk/engines/draci/game.cpp
===================================================================
--- scummvm/trunk/engines/draci/game.cpp	2009-10-30 06:11:04 UTC (rev 45524)
+++ scummvm/trunk/engines/draci/game.cpp	2009-10-30 07:26:43 UTC (rev 45525)
@@ -1095,22 +1095,8 @@
 	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);
 }
 

Modified: scummvm/trunk/engines/draci/walking.cpp
===================================================================
--- scummvm/trunk/engines/draci/walking.cpp	2009-10-30 06:11:04 UTC (rev 45524)
+++ scummvm/trunk/engines/draci/walking.cpp	2009-10-30 07:26:43 UTC (rev 45525)
@@ -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 @@
 	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
  *

Modified: scummvm/trunk/engines/draci/walking.h
===================================================================
--- scummvm/trunk/engines/draci/walking.h	2009-10-30 06:11:04 UTC (rev 45524)
+++ scummvm/trunk/engines/draci/walking.h	2009-10-30 07:26:43 UTC (rev 45525)
@@ -30,6 +30,8 @@
 
 namespace Draci {
 
+class Sprite;
+
 class WalkingMap {
 public:
 	WalkingMap() : _realWidth(0), _realHeight(0), _deltaX(1), _deltaY(1),
@@ -37,6 +39,7 @@
 
 	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:


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