From 419f8f46bb40763d9602e4f975a033194281c5f5 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: ksys/act: split IDamageManager out of DamageManagerBase DamageManagerBase's root base class (previously DamageManagerBase_UnknownBase1) holds the damage callback list, and its code is linked among the ActorSystem objects rather than with the Game/Actor/Damage files. It appears to be an engine-side abstract base, so let's move it to KingSystem/ActorSystem as ksys::act::IDamageManager (unofficial name, following the ksys IManager/Manager pattern and Actor::getDamageMgr), together with DamageCallback and Struct20Base, and have Actor::getDamageMgr return it. DamageManagerBase now overrides its getters and inherits addDamageCallback/removeDamageCallback from it. The rest of the damage code stays in Game/Actor/Damage but is regrouped to match link order: Struct20::combineMaybe moves into actDamageManagerBase.cpp, Struct20::reset becomes inline and dmgStruct20.cpp becomes actDamageMgr.cpp. The uking::dmg namespace is merged into uking::act, so the files there take the act prefix too, and dmgInfoManager becomes actDamageInfoMgr after the class it holds. (AI assisted using Claude Fable 5.1 and Claude Opus 5.5) --- src/Game/Actor/Damage/dmgStruct20.cpp | 53 ----------------------------------- 1 file changed, 53 deletions(-) delete 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 deleted file mode 100644 index d52eb3a6..00000000 --- a/src/Game/Actor/Damage/dmgStruct20.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#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