Merge branch 'waypoints-disable' into 'master'

Linedef executor 499: Enable/Disable Waypoints in Tagged Sector

See merge request KartKrew/Kart!357
This commit is contained in:
Sal 2021-02-13 08:41:32 -05:00
commit 7f944ce467
5 changed files with 69 additions and 3 deletions

View file

@ -24431,7 +24431,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
},

View file

@ -633,6 +633,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))
{

View file

@ -6581,6 +6581,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)
@ -6636,6 +6641,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);

View file

@ -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));
@ -447,7 +452,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(waypoint1) || !K_GetWaypointIsEnabled(waypoint2))
{
linkcolour = SKINCOLOR_BLACK;
}
waypointmobj1 = waypoint1->mobj;
waypointmobj2 = waypoint2->mobj;
@ -474,7 +484,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 +596,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)
{

View file

@ -3917,6 +3917,40 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
PolyFade(line);
break;
// SRB2kart
case 499: // Enable/Disable Waypoints in Tagged Sectors
{
sector_t *sec;
mobj_t *thing;
if (waypointcap == NULL)
{
// No point in trying at all if no waypoints exist.
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)
{
if (line->flags & ML_NOCLIMB)
{
thing->extravalue1 = 1;
}
else
{
thing->extravalue1 = 0;
}
}
}
}
}
break;
default:
break;
}
@ -6958,6 +6992,9 @@ void P_SpawnSpecials(boolean fromnetsave)
case 2004: // Bot controller
break;
case 499: // Linedef Executor: Enable/Disable Waypoints
break;
default:
break;
}