Skip to content

Commit

Permalink
Narrow down megahealth decay autosave check
Browse files Browse the repository at this point in the history
Previously, the 3 second damage window that disabled autosaving
was not triggered if the player's health was >100 in order to
avoid counting megahealth decay as taking damage. This meant,
however, that stepping in slime/lava while health was >100
had no effect on autosave.

Now autosave is disabled if the frame-to-frame health delta is
more than 3 hp (which allows for stacking 3 MHs), health is
below 100 or the player is standing in slime/lava.
  • Loading branch information
andrei-drexler committed Nov 8, 2023
1 parent d42acab commit 32c0729
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Quake/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -842,8 +842,9 @@ static void Host_CheckAutosave (void)
if (!sv.autosave.prev_health)
sv.autosave.prev_health = sv_player->v.health;
health_change = sv_player->v.health - sv.autosave.prev_health;
if (health_change < 0.f && sv_player->v.health < 100.f) // megahealth decay doesn't count as getting hurt
sv.autosave.hurt_time = qcvm->time;
if (health_change < 0.f)
if (health_change < -3.f || sv_player->v.health < 100.f || sv_player->v.watertype == CONTENTS_SLIME || sv_player->v.watertype == CONTENTS_LAVA)
sv.autosave.hurt_time = qcvm->time;
sv.autosave.prev_health = sv_player->v.health;

if (sv_player->v.button0)
Expand Down

0 comments on commit 32c0729

Please sign in to comment.