mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Refactor some things to make slightly clearer code Change comments to use completely tabs Add extra error checks to methods for helpful debugging and safety Use a heap of waypoints during creation to be able to search for them to make links, to not freeze the game Add a way to clear waypoints so that the methods don't error after more than one map load Flip the ambush flag so that adding it will make the waypoint unable to be respawned at when the feature happens Temporarily disable K_UpdateKartPosition so that it doesn't crash on map load
80 lines
No EOL
2.7 KiB
C
80 lines
No EOL
2.7 KiB
C
#ifndef __K_WAYPOINT__
|
|
#define __K_WAYPOINT__
|
|
|
|
#include "doomdef.h"
|
|
#include "p_mobj.h"
|
|
|
|
typedef struct waypoint_s
|
|
{
|
|
mobj_t *mobj;
|
|
UINT32 id;
|
|
struct waypoint_s **nextwaypoints;
|
|
struct waypoint_s **prevwaypoints;
|
|
fixed_t *nextwaypointdistances;
|
|
fixed_t *prevwaypointdistances;
|
|
UINT32 numnextwaypoints;
|
|
UINT32 numprevwaypoints;
|
|
} waypoint_t;
|
|
|
|
|
|
// AVAILABLE FOR LUA
|
|
|
|
|
|
/*--------------------------------------------------
|
|
waypoint_t *K_SearchWaypointGraphForMobj(mobj_t * const mobj)
|
|
|
|
Searches through the waypoint graph for a waypoint that has an mobj, if a waypoint can be found through here it
|
|
does mean that the waypoint graph can be traversed to find it
|
|
|
|
Input Arguments:-
|
|
mobj - The mobj that we are searching for, cannot be changed to a different pointer
|
|
|
|
Return:-
|
|
The waypoint that uses that mobj, NULL if it wasn't found, NULL if it isn't an MT_WAYPOINT
|
|
--------------------------------------------------*/
|
|
|
|
waypoint_t *K_SearchWaypointGraphForMobj(mobj_t * const mobj);
|
|
|
|
/*--------------------------------------------------
|
|
waypoint_t *K_SearchWaypointHeapForMobj(mobj_t * const mobj)
|
|
|
|
Searches through the waypoint heap for a waypoint that has an mobj, this does not necessarily mean the waypoint
|
|
can be reached from another waypoint
|
|
|
|
Input Arguments:-
|
|
mobj - The mobj that we are searching for, cannot be changed to a different pointer
|
|
|
|
Return:-
|
|
The waypoint that uses that mobj, NULL if it wasn't found, NULL if it isn't an MT_WAYPOINT
|
|
--------------------------------------------------*/
|
|
|
|
waypoint_t *K_SearchWaypointHeapForMobj(mobj_t * const mobj);
|
|
|
|
// NOT AVAILABLE FOR LUA
|
|
|
|
|
|
/*--------------------------------------------------
|
|
boolean K_SetupWaypointList()
|
|
|
|
Sets up the waypoint list for Kart race maps, prints out warnings if something is wrong.
|
|
|
|
Return:-
|
|
true if waypoint setup was seemingly successful, false if no waypoints were setup
|
|
A true return value does not necessarily mean that the waypoints on the map are completely correct
|
|
--------------------------------------------------*/
|
|
|
|
boolean K_SetupWaypointList(void);
|
|
|
|
|
|
/*--------------------------------------------------
|
|
void K_ClearWaypoints()
|
|
|
|
Clears waypointheap, firstwaypoint, numwaypoints, and numwaypointmobjs
|
|
WARNING: This does *not* Free waypointheap or any waypoints! They are stored in PU_LEVEL so they are freed once
|
|
the level is completed! This is called just before K_SetupWaypointList in P_SetupLevel as they are freed then.
|
|
A separate method is called in K_SetupWaypointList that will free everything specifically if they aren't already
|
|
--------------------------------------------------*/
|
|
|
|
void K_ClearWaypoints(void);
|
|
|
|
#endif |