From 0f9872fc27b2ab81bf525639ca03402185411a7f Mon Sep 17 00:00:00 2001 From: Sryder Date: Wed, 3 Jun 2020 20:26:52 +0100 Subject: [PATCH 1/3] Draw radius for waypoint debug on "best" waypoint. Fix scale of waypoint connections on mapmobjscale maps --- src/dehacked.c | 2 ++ src/info.c | 5 ++++- src/info.h | 4 ++++ src/k_waypoint.c | 41 ++++++++++++++++++++++++++++++++++++++++- 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index ac7c213f7..f735b22e9 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -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 diff --git a/src/info.c b/src/info.c index 6c695e705..8f6989247 100644 --- a/src/info.c +++ b/src/info.c @@ -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_EGOO + #ifdef SEENAMES {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK #endif diff --git a/src/info.h b/src/info.h index 2ccf6415a..a1db87946 100644 --- a/src/info.h +++ b/src/info.h @@ -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 diff --git a/src/k_waypoint.c b/src/k_waypoint.c index 69b488dd6..2f43ea792 100644 --- a/src/k_waypoint.c +++ b/src/k_waypoint.c @@ -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,40 @@ static void K_DebugWaypointsSpawnLine(waypoint_t *const waypoint1, waypoint_t *c } while (n--); } +static void K_DebugWaypointDrawRadius(waypoint_t *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 +557,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 { From 648fa66d825c6aeeb2b6e143c58a6878d9945df4 Mon Sep 17 00:00:00 2001 From: Sryder Date: Wed, 3 Jun 2020 20:29:13 +0100 Subject: [PATCH 2/3] Add function comment --- src/info.c | 2 +- src/k_waypoint.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index 8f6989247..fcdeffcd6 100644 --- a/src/info.c +++ b/src/info.c @@ -3498,7 +3498,7 @@ 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_EGOO + {SPR_EGOO, 0, 1, {NULL}, 0, 0, S_NULL}, // S_EGOORB #ifdef SEENAMES {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK diff --git a/src/k_waypoint.c b/src/k_waypoint.c index 2f43ea792..50ab94ef6 100644 --- a/src/k_waypoint.c +++ b/src/k_waypoint.c @@ -483,6 +483,14 @@ static void K_DebugWaypointsSpawnLine(waypoint_t *const waypoint1, waypoint_t *c } while (n--); } +/*-------------------------------------------------- + void K_DebugWaypointDrawRadius(waypoint_t *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 *waypoint) { mobj_t *radiusOrb; From 6620fa96f28e03d24425977e7b4b3ae47957302a Mon Sep 17 00:00:00 2001 From: Sryder Date: Wed, 3 Jun 2020 20:30:01 +0100 Subject: [PATCH 3/3] const pointer to waypoint --- src/k_waypoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_waypoint.c b/src/k_waypoint.c index 50ab94ef6..7d119498a 100644 --- a/src/k_waypoint.c +++ b/src/k_waypoint.c @@ -484,14 +484,14 @@ static void K_DebugWaypointsSpawnLine(waypoint_t *const waypoint1, waypoint_t *c } /*-------------------------------------------------- - void K_DebugWaypointDrawRadius(waypoint_t *waypoint) + 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 *waypoint) +static void K_DebugWaypointDrawRadius(waypoint_t *const waypoint) { mobj_t *radiusOrb; mobj_t *waypointmobj;