B_waypnt.c

This module implements the waypoint system.
 

Uses:

b_locate.c
b_hcwp.c

 

Exports:
 

// Functions to access the different cache spots. These are
// necessary because it's not possible to use arrays in QuakeC.
//
// Parameter:            wp   : waypoint to update cache for
//                       dist : to be cached distance
//                       ent  : to be cached goal
// Returns:              -
//

float (entity wp, float dist, entity ent) update_cache0;
float (entity wp, float dist, entity ent) update_cache1;
float (entity wp, float dist, entity ent) update_cache2;
float (entity wp, float dist, entity ent) update_cache3;
float (entity wp, float dist, entity ent) update_cache4;
float (entity wp, float dist, entity ent) update_cache5;
float (entity wp, float dist, entity ent) update_cache6;
float (entity wp, float dist, entity ent) update_cache7;

// Setup the waypoint system, initialized bsp or hard coded
// waypoints.
//
// Parameter:            -
// Returns:              -
//

void () SetupWaypoints;

// functions to dump bsp or hard coded waypoints
//
// Parameter:            -
// Returns:              -
//

void () DumpBSPWaypointsToConsole;
void () CheckBSPWaypointDumping;
void () DumpHCWaypointsToConsole;
void () CheckHCWaypointDumping;

// functions to create hard coded waypoints
//
// Parameter:            -
// Returns:              -
//

void (vector org, float number, float type, string itemstr) HCWP_Create;
void (float number, float p0, float p1, float p2, float p3) HCWP_SetPointers1;
void (float number, float p4, float p5, float p6, float p7) HCWP_SetPointers2;

// returns true if there is a reachability link between
// the given waypoints
//
// Parameter:            w1 : first waypoint
//                       w2 : second waypoint
// Returns:              -
//

float (entity w1, entity w2) PathPointerExists;

// Checks if the player 'self' should drop a normal
// waypoint and drops one if necessary.
//
// Parameter:            -
// Returns:              -
//

void () CheckWalkWaypointDrop;

// Checks if the player should drop an item
// waypoint and drops one if necessary.
//
// Parameter:            dropper : player to drop waypoint
//                       item    : item to drop waypoint for
// Returns:              -
//

void (entity dropper, entity item) CheckItemWaypointDrop;

// Drops a teleporter waypoint.
//
// Parameter:            dropper : player to drop waypoint
//                       t       : teleporter to drop waypoint for
// Returns:              -
//

void (entity dropper, entity t) DropTeleportWaypoint;

// Drops a plat (elevator) waypoint.
//
// Parameter:            dropper : player to drop waypoint
//                       p       : plat to drop waypoint for
// Returns:              -
//

void (entity dropper, entity p) DropPlatWaypoint;

// Updates the waypoint cache
//
// Parameter:            wp        : entity to start updating from
//                       targwp    : waypoint towards updating is started
//                       startdist : distance from goal to start with
//                       e         : goal entity to update cache for
// Returns:              -
//

void (entity wp, entity targwp, float startdist, entity e) UpdateWaypointCache;

// Adds a reachability link and extends the waypoint cache.
//
// Parameter:            a : first waypoint
//                       b : second waypoint
// Returns:              -
//

void (entity a, entity b) AddPathPointerAndExtendWaypointCache;

// Returns the distance towards the given goal from the given
// waypoint.
//
// Parameter:            wp : waypoint to get distance from
//                       e  : goal the distance should be returned of
// Returns:              distance towards goal from waypoint
//

float (entity wp, entity e) CachedEntityDistance;
float (entity wp, entity e) CachedMovingEntityDistance;

// Returns true if the distance towards the given goal is cached
// at the given waypoint.
//
// Parameter:            wp : waypoint to check
//                       e  : goal to check cache for
// Returns:              true if goal is cached, false otherwise
//

float (entity wp, entity e) EntityCached;
float (entity wp, entity e) MovingEntityCached;

// Returns the neares waypoint to the goal from which the goal
// is reachable
//
// Parameter:            e  : goal
// Returns:              waypoint nearest to the entity
//

entity (entity e) NearestWaypoint;

// Creates new waypoint cache for the given entity.
//
// Parameter:            e  : entity to create cache for
// Returns:              -
//

void (entity e) CreateAllPurposeWaypointCache;