Merge branch 'waypoint-radius-debug' into 'master'

Draw radius for waypoint debug on "best" waypoint.

See merge request KartKrew/Kart!275
This commit is contained in:
Sryder 2020-06-03 15:30:55 -04:00
commit a6fef70f75
4 changed files with 58 additions and 2 deletions

View file

@ -7100,6 +7100,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_BATTLECAPSULE_SUPPORT",
"S_BATTLECAPSULE_SUPPORTFLY",
"S_EGOORB",
#ifdef SEENAMES
"S_NAMECHECK",
#endif

View file

@ -69,7 +69,8 @@ char sprnames[NUMSPRITES + 1][5] =
"ICEB","CNDL","DOCH","DUCK","GTRE","CHES","CHIM","DRGN","LZMN","PGSS",
"ZTCH","MKMA","MKMP","RTCH","BOWL","BOWH","BRRL","BRRR","HRSE","TOAH",
"BFRT","OFRT","RFRT","PFRT","ASPK","HBST","HBSO","HBSF","WBLZ","WBLN",
"FWRK","MXCL","RGSP","DRAF","GRES","OTFG","DBOS","XMS4","XMS5","VIEW"
"FWRK","MXCL","RGSP","DRAF","GRES","OTFG","DBOS","EGOO","XMS4","XMS5",
"VIEW"
};
// Doesn't work with g++, needs actionf_p1 (don't modify this comment)
@ -3497,6 +3498,8 @@ state_t states[NUMSTATES] =
{SPR_CAPS, 4, -1, {NULL}, 0, 0, S_NULL}, // S_BATTLECAPSULE_SUPPORT
{SPR_CAPS, FF_ANIMATE|5, -1, {NULL}, 3, 1, S_NULL}, // S_BATTLECAPSULE_SUPPORTFLY
{SPR_EGOO, 0, 1, {NULL}, 0, 0, S_NULL}, // S_EGOORB
#ifdef SEENAMES
{SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK
#endif

View file

@ -796,6 +796,8 @@ typedef enum sprite
SPR_DBOS, // Drift boost flame
SPR_EGOO,
// Xmas-specific sprites that don't fit aboxe
SPR_XMS4,
SPR_XMS5,
@ -4184,6 +4186,8 @@ typedef enum state
S_BATTLECAPSULE_SUPPORT,
S_BATTLECAPSULE_SUPPORTFLY,
S_EGOORB,
#ifdef SEENAMES
S_NAMECHECK,
#endif

View file

@ -474,7 +474,7 @@ static void K_DebugWaypointsSpawnLine(waypoint_t *const waypoint1, waypoint_t *c
spawnedmobj->state->tics = 1;
spawnedmobj->frame = spawnedmobj->frame & ~FF_TRANSMASK;
spawnedmobj->color = linkcolours[linkcolour];
spawnedmobj->scale = FixedMul(FRACUNIT/4, FixedDiv((15 - ((leveltime + n) % 16))*FRACUNIT, 15*FRACUNIT));
spawnedmobj->scale = FixedMul(spawnedmobj->scale, FixedMul(FRACUNIT/4, FixedDiv((15 - ((leveltime + n) % 16))*FRACUNIT, 15*FRACUNIT)));
}
x += stepx;
@ -483,6 +483,48 @@ static void K_DebugWaypointsSpawnLine(waypoint_t *const waypoint1, waypoint_t *c
} while (n--);
}
/*--------------------------------------------------
void K_DebugWaypointDrawRadius(waypoint_t *const waypoint)
Draw a debugging circle to represent a waypoint's radius
Input Arguments:-
waypoint - A waypoint to draw the radius of
--------------------------------------------------*/
static void K_DebugWaypointDrawRadius(waypoint_t *const waypoint)
{
mobj_t *radiusOrb;
mobj_t *waypointmobj;
const INT32 numRadiusMobjs = 64;
INT32 i = 0;
angle_t spawnAngle = 0U;
fixed_t spawnX= 0;
fixed_t spawnY= 0;
fixed_t spawnZ= 0;
I_Assert(waypoint != NULL);
I_Assert(waypoint->mobj != NULL);
waypointmobj = waypoint->mobj;
for (i = 0; i < numRadiusMobjs; i++)
{
spawnAngle = (ANGLE_MAX / numRadiusMobjs) * i;
spawnZ = waypointmobj->z;
spawnX = waypointmobj->x + P_ReturnThrustX(waypointmobj, spawnAngle, waypointmobj->radius);
spawnY = waypointmobj->y + P_ReturnThrustY(waypointmobj, spawnAngle, waypointmobj->radius);
radiusOrb = P_SpawnMobj(spawnX, spawnY, spawnZ, MT_SPARK);
P_SetMobjState(radiusOrb, S_THOK);
radiusOrb->state->nextstate = S_NULL;
radiusOrb->state->tics = 1;
radiusOrb->frame = radiusOrb->frame & ~FF_TRANSMASK;
radiusOrb->color = SKINCOLOR_PURPLE;
radiusOrb->scale = radiusOrb->scale / 4;
}
}
/*--------------------------------------------------
void K_DebugWaypointsVisualise(void)
@ -523,15 +565,20 @@ void K_DebugWaypointsVisualise(void)
{
if (waypoint->numnextwaypoints == 0 && waypoint->numprevwaypoints == 0)
{
P_SetMobjState(debugmobj, S_EGOORB);
debugmobj->color = SKINCOLOR_RED;
debugmobj->colorized = true;
}
else if (waypoint->numnextwaypoints == 0 || waypoint->numprevwaypoints == 0)
{
P_SetMobjState(debugmobj, S_EGOORB);
debugmobj->color = SKINCOLOR_YELLOW;
debugmobj->colorized = true;
}
else if (waypoint == players[displayplayers[0]].nextwaypoint)
{
debugmobj->color = SKINCOLOR_GREEN;
K_DebugWaypointDrawRadius(waypoint);
}
else
{