Skip to content

Commit

Permalink
ensure at least 1 dmg on instadeath critical to avoid engine bugs wit…
Browse files Browse the repository at this point in the history
…h 0 hit deaths
  • Loading branch information
burner1024 committed Dec 14, 2023
1 parent a0f6c00 commit fce85d4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions source/gl_g_damage_mod.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

#define is_critical_hit(flags) ((flags bwand DAM_CRITICAL) != 0)
#define is_bypassing_armor(flags) ((flags bwand DAM_BYPASS) != 0)
#define flag_instadeath (DAM_HIT bwor DAM_CRITICAL bwor DAM_DEAD)
#define is_instadeath_hit(flags) ((flags bwand flag_instadeath) == flag_instadeath)

variable begin
old_total = 0, new_total = 0;
Expand Down Expand Up @@ -359,6 +361,14 @@ begin
ndebug("living anatomy: +5 dmg");
total_damage = total_damage + 5;
end
// instadeath crit
if (attacker == dude_obj)
and is_instadeath_hit(flags)
and (total_damage < 1)
then begin
ndebug("instadeath: ensured 1 dmg");
total_damage = 1;
end

return total_damage;
end
Expand Down

0 comments on commit fce85d4

Please sign in to comment.