From ec2ec9ad6dc334522d5175967be8e4a468874896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Mon, 28 Sep 2026 03:39:31 +0200 Subject: Damage: move Game/Damage under Game/Actor Link order: the damage code is interleaved with actor TUs inside the Game/Actor block, not in a block of its own. (AI assisted using Claude Fable 5.1 and Claude Opus 5.5) --- src/Game/Actor/Damage/dmgStruct20.cpp | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/Game/Actor/Damage/dmgStruct20.cpp (limited to 'src/Game/Actor/Damage/dmgStruct20.cpp') diff --git a/src/Game/Actor/Damage/dmgStruct20.cpp b/src/Game/Actor/Damage/dmgStruct20.cpp new file mode 100644 index 00000000..d52eb3a6 --- /dev/null +++ b/src/Game/Actor/Damage/dmgStruct20.cpp @@ -0,0 +1,53 @@ +#include "Game/Actor/Damage/dmgStruct20.h" + +namespace uking::dmg { + +void Struct20::reset() { + mField_8 = 0; + mField_C = 0; + mField_10 = 0; + mField_14 = -1; + mField_18 = -1; +} + +void Struct20::combineMaybe(Struct20Base* other) { + Struct20* otherStruct = sead::DynamicCast(other); + if (!otherStruct) { + return; + } + + mField_8 += otherStruct->mField_8; + mField_C += otherStruct->mField_C; + mField_10 += otherStruct->mField_10; + if (mField_18 < otherStruct->mField_18) { + mField_14 = otherStruct->mField_14; + mField_18 = otherStruct->mField_18; + } +} + +void Struct20_2::reset() { + mField_1C = 0; + mField_30 = false; + + Struct20::reset(); +} + +void Struct20_2::combineMaybe(Struct20Base* other) { + Struct20_2* otherStruct = sead::DynamicCast(other); + if (!otherStruct) { + Struct20::combineMaybe(other); + return; + } + + mField_1C |= otherStruct->mField_1C; + Struct20::combineMaybe(other); + if (mField_18 == otherStruct->mField_18 && otherStruct->mField_30) { + mField_30 = true; + mField_20 = otherStruct->mField_20; + mField_24 = otherStruct->mField_24; + mField_28 = otherStruct->mField_28; + mField_2C = otherStruct->mField_2C; + } +} + +} // namespace uking::dmg -- cgit v1.2.3