mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-05-10 19:01:50 +00:00
Reduce code duplication
This commit is contained in:
parent
04323fc39e
commit
c80f46f7c7
1 changed files with 11 additions and 24 deletions
|
|
@ -547,11 +547,9 @@ boolean Obj_ShrinkLaserCollide(mobj_t *gun, mobj_t *victim)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static waypoint_t *GetPohbeeStart(waypoint_t *anchor)
|
static waypoint_t *GetPohbeeWaypoint(waypoint_t *anchor, const UINT32 traveldist, const boolean huntbackwards)
|
||||||
{
|
{
|
||||||
const UINT32 traveldist = FixedMul(POHBEE_DIST >> 1, mapobjectscale) / FRACUNIT;
|
|
||||||
const boolean useshortcuts = false;
|
const boolean useshortcuts = false;
|
||||||
const boolean huntbackwards = true;
|
|
||||||
boolean pathfindsuccess = false;
|
boolean pathfindsuccess = false;
|
||||||
path_t pathtofinish = {0};
|
path_t pathtofinish = {0};
|
||||||
waypoint_t *ret = NULL;
|
waypoint_t *ret = NULL;
|
||||||
|
|
@ -573,34 +571,23 @@ static waypoint_t *GetPohbeeStart(waypoint_t *anchor)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static waypoint_t *GetPohbeeStart(waypoint_t *anchor)
|
||||||
|
{
|
||||||
|
const UINT32 traveldist = FixedMul(POHBEE_DIST >> 1, mapobjectscale) / FRACUNIT;
|
||||||
|
const boolean huntbackwards = true;
|
||||||
|
|
||||||
|
return GetPohbeeWaypoint(anchor, traveldist, huntbackwards);
|
||||||
}
|
}
|
||||||
|
|
||||||
static waypoint_t *GetPohbeeEnd(waypoint_t *anchor)
|
static waypoint_t *GetPohbeeEnd(waypoint_t *anchor)
|
||||||
{
|
{
|
||||||
const UINT32 traveldist = FixedMul(POHBEE_DIST, mapobjectscale) / FRACUNIT;
|
const UINT32 traveldist = FixedMul(POHBEE_DIST, mapobjectscale) / FRACUNIT;
|
||||||
const boolean useshortcuts = false;
|
|
||||||
const boolean huntbackwards = false;
|
const boolean huntbackwards = false;
|
||||||
boolean pathfindsuccess = false;
|
|
||||||
path_t pathtofinish = {0};
|
|
||||||
waypoint_t *ret = NULL;
|
|
||||||
|
|
||||||
pathfindsuccess = K_PathfindThruCircuit(
|
return GetPohbeeWaypoint(anchor, traveldist, huntbackwards);
|
||||||
anchor, traveldist,
|
|
||||||
&pathtofinish,
|
|
||||||
useshortcuts, huntbackwards
|
|
||||||
);
|
|
||||||
|
|
||||||
if (pathfindsuccess == true)
|
|
||||||
{
|
|
||||||
ret = (waypoint_t *)pathtofinish.array[ pathtofinish.numnodes - 1 ].nodedata;
|
|
||||||
Z_Free(pathtofinish.array);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ret = anchor;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CreatePohbee(player_t *owner, waypoint_t *start, waypoint_t *end, UINT8 numLasers)
|
static void CreatePohbee(player_t *owner, waypoint_t *start, waypoint_t *end, UINT8 numLasers)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue