22 #include <csutil/weakref.h> 23 #include <csutil/parray.h> 24 #include <csutil/list.h> 25 #include <igeom/path.h> 26 #include <csgeom/vector3.h> 68 bool Load(iResultRow& row, iEngine *engine);
71 bool Create(iDataConnection *
db,
int pathID);
74 bool Remove(iDataConnection *
db);
77 bool UpdatePrevPointId(iDataConnection *
db,
int prevPointId);
80 bool Adjust(iDataConnection *
db, csVector3 & pos, csString sector);
84 void Adjust(csVector3 & pos, csString sector);
88 void Adjust(csVector3 & pos, iSector* sector);
96 int GetID()
const {
return id; }
97 void SetID(
int id) { this->
id = id; }
100 iSector * GetSector(iEngine *engine);
101 iSector * GetSector(iEngine *engine)
const;
103 float GetRadius()
const;
105 void SetWaypoint(
Waypoint* waypoint);
129 int GetPathIndex()
const;
144 csWeakRef<iSector> sector;
146 float startDistance[2];
183 bool Load(iDataConnection *
db, iEngine *engine);
186 bool Create(iDataConnection *
db);
189 bool Adjust(iDataConnection *
db,
int index, csVector3 & pos, csString sector);
195 psPathPoint* AddPoint(iDataConnection *
db,
const csVector3& pos,
const char * sectorName,
bool first =
false);
198 psPathPoint* AddPoint(
const csVector3& pos,
float radius,
const char * sectorName,
bool first =
false);
201 psPathPoint* InsertPoint(iDataConnection *
db,
int index,
const csVector3& pos,
const char * sectorName);
204 bool RemovePoint(iDataConnection *
db,
int index);
207 bool RemovePoint(
int index);
213 bool UpdatePrevPointIndexes(iDataConnection*
db);
222 virtual void Precalculate(
psWorld * world, iEngine *engine,
bool forceUpdate =
false);
225 virtual float Distance(
psWorld * world, iEngine *engine,
const csVector3& pos,
const iSector* sector,
int * index = NULL,
float * fraction = NULL)
const;
228 virtual float DistancePoint(
psWorld * world, iEngine *engine,
const csVector3& pos,
const iSector* sector,
int * index = NULL,
bool include_ends =
false)
const;
237 Waypoint* GetStartWaypoint(Direction direction);
240 Waypoint* GetEndWaypoint(Direction direction);
243 csVector3 GetEndPos(Direction direction);
246 float GetEndRot(Direction direction);
249 iSector* GetEndSector(iEngine * engine, Direction direction);
259 virtual const char*
GetName()
const {
return name.GetDataSafe(); }
265 bool Rename(iDataConnection *
db,
const char* name);
268 void Rename(
const char* name);
271 virtual float GetLength(
psWorld * world, iEngine *engine,
int index);
274 virtual float GetLength(
psWorld * world, iEngine *engine);
277 float CalculateIncidentAngle(csVector3& pos, csVector3& dest);
280 csString GetFlags()
const;
283 void SetFlags(
const psString & flagStr);
286 bool SetFlag(iDataConnection * db,
const csString &flagstr,
bool enable);
289 bool SetFlag(
const csString &flagstr,
bool enable);
292 size_t FindPointsInSector(iEngine * engine, iSector *sector, csList<psPathPoint*>& list);
298 int FindPointIndex(
int id)
const;
301 int FindPointIndex(
const psPathPoint* point)
const;
311 virtual void PrecalculatePath(
psWorld * world, iEngine *engine) = 0;
332 virtual void PrecalculatePath(
psWorld * world, iEngine *engine);
335 virtual void GetInterpolatedPosition (
int index,
float fraction, csVector3& pos);
338 virtual void GetInterpolatedUp (
int index,
float fraction, csVector3& up);
341 virtual void GetInterpolatedForward (
int index,
float fraction, csVector3& forward);
360 virtual void GetInterpolatedPosition (csVector3& pos);
363 virtual void GetInterpolatedUp (csVector3& up);
366 virtual void GetInterpolatedForward (csVector3& forward);
370 virtual bool Extrapolate(
psWorld * world, iEngine *engine,
float delta,
psPath::Direction direction, iMovable* movable);
387 float currentAtFraction;
psWorld is in charge of managing all regions (zone map files) and loading/unloading them as needed...
virtual void GetInterpolatedUp(csVector3 &up)
Get the interpolated up vector.
void SetPrevious(int previous)
Set the previous point id.
int GetPreviousPointId() const
Get the previous point id.
int GetCurrentAtIndex()
Get the index to the current path point.
const char * GetName(int id)
float GetCurrentAtFraction()
Get the current fraction of the current path segment.
void SetFlag(const char *name, bool flag, uint32 filter)
virtual void GetInterpolatedPosition(csVector3 &pos)
Get the interpolated position.
A waypoint is a specified circle on the map with a name, location, and a list of waypoints it is conn...
int GetID() const
Get ID of the path.
virtual const char * GetName() const
Get name of the path.
PathPointArray points
The points this path consists of including start wp and end wp.
iDataConnection * db
Global connection to the Database. Set from the psDatabase class.
virtual void GetInterpolatedForward(csVector3 &forward)
Get the interpolated forward vector.
const csVector3 & GetPosition() const
csPDelArray< psPathPoint > PathPointArray
virtual uint32_t GetEffectID()=0
bool teleport
Teleport between the waypoints.
Helper interface to allocate effect IDs.
virtual int GetNumPoints() const
Get number of points in path.
A Location is a named place on the map, located dynamically by NPCs as scripted.
Waypoint * start
This path start waypoint.
A network of Waypoint and psPath objects.
float GetDistance()
Get the current distance this anchor has moved along the path.
psPath::Direction GetCurrentAtDirection()
Get the current direction.
Represents a point on a path between two waypoints.
Waypoint * end
This path end waypoint.