UCRP_TRACKHAZARD fixes

- describe as "course hazard", not "track hazard", to match updated player-facing lingo
- Add rudimentary handling to allow achievement in Prison Break, Versus
This commit is contained in:
toaster 2023-12-27 15:16:03 +00:00
parent a07aeef049
commit a15f6280d7
2 changed files with 14 additions and 2 deletions

View file

@ -1817,6 +1817,16 @@ boolean M_CheckCondition(condition_t *cn, player_t *player)
case UCRP_TRACKHAZARD: case UCRP_TRACKHAZARD:
{ {
if (!(gametyperules & GTR_CIRCUIT))
{
// Prison Break/Versus
if (!player->exiting && cn->requirement == 0)
return false;
return (((player->roundconditions.hittrackhazard[0] & 1) == 1) == (cn->requirement == 1));
}
INT16 requiredlap = cn->extrainfo1; INT16 requiredlap = cn->extrainfo1;
if (requiredlap < 0) if (requiredlap < 0)
@ -2706,7 +2716,7 @@ static const char *M_GetConditionString(condition_t *cn)
case UCRP_TRACKHAZARD: case UCRP_TRACKHAZARD:
{ {
work = (cn->requirement == 1) ? "touch a track hazard" : "don't touch any track hazards"; work = (cn->requirement == 1) ? "touch a course hazard" : "don't touch any course hazards";
if (cn->extrainfo1 == -1) if (cn->extrainfo1 == -1)
return va("%s%s", work, (cn->requirement == 1) ? " on every lap" : ""); return va("%s%s", work, (cn->requirement == 1) ? " on every lap" : "");
if (cn->extrainfo1 == -2) if (cn->extrainfo1 == -2)

View file

@ -2986,10 +2986,12 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
} }
} }
else if (!(inflictor && inflictor->player) else if (!(inflictor && inflictor->player)
&& player->laps <= numlaps && !(player->exiting || player->laps > numlaps)
&& damagetype != DMG_DEATHPIT) && damagetype != DMG_DEATHPIT)
{ {
// laps will never increment outside of GTR_CIRCUIT, so this is still fine
const UINT8 requiredbit = 1<<(player->laps & 7); const UINT8 requiredbit = 1<<(player->laps & 7);
if (!(player->roundconditions.hittrackhazard[player->laps/8] & requiredbit)) if (!(player->roundconditions.hittrackhazard[player->laps/8] & requiredbit))
{ {
player->roundconditions.hittrackhazard[player->laps/8] |= requiredbit; player->roundconditions.hittrackhazard[player->laps/8] |= requiredbit;