K_GlanceAtPlayers: Special handling for stopped players in Podium

1st: Look straight at camera, no matter what
2nd, 3rd: Look at any players with a better position, no matter how far away they are
Loser Valley: Stare forward like the serfs you are
This commit is contained in:
toaster 2023-06-28 20:42:20 +01:00
parent c864bb9182
commit f6ea3759c9

View file

@ -2063,6 +2063,22 @@ static SINT8 K_GlanceAtPlayers(player_t *glancePlayer, boolean horn)
UINT8 i; UINT8 i;
SINT8 glanceDir = 0; SINT8 glanceDir = 0;
SINT8 lastValidGlance = 0; SINT8 lastValidGlance = 0;
boolean podiumspecial = (K_PodiumSequence() == true && glancePlayer->nextwaypoint == NULL && glancePlayer->speed == 0);
if (podiumspecial)
{
if (glancePlayer->position > 3)
{
// Loser valley, focused on the mountain.
return 0;
}
if (glancePlayer->position == 1)
{
// Sitting on the stand, I ammm thebest!
return 0;
}
}
// See if there's any players coming up behind us. // See if there's any players coming up behind us.
// If so, your character will glance at 'em. // If so, your character will glance at 'em.
@ -2100,9 +2116,17 @@ static SINT8 K_GlanceAtPlayers(player_t *glancePlayer, boolean horn)
continue; continue;
} }
distance = R_PointToDist2(glancePlayer->mo->x, glancePlayer->mo->y, p->mo->x, p->mo->y); if (!podiumspecial)
{
distance = R_PointToDist2(glancePlayer->mo->x, glancePlayer->mo->y, p->mo->x, p->mo->y);
if (distance > maxdistance) if (distance > maxdistance)
{
// Too far away
continue;
}
}
else if (p->position >= glancePlayer->position)
{ {
continue; continue;
} }
@ -2116,7 +2140,7 @@ static SINT8 K_GlanceAtPlayers(player_t *glancePlayer, boolean horn)
dir = -dir; dir = -dir;
} }
if (diff > ANGLE_90) if (diff > (podiumspecial ? (ANGLE_180 - blindSpotSize) : ANGLE_90))
{ {
// Not behind the player // Not behind the player
continue; continue;
@ -2128,20 +2152,22 @@ static SINT8 K_GlanceAtPlayers(player_t *glancePlayer, boolean horn)
continue; continue;
} }
if (P_CheckSight(glancePlayer->mo, p->mo) == true) if (!podiumspecial && P_CheckSight(glancePlayer->mo, p->mo) == false)
{ {
// Not blocked by a wall, we can glance at 'em! // Blocked by a wall, we can't glance at 'em!
// Adds, so that if there's more targets on one of your sides, it'll glance on that side. continue;
glanceDir += dir; }
// That poses a limitation if there's an equal number of targets on both sides... // Adds, so that if there's more targets on one of your sides, it'll glance on that side.
// In that case, we'll pick the last chosen glance direction. glanceDir += dir;
lastValidGlance = dir;
if (horn == true) // That poses a limitation if there's an equal number of targets on both sides...
{ // In that case, we'll pick the last chosen glance direction.
K_FollowerHornTaunt(glancePlayer, p); lastValidGlance = dir;
}
if (horn == true)
{
K_FollowerHornTaunt(glancePlayer, p);
} }
} }