All pastes #1310741 Raw Edit

Mine

public cpp v1 · immutable
#1310741 ·published 2009-01-17 10:47 UTC
rendered paste body
diff -r e03997aa6b67 -r 055acf613473 src/game/Map.h--- a/src/game/Map.h	Sun Dec 14 13:18:47 2008 -0600+++ b/src/game/Map.h	Mon Dec 15 21:30:29 2008 +0300@@ -183,7 +183,9 @@         // can return INVALID_HEIGHT if under z+2 z coord not found height         float GetHeight(float x, float y, float z, bool pCheckVMap=true) const;         bool IsInWater(float x, float y, float z) const;    // does not use z pos. This is for future use-+       float GetVmapHeight(float x, float y, float z) const;+          uint16 GetAreaFlag(float x, float y ) const;         uint8 GetTerrainType(float x, float y ) const;         float GetWaterLevel(float x, float y ) const;diff -r 8dc69056db7d -r ab02e4cc73af src/game/Map.cpp--- a/src/game/Map.cpp	Fri Jan 16 18:49:41 2009 -0600+++ b/src/game/Map.cpp	Thu Jan 15 00:13:04 2009 -1200@@ -1262,7 +1265,31 @@             return mapHeight;                               // explicitly use map data if original z < mapHeight but map found (z+2 > mapHeight)         else             return VMAP_INVALID_HEIGHT_VALUE;               // we not have any height-    }+	}+}++float Map::GetVmapHeight(float x, float y, float z, bool useMaps) const+{+	float mapHeight = GetHeight(x, y, MAX_HEIGHT, false);		++	if(mapHeight <= INVALID_HEIGHT)	//check, if we have .map surface, unsure: there is any map in world without map height?+		return INVALID_HEIGHT;++	float vmapHeight, loverHeight;+	if(z + 2.0f < mapHeight)		//we under map surface+		loverHeight = -1000.f;+	else loverHeight = mapHeight;++	VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();+	bool result = vmgr->getObjectHitPos(GetId(), x,y,z + 2.0f, x,y,loverHeight - 1.0f, x,y,vmapHeight, 0);++	if(z + 2.0f < mapHeight && !result)		//we under map surface+		return INVALID_HEIGHT;++	if(vmapHeight < mapHeight)+		return mapHeight;++	return vmapHeight; }  uint16 Map::GetAreaFlag(float x, float y ) constdiff -r 8dc69056db7d -r ab02e4cc73af src/game/Creature.cpp--- a/src/game/Creature.cpp	Fri Jan 16 18:49:41 2009 -0600+++ b/src/game/Creature.cpp	Thu Jan 15 00:13:04 2009 -1200@@ -1676,16 +1676,15 @@     if (getDeathState() == DEAD_FALLING)         return false; -    // Let's do with no vmap because no way to get far distance with vmap high call-    float tz = GetMap()->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), false);--    // Abort too if the ground is very near-    if (fabs(GetPositionZ() - tz) < 0.1f)+	float x, y, z;+	GetPosition(x, y, z);+	float ground_Z = GetMap()->GetVmapHeight(x, y, z, true);+    if (fabs(ground_Z - z) < 0.1f)         return false;      Unit::setDeathState(DEAD_FALLING);-    GetMotionMaster()->MovePoint(0, GetPositionX(), GetPositionY(), tz);-    Relocate(GetPositionX(), GetPositionY(), tz);+    GetMotionMaster()->MovePoint(0, x, y, ground_Z);+    Relocate(x, y, ground_Z);     return true; }