From c46d0d0ae783e44b996f9309fbbeeedefee0dc20 Mon Sep 17 00:00:00 2001 From: vyuuui Date: Thu, 10 Nov 2022 01:41:14 -0800 Subject: [PATCH 1/2] Match CWeapon::Think Former-commit-id: 529ad0fb25ff1e56977c9fc5d756d0de1002df95 --- include/MetroidPrime/CDamageInfo.hpp | 9 +++++++++ src/MetroidPrime/Weapons/CWeapon.cpp | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/MetroidPrime/CDamageInfo.hpp b/include/MetroidPrime/CDamageInfo.hpp index 0bbb99ec..49ac01db 100644 --- a/include/MetroidPrime/CDamageInfo.hpp +++ b/include/MetroidPrime/CDamageInfo.hpp @@ -35,6 +35,15 @@ public: , x14_knockback(knockback) , x18_24_noImmunity(noImmunity) {} + CDamageInfo(const CWeaponMode& mode, float damage, float radiusDamage, float radius, float knockback, + bool noImmunity = false) + : x0_weaponMode(mode) + , x8_damage(damage) + , xc_radiusDamage(radiusDamage) + , x10_radius(radius) + , x14_knockback(knockback) + , x18_24_noImmunity(noImmunity) {} + CDamageInfo(CInputStream& in); CDamageInfo(const CDamageInfo&, float); CDamageInfo(const SShotParam& other); diff --git a/src/MetroidPrime/Weapons/CWeapon.cpp b/src/MetroidPrime/Weapons/CWeapon.cpp index 0c81cb98..153d65eb 100644 --- a/src/MetroidPrime/Weapons/CWeapon.cpp +++ b/src/MetroidPrime/Weapons/CWeapon.cpp @@ -41,7 +41,7 @@ void CWeapon::Think(float dt, CStateManager& mgr) { float radius = scale * x110_origDamageInfo.GetRadius(); float knockback = scale * x110_origDamageInfo.GetKnockBackPower(); x12c_curDamageInfo = - CDamageInfo(x110_origDamageInfo.GetWeaponMode(), damage, radius, knockback); + CDamageInfo(x110_origDamageInfo.GetWeaponMode(), damage, (double)(scale * x110_origDamageInfo.GetDamage()), radius, knockback); } else { x12c_curDamageInfo = x110_origDamageInfo; } From 7e6cdd6129bacffc9b4e7f82d2d4d0ed7c1f6daa Mon Sep 17 00:00:00 2001 From: vyuuui Date: Thu, 10 Nov 2022 16:41:09 -0800 Subject: [PATCH 2/2] Add hack comment Former-commit-id: 8c3cdb7ce6efeae0ff527e4867ba597a197b69eb --- include/MetroidPrime/CDamageInfo.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/MetroidPrime/CDamageInfo.hpp b/include/MetroidPrime/CDamageInfo.hpp index 49ac01db..71117709 100644 --- a/include/MetroidPrime/CDamageInfo.hpp +++ b/include/MetroidPrime/CDamageInfo.hpp @@ -35,6 +35,7 @@ public: , x14_knockback(knockback) , x18_24_noImmunity(noImmunity) {} + // HACK: This constructor exists to fix CWeapon::Think writing xc_radiusDamage as a double CDamageInfo(const CWeaponMode& mode, float damage, float radiusDamage, float radius, float knockback, bool noImmunity = false) : x0_weaponMode(mode)