From 32c0729af1b4a95dd05c0f32a83100d0856fb3c5 Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Wed, 8 Nov 2023 22:19:46 +0100 Subject: [PATCH] Narrow down megahealth decay autosave check 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. --- Quake/host.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Quake/host.c b/Quake/host.c index de0b9ed42..987f85d9a 100644 --- a/Quake/host.c +++ b/Quake/host.c @@ -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)