From 69d4559ef25c58458b0417ba675d32cb720c848a Mon Sep 17 00:00:00 2001 From: wootguy Date: Fri, 6 Sep 2024 23:18:53 -0700 Subject: [PATCH] fix trigger_hurt_remote charging armor above max also fix batteries not charging up to startarmor setting --- dlls/item/CItemBattery.cpp | 4 ++-- dlls/triggers/CTriggerHurtRemote.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/item/CItemBattery.cpp b/dlls/item/CItemBattery.cpp index a395dea9..d7714028 100644 --- a/dlls/item/CItemBattery.cpp +++ b/dlls/item/CItemBattery.cpp @@ -52,7 +52,7 @@ class CItemBattery : public CItem return FALSE; } - float healthcap = m_healthcap > 0 ? m_healthcap : MAX_NORMAL_BATTERY; + float healthcap = m_healthcap > 0 ? m_healthcap : mp_startarmor.value; if ((pPlayer->pev->armorvalue < healthcap) && (pPlayer->pev->weapons & (1 << WEAPON_SUIT))) @@ -72,7 +72,7 @@ class CItemBattery : public CItem // Suit reports new power level // For some reason this wasn't working in release build -- round it. - pct = (int)((float)(pPlayer->pev->armorvalue * 100.0) * (1.0 / MAX_NORMAL_BATTERY) + 0.5); + pct = (int)((float)(pPlayer->pev->armorvalue * 100.0) * (1.0 / mp_startarmor.value) + 0.5); pct = (pct / 5); if (pct > 0) pct--; diff --git a/dlls/triggers/CTriggerHurtRemote.cpp b/dlls/triggers/CTriggerHurtRemote.cpp index a29ae783..edb40f14 100644 --- a/dlls/triggers/CTriggerHurtRemote.cpp +++ b/dlls/triggers/CTriggerHurtRemote.cpp @@ -79,6 +79,7 @@ void CTriggerHurtRemote::HurtTarget(CBaseEntity* loser) { else { if (pev->spawnflags & SF_RHURT_DO_ARMOR) { loser->pev->armorvalue = V_max(loser->pev->armorvalue - m_armorDmg, 0); + loser->pev->armorvalue = V_min(mp_startarmor.value, loser->pev->armorvalue); } if (pev->dmg > 0) {