From 07320723d8a6f667997f4c1097f0af9224a5b3ed Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 1 Feb 2021 18:17:51 -0500 Subject: [PATCH 1/7] Waypoint disable/enable executor Not tested yet --- src/p_spec.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/p_spec.c b/src/p_spec.c index 1fcba7585..bae374381 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3893,6 +3893,32 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) PolyFade(line); break; + // SRB2kart + case 2003: // Enable/Disable Waypoints in Tagged Sectors + { + sector_t *sec; + mobj_t *thing; + + while ((secnum = P_FindSectorFromTag(line->tag, secnum)) >= 0) + { + sec = sectors + secnum; + + for (thing = sec->thinglist; thing; thing = thing->snext) + if (thing->type == MT_WAYPOINT) + { + if (line->flags & ML_NOCLIMB) + { + thing->extravalue1 = 1; + } + else + { + thing->extravalue1 = 0; + } + } + } + break; + } + default: break; } From 1bf8fb595ab69f1bc8942bf3c1a97c311ba809fd Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 1 Feb 2021 19:12:32 -0500 Subject: [PATCH 2/7] Waypoint debug shows disabled waypoints as grey with black connections --- src/k_waypoint.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/k_waypoint.c b/src/k_waypoint.c index db8289aaa..73f8de23d 100644 --- a/src/k_waypoint.c +++ b/src/k_waypoint.c @@ -447,7 +447,12 @@ static void K_DebugWaypointsSpawnLine(waypoint_t *const waypoint1, waypoint_t *c I_Assert(waypoint2->mobj != NULL); I_Assert(cv_kartdebugwaypoints.value != 0); - linkcolour = K_GetWaypointID(waypoint1)%linkcolourssize; + linkcolour = linkcolours[K_GetWaypointID(waypoint1) % linkcolourssize]; + + if (!K_GetWaypointIsEnabled(waypoint2)) + { + linkcolour = SKINCOLOR_BLACK; + } waypointmobj1 = waypoint1->mobj; waypointmobj2 = waypoint2->mobj; @@ -474,7 +479,7 @@ static void K_DebugWaypointsSpawnLine(waypoint_t *const waypoint1, waypoint_t *c spawnedmobj->state->nextstate = S_NULL; spawnedmobj->state->tics = 1; spawnedmobj->frame = spawnedmobj->frame & ~FF_TRANSMASK; - spawnedmobj->color = linkcolours[linkcolour]; + spawnedmobj->color = linkcolour; spawnedmobj->scale = FixedMul(spawnedmobj->scale, FixedMul(FRACUNIT/4, FixedDiv((15 - ((leveltime + n) % 16))*FRACUNIT, 15*FRACUNIT))); } @@ -586,6 +591,11 @@ void K_DebugWaypointsVisualise(void) debugmobj->color = SKINCOLOR_BLUE; } + if (!K_GetWaypointIsEnabled(waypoint)) + { + debugmobj->color = SKINCOLOR_GREY; + } + // Valid waypoint, so draw lines of SPARKLES to its next or previous waypoints if (cv_kartdebugwaypoints.value == 1) { From 9d4afb9aec4649c10298fa2427b8e9cac33d1c48 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 1 Feb 2021 19:58:15 -0500 Subject: [PATCH 3/7] Players/bots ignore disabled waypoints --- src/k_bot.c | 4 ++++ src/k_kart.c | 10 ++++++++++ src/k_waypoint.c | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/src/k_bot.c b/src/k_bot.c index 21cd4f18e..5219b5c96 100644 --- a/src/k_bot.c +++ b/src/k_bot.c @@ -625,6 +625,10 @@ static botprediction_t *K_CreateBotPrediction(player_t *player) for (i = 0; i < wp->numnextwaypoints; i++) { + if (!K_GetWaypointIsEnabled(wp->nextwaypoints[i])) + { + continue; + } if (K_GetWaypointIsShortcut(wp->nextwaypoints[i]) && !K_BotCanTakeCut(player)) { diff --git a/src/k_kart.c b/src/k_kart.c index 0d87dbe12..c8a5ba147 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6295,6 +6295,11 @@ static waypoint_t *K_GetPlayerNextWaypoint(player_t *player) { for (i = 0U; i < waypoint->numnextwaypoints; i++) { + if (!K_GetWaypointIsEnabled(waypoint->nextwaypoints[i])) + { + continue; + } + if (K_PlayerUsesBotMovement(player) == true && K_GetWaypointIsShortcut(waypoint->nextwaypoints[i]) == true && K_BotCanTakeCut(player) == false) @@ -6350,6 +6355,11 @@ static waypoint_t *K_GetPlayerNextWaypoint(player_t *player) { for (i = 0U; i < waypoint->numprevwaypoints; i++) { + if (!K_GetWaypointIsEnabled(waypoint->prevwaypoints[i])) + { + continue; + } + angletowaypoint = R_PointToAngle2( player->mo->x, player->mo->y, waypoint->prevwaypoints[i]->mobj->x, waypoint->prevwaypoints[i]->mobj->y); diff --git a/src/k_waypoint.c b/src/k_waypoint.c index 73f8de23d..3e3dee582 100644 --- a/src/k_waypoint.c +++ b/src/k_waypoint.c @@ -280,6 +280,11 @@ waypoint_t *K_GetBestWaypointForMobj(mobj_t *const mobj) checkwaypoint = &waypointheap[i]; + if (!K_GetWaypointIsEnabled(checkwaypoint)) + { + continue; + } + checkdist = P_AproxDistance( (mobj->x / FRACUNIT) - (checkwaypoint->mobj->x / FRACUNIT), (mobj->y / FRACUNIT) - (checkwaypoint->mobj->y / FRACUNIT)); From af2b525d31e106e65577dd3f6b43c514fa55b741 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 1 Feb 2021 21:45:42 -0500 Subject: [PATCH 4/7] Use linedef 499, make it actually work --- src/p_spec.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index b14a20532..51ddc2026 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3904,25 +3904,25 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; // SRB2kart - case 2003: // Enable/Disable Waypoints in Tagged Sectors { sector_t *sec; mobj_t *thing; while ((secnum = P_FindSectorFromTag(line->tag, secnum)) >= 0) + case 499: // Enable/Disable Waypoints in Tagged Sectors { sec = sectors + secnum; + { for (thing = sec->thinglist; thing; thing = thing->snext) if (thing->type == MT_WAYPOINT) + // Needs to do this instead of simply iterating through sector thing list because they have MF_NOSECTOR. { - if (line->flags & ML_NOCLIMB) { thing->extravalue1 = 1; } - else { - thing->extravalue1 = 0; + waypointmobj->extravalue1 = 0; } } } @@ -6965,6 +6965,8 @@ void P_SpawnSpecials(boolean fromnetsave) break; case 2002: // Linedef Trigger: Race Lap break; + case 499: // Linedef Executor: Enable/Disable Waypoints + break; default: break; From 51a8d8d5cd9116e8b391e265c436f989bded397e Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 1 Feb 2021 21:46:17 -0500 Subject: [PATCH 5/7] Not everything got commited... --- src/p_spec.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 51ddc2026..425c4ed27 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3904,30 +3904,41 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; // SRB2kart - { - sector_t *sec; - mobj_t *thing; - - while ((secnum = P_FindSectorFromTag(line->tag, secnum)) >= 0) case 499: // Enable/Disable Waypoints in Tagged Sectors { - sec = sectors + secnum; - { + sector_t *sec; + mobj_t *waypointmobj; + + if (waypointcap == NULL) + { + break; + } + + while ((secnum = P_FindSectorFromTag(line->tag, secnum)) >= 0) + { + sec = sectors + secnum; - for (thing = sec->thinglist; thing; thing = thing->snext) - if (thing->type == MT_WAYPOINT) // Needs to do this instead of simply iterating through sector thing list because they have MF_NOSECTOR. + // Maybe it'd be OK to remove, but I'd like to play it safe. + for (waypointmobj = waypointcap; waypointmobj != NULL; waypointmobj = waypointmobj->tracer) { + sector_t *waypointSector = R_PointInSubsector(waypointmobj->x, waypointmobj->y)->sector; + + if (waypointSector == sec) { - thing->extravalue1 = 1; - } - { + if (line->flags & ML_NOCLIMB) + { + waypointmobj->extravalue1 = 1; + } + else + { waypointmobj->extravalue1 = 0; + } } } + } } break; - } default: break; From 2a2198ade1cd849712d212d2955a555bdccf6d06 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Wed, 3 Feb 2021 17:18:37 -0500 Subject: [PATCH 6/7] Remove MF_NOSECTOR from MT_WAYPOINT, so the linedef executor can search through sector thinglist for them. --- src/info.c | 2 +- src/p_spec.c | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/info.c b/src/info.c index c6f082a5c..73666e730 100644 --- a/src/info.c +++ b/src/info.c @@ -24278,7 +24278,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOCLIP|MF_NOGRAVITY|MF_SCENERY, // flags + MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_SCENERY, // flags S_NULL // raisestate }, diff --git a/src/p_spec.c b/src/p_spec.c index 425c4ed27..1973e8708 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3907,10 +3907,11 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 499: // Enable/Disable Waypoints in Tagged Sectors { sector_t *sec; - mobj_t *waypointmobj; + mobj_t *thing; if (waypointcap == NULL) { + // No point in trying at all if no waypoints exist. break; } @@ -3918,21 +3919,17 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) { sec = sectors + secnum; - // Needs to do this instead of simply iterating through sector thing list because they have MF_NOSECTOR. - // Maybe it'd be OK to remove, but I'd like to play it safe. - for (waypointmobj = waypointcap; waypointmobj != NULL; waypointmobj = waypointmobj->tracer) + for (thing = sec->thinglist; thing; thing = thing->snext) { - sector_t *waypointSector = R_PointInSubsector(waypointmobj->x, waypointmobj->y)->sector; - - if (waypointSector == sec) + if (thing->type == MT_WAYPOINT) { if (line->flags & ML_NOCLIMB) { - waypointmobj->extravalue1 = 1; + thing->extravalue1 = 1; } else { - waypointmobj->extravalue1 = 0; + thing->extravalue1 = 0; } } } From 68ce8939b97057f66c48ecfc2b0e18f77b272dda Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Wed, 3 Feb 2021 17:20:32 -0500 Subject: [PATCH 7/7] Draw black connection if either waypoint is disabled, instead of only the destination I think this makes a bit more sense --- src/k_waypoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_waypoint.c b/src/k_waypoint.c index 3e3dee582..39e9efa5e 100644 --- a/src/k_waypoint.c +++ b/src/k_waypoint.c @@ -454,7 +454,7 @@ static void K_DebugWaypointsSpawnLine(waypoint_t *const waypoint1, waypoint_t *c linkcolour = linkcolours[K_GetWaypointID(waypoint1) % linkcolourssize]; - if (!K_GetWaypointIsEnabled(waypoint2)) + if (!K_GetWaypointIsEnabled(waypoint1) || !K_GetWaypointIsEnabled(waypoint2)) { linkcolour = SKINCOLOR_BLACK; }