From 4a632ff5dc1f7d0f2a1e5e0c0598ab44f1dd20d1 Mon Sep 17 00:00:00 2001 From: SuperDude88 <82904174+SuperDude88@users.noreply.github.com> Date: Mon, 31 Aug 2026 18:24:30 -0400 Subject: [PATCH] Instant Death Fixes - Fix some overflows with instant death mode --- src/d/actor/d_a_alink_damage.inc | 5 +++-- src/d/d_meter2.cpp | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/d/actor/d_a_alink_damage.inc b/src/d/actor/d_a_alink_damage.inc index a57e71bcee..34701229c3 100644 --- a/src/d/actor/d_a_alink_damage.inc +++ b/src/d/actor/d_a_alink_damage.inc @@ -157,10 +157,11 @@ f32 daAlink_c::damageMagnification(BOOL i_checkZoraMag, int param_1) { } #if TARGET_PC - base_mag *= dusk::getSettings().game.damageMultiplier; if (dusk::getSettings().game.instantDeath) { - base_mag = 9999.0f; + return 9999.0f; // don't need to multiply this further, 9999 is plenty } + + base_mag *= dusk::getSettings().game.damageMultiplier; #endif if (checkWolf() && !checkCargoCarry() && param_1 == 0) { diff --git a/src/d/d_meter2.cpp b/src/d/d_meter2.cpp index 8d396e0185..302daa4b0f 100644 --- a/src/d/d_meter2.cpp +++ b/src/d/d_meter2.cpp @@ -606,7 +606,12 @@ void dMeter2_c::moveLife() { life_count = (dComIfGs_getMaxLife() / 5) * 4; } +#if TARGET_PC + int new_life = dComIfGs_getLife() + dComIfGp_getItemLifeCount(); // prevent an overflow with really large damage values +#else s16 new_life = dComIfGs_getLife() + dComIfGp_getItemLifeCount(); +#endif + if (new_life > life_count) { new_life = life_count; } else if (new_life < 0) {