Skip to content

Commit

Permalink
Merge remote branch 'faramir118/mmaps_rewrite'
Browse files Browse the repository at this point in the history
Conflicts:
	dep/lib/x64_Debug/ADEd.pdb
	src/game/MovementGenerator.h
	src/game/Object.cpp
	src/game/PathFinder.cpp
	src/game/SpellEffects.cpp
	src/game/TargetedMovementGenerator.cpp
	src/game/TargetedMovementGenerator.h
	src/game/Unit.cpp
	src/game/Unit.h
	win/VC100/game.vcxproj.filters
  • Loading branch information
unknown authored and unknown committed Jul 14, 2011
2 parents 10fd6bf + 6ee3007 commit b8e8427
Show file tree
Hide file tree
Showing 23 changed files with 216 additions and 516 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,5 @@ dep/ACE_wrappers/ace/config.h
!dep/ACE_wrappers/lib/.empty
!dep/tbb/src/Makefile

# recastnavigation directory needs exception
!dep/recastnavigation/RecastDemo/Build/
Binary file removed dep/lib/x64_Debug/ADEd.pdb
Binary file not shown.
16 changes: 8 additions & 8 deletions src/game/Level2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5398,19 +5398,19 @@ bool ChatHandler::HandleMmapPathCommand(char* args)
player->GetPosition(x, y, z);

// path
PathInfo path(target, x, y, z, useStraightPath);
PointPath pointPath = path.getFullPath();
PathInfo path(target);
path.calculate(x, y, z, useStraightPath);

PointsArray pointPath = path.getPath();
PSendSysMessage("%s's path to %s:", target->GetName(), player->GetName());
PSendSysMessage("Building %s", useStraightPath ? "StraightPath" : "SmoothPath");
PSendSysMessage("length %i type %u", pointPath.size(), path.getPathType());

PathNode start = path.getStartPosition();
PathNode next = path.getNextPosition();
PathNode end = path.getEndPosition();
PathNode actualEnd = path.getActualEndPosition();
Vector3 start = path.getStartPosition();
Vector3 end = path.getEndPosition();
Vector3 actualEnd = path.getActualEndPosition();

PSendSysMessage("start (%.3f, %.3f, %.3f)", start.x, start.y, start.z);
PSendSysMessage("next (%.3f, %.3f, %.3f)", next.x, next.y, next.z);
PSendSysMessage("end (%.3f, %.3f, %.3f)", end.x, end.y, end.z);
PSendSysMessage("actual end (%.3f, %.3f, %.3f)", actualEnd.x, actualEnd.y, actualEnd.z);

Expand Down Expand Up @@ -5456,7 +5456,7 @@ bool ChatHandler::HandleMmapLocCommand(char* /*args*/)
float x, y, z;
player->GetPosition(x, y, z);
float location[VERTEX_SIZE] = {y, z, x};
float extents[VERTEX_SIZE] = {2.f,4.f,2.f};
float extents[VERTEX_SIZE] = {3.0f, 5.0f, 3.0f};

int32 tilex = int32((y - min[0]) / SIZE_OF_GRIDS);
int32 tiley = int32((x - min[2]) / SIZE_OF_GRIDS);
Expand Down
4 changes: 3 additions & 1 deletion src/game/Level3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "CellImpl.h"
#include "Weather.h"
#include "PointMovementGenerator.h"
#include "PathFinder.h"
#include "TargetedMovementGenerator.h"
#include "SkillDiscovery.h"
#include "SkillExtraItems.h"
Expand Down Expand Up @@ -7746,7 +7747,8 @@ bool ChatHandler::HandleMmapTestArea(char* args)
m_session->GetPlayer()->GetPosition(gx,gy,gz);
for (std::list<Creature*>::iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr)
{
PathInfo((*itr), gx, gy, gz);
PathInfo path(*itr);
path.calculate(gx, gy, gz);
++paths;
}

Expand Down
6 changes: 3 additions & 3 deletions src/game/MotionMaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,14 +306,14 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle)
Mutate(new FollowMovementGenerator<Creature>(*target,dist,angle));
}

void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool usePathfinding)
void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generatePath)
{
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s targeted point (Id: %u X: %f Y: %f Z: %f)", m_owner->GetGuidStr().c_str(), id, x, y, z );

if (m_owner->GetTypeId() == TYPEID_PLAYER)
Mutate(new PointMovementGenerator<Player>(id,x,y,z,usePathfinding));
Mutate(new PointMovementGenerator<Player>(id,x,y,z,generatePath));
else
Mutate(new PointMovementGenerator<Creature>(id,x,y,z,usePathfinding));
Mutate(new PointMovementGenerator<Creature>(id,x,y,z,generatePath));
}

void MotionMaster::MoveSeekAssistance(float x, float y, float z)
Expand Down
2 changes: 1 addition & 1 deletion src/game/MotionMaster.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class MANGOS_DLL_SPEC MotionMaster : private std::stack<MovementGenerator *>
void MoveChase(Unit* target, float dist = 0.0f, float angle = 0.0f);
void MoveConfused();
void MoveFleeing(Unit* enemy, uint32 timeLimit = 0);
void MovePoint(uint32 id, float x, float y, float z, bool usePathfinding = true);
void MovePoint(uint32 id, float x,float y,float z, bool generatePath = true);
void MoveSeekAssistance(float x,float y,float z);
void MoveSeekAssistanceDistract(uint32 timer);
void MoveWaypoint();
Expand Down
6 changes: 3 additions & 3 deletions src/game/MovementGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ class MANGOS_DLL_SPEC MovementGenerator

virtual bool GetDestination(float& /*x*/, float& /*y*/, float& /*z*/) const { return false; }

// given destination unreachable? due to pathfinsing or other
virtual bool IsReachable() const { return true; }

// used by Evade code for select point to evade with expected restart default movement
virtual bool GetResetPosition(Unit &, float& /*x*/, float& /*y*/, float& /*z*/) { return false; }

// given destination unreachable? due to pathfinsing or other
virtual bool IsReachable() const { return true; }

// used for check from Update call is movegen still be active (top movement generator)
// after some not safe for this calls
bool IsActive(Unit& u);
Expand Down
48 changes: 0 additions & 48 deletions src/game/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1061,16 +1061,6 @@ float WorldObject::GetDistance(const WorldObject* obj) const
return ( dist > 0 ? dist : 0);
}

float WorldObject::GetDistanceSqr(float x, float y, float z) const
{
float dx = GetPositionX() - x;
float dy = GetPositionY() - y;
float dz = GetPositionZ() - z;
float sizefactor = GetObjectBoundingRadius();
float dist = dx*dx+dy*dy+dz*dz-sizefactor;
return (dist > 0 ? dist : 0);
}

float WorldObject::GetDistance2d(float x, float y) const
{
float dx = GetPositionX() - x;
Expand All @@ -1080,16 +1070,6 @@ float WorldObject::GetDistance2d(float x, float y) const
return ( dist > 0 ? dist : 0);
}

float WorldObject::GetDistance(float x, float y, float z) const
{
float dx = GetPositionX() - x;
float dy = GetPositionY() - y;
float dz = GetPositionZ() - z;
float sizefactor = GetObjectBoundingRadius();
float dist = sqrt((dx*dx) + (dy*dy) + (dz*dz)) - sizefactor;
return ( dist > 0 ? dist : 0);
}

float WorldObject::GetDistance2d(const WorldObject* obj) const
{
float dx = GetPositionX() - obj->GetPositionX();
Expand Down Expand Up @@ -1286,34 +1266,6 @@ float WorldObject::GetAngle( const float x, const float y ) const
return ang;
}

bool WorldObject::HasInArc(const float arcangle, const float x, const float y) const
{
// always have self in arc
if(x == GetPositionX() && y == GetPositionY())
return true;

float arc = arcangle;

// move arc to range 0.. 2*pi
while( arc >= 2.0f * M_PI_F )
arc -= 2.0f * M_PI_F;
while( arc < 0 )
arc += 2.0f * M_PI_F;

float angle = GetAngle( x, y );
angle -= GetOrientation();

// move angle to range -pi ... +pi
while( angle > M_PI_F)
angle -= 2.0f * M_PI_F;
while(angle < -M_PI_F)
angle += 2.0f * M_PI_F;

float lborder = -1 * (arc/2.0f); // in range -pi..0
float rborder = (arc/2.0f); // in range 0..pi
return (( angle >= lborder ) && ( angle <= rborder ));
}

bool WorldObject::HasInArc(const float arcangle, const WorldObject* obj) const
{
// always have self in arc
Expand Down
2 changes: 0 additions & 2 deletions src/game/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@ class MANGOS_DLL_SPEC WorldObject : public Object
virtual const char* GetNameForLocaleIdx(int32 /*locale_idx*/) const { return GetName(); }

float GetDistance( const WorldObject* obj ) const;
float GetDistanceSqr(float x, float y, float z) const;
float GetDistance(float x, float y, float z) const;
float GetDistance2d(const WorldObject* obj) const;
float GetDistance2d(float x, float y) const;
Expand Down Expand Up @@ -539,7 +538,6 @@ class MANGOS_DLL_SPEC WorldObject : public Object

float GetAngle( const WorldObject* obj ) const;
float GetAngle( const float x, const float y ) const;
bool HasInArc( const float arcangle, const float x, const float y) const;
bool HasInArc( const float arcangle, const WorldObject* obj ) const;
bool isInFrontInMap(WorldObject const* target,float distance, float arc = M_PI) const;
bool isInBackInMap(WorldObject const* target, float distance, float arc = M_PI) const;
Expand Down
Loading

0 comments on commit b8e8427

Please sign in to comment.