aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Maps/Map.cpp
diff options
context:
space:
mode:
authorMachiavelli <machiavelli.trinity@gmail.com>2012-01-14 15:34:41 +0100
committerMachiavelli <machiavelli.trinity@gmail.com>2012-01-14 15:36:07 +0100
commitdbbac0bdaae4b6d8a0125999962c4a686092bd80 (patch)
tree8962da6db594ae27fc5ac5e6a930b6292a997ea6 /src/server/game/Maps/Map.cpp
parent798677ca54553a9da688deef7b7c33ccbc17b801 (diff)
Core/Movement: Implement spline movement subsystem.
Spline movement controls movements of server-side controlled units (monster movement, taxi movement, etc). Proper implementation of effects such as charge, jump, cyclic movement will rely on it. However, need improve our states system before. Technical changes: * Added linear, catmullrom and bezier3 splines which based on client's algorthims. They can be reused for proper transport position interpolation. * Precission increased. There are no more position desync issues since client's position calculation formulas used. * Now possible to move by paths with multiple points, send whole path to client. -- Original author of research and implementation: SilverIce. Massive kudos. Original port for Trinity (ref #4629) Chaplain and Venugh With the following incremental fixes during my review: - Restore flightmaster end grid pre-loading - Fix uninitialized Creature::m_path_id - Add missing trinity_string entries for .movegens command - Fix a bug in WaypointMovementGenerator that would trigger unexpected pausing at waypoints for various amounts of time Known issues: - Errors like WaypointMovementGenerator::LoadPath creature XXX (Entry: YYYYY GUID: ZZZZZZ) doesn't have waypoint path id: 0. This is caused by bad DB data. This commit didn't "break" it. Do not forget to re-run CMake before compiling.
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
-rwxr-xr-xsrc/server/game/Maps/Map.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index b2f8e5608a7..df5ec540427 100755
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -1539,6 +1539,24 @@ inline GridMap* Map::GetGrid(float x, float y)
return GridMaps[gx][gy];
}
+float Map::GetWaterOrGroundLevel(float x, float y, float z, float* ground /*= NULL*/, bool swim /*= false*/) const
+{
+ if (const_cast<Map*>(this)->GetGrid(x, y))
+ {
+ // we need ground level (including grid height version) for proper return water level in point
+ float ground_z = GetHeight(x, y, z, true, 50.0f);
+ if (ground)
+ *ground = ground_z;
+
+ LiquidData liquid_status;
+
+ ZLiquidStatus res = getLiquidStatus(x, y, ground_z, MAP_ALL_LIQUIDS, &liquid_status);
+ return res ? ( swim ? liquid_status.level - 2.0f : liquid_status.level) : ground_z;
+ }
+
+ return VMAP_INVALID_HEIGHT_VALUE;
+}
+
float Map::GetHeight(float x, float y, float z, bool checkVMap /*= true*/, float maxSearchDist /*= DEFAULT_HEIGHT_SEARCH*/) const
{
// find raw .map surface under Z coordinates