diff options
| author | Léo Lam <leo@leolam.fr> | 2026-09-28 03:39:30 +0200 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2026-10-06 03:19:38 +0200 |
| commit | d8da4fc5f2f159f2ea3386d7018e61629759bc09 (patch) | |
| tree | 832823a30fbddda2c605dd3e99fc31a42b85ec3c /src/KingSystem/ActorSystem | |
| parent | 34e57daf613053d248c65d22bd93bf60b245c0dd (diff) | |
Actor: PlayerInfo/PlayerBase are game, GameConfig ksys
Every decomp user of PlayerInfo is game code, and PlayerBase sits right
above Player. GameConfig.h models the engine base that
links at GameConfig's slot in KingSystem/System.
(AI assisted using Claude Fable 5.1 and Claude Opus 5.5)
Diffstat (limited to 'src/KingSystem/ActorSystem')
| -rw-r--r-- | src/KingSystem/ActorSystem/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/Profiles/actPlayerBase.cpp | 1 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/Profiles/actPlayerBase.h | 19 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actPlayerInfo.cpp | 134 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actPlayerInfo.h | 120 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actPlayerInfoBase.cpp | 6 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actPlayerInfoStub.cpp | 19 |
7 files changed, 0 insertions, 305 deletions
diff --git a/src/KingSystem/ActorSystem/CMakeLists.txt b/src/KingSystem/ActorSystem/CMakeLists.txt index 5a5dd758..dab97a14 100644 --- a/src/KingSystem/ActorSystem/CMakeLists.txt +++ b/src/KingSystem/ActorSystem/CMakeLists.txt @@ -16,8 +16,6 @@ target_sources(uking PRIVATE LOD/actLodState.cpp LOD/actLodState.h - Profiles/actPlayerBase.cpp - Profiles/actPlayerBase.h Profiles/actRopeBase.cpp Profiles/actRopeBase.h Profiles/actWeaponBase.cpp @@ -116,10 +114,6 @@ target_sources(uking PRIVATE actPhysicsConstraints.h actPhysicsUserTag.cpp actPhysicsUserTag.h - actPlayerInfo.cpp - actPlayerInfo.h - actPlayerInfoBase.cpp - actPlayerInfoStub.cpp actTag.h actionDummyAction.cpp diff --git a/src/KingSystem/ActorSystem/Profiles/actPlayerBase.cpp b/src/KingSystem/ActorSystem/Profiles/actPlayerBase.cpp deleted file mode 100644 index abc059cd..00000000 --- a/src/KingSystem/ActorSystem/Profiles/actPlayerBase.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "KingSystem/ActorSystem/Profiles/actPlayerBase.h" diff --git a/src/KingSystem/ActorSystem/Profiles/actPlayerBase.h b/src/KingSystem/ActorSystem/Profiles/actPlayerBase.h deleted file mode 100644 index 4b6e6ec7..00000000 --- a/src/KingSystem/ActorSystem/Profiles/actPlayerBase.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include <prim/seadSafeString.h> -#include "KingSystem/ActorSystem/actActor.h" - -namespace ksys::act { - -// TODO -class PlayerBase : public Actor { -public: - // FIXME: name for x and name+type for y - void switchEquipment(const sead::SafeString& slot, int frames, int x = -1, - const uintptr_t& y = {}); - - // FIXME: name for x - void setExtraLife(s32 extra_life, f32 x); -}; - -} // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/actPlayerInfo.cpp b/src/KingSystem/ActorSystem/actPlayerInfo.cpp deleted file mode 100644 index 5b5b9ca1..00000000 --- a/src/KingSystem/ActorSystem/actPlayerInfo.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#include "KingSystem/ActorSystem/actPlayerInfo.h" -#include "KingSystem/ActorSystem/Profiles/actPlayerBase.h" -#include "KingSystem/ActorSystem/actActorConstDataAccess.h" -#include "KingSystem/ActorSystem/actActorLinkConstDataAccess.h" -#include "KingSystem/ActorSystem/actBaseProc.h" -#include "KingSystem/ActorSystem/actBaseProcMgr.h" -#include "KingSystem/GameData/gdtCommonFlagsUtils.h" -#include "KingSystem/ksys.h" - -namespace ksys::act { - -SEAD_SINGLETON_DISPOSER_IMPL(PlayerInfo) - -PlayerInfo::PlayerInfo() = default; -PlayerInfo::~PlayerInfo() = default; - -bool PlayerInfo::init() { - return true; -} - -void PlayerInfo::resetPlayer(PlayerBase* player) { - if (mPlayerActor == player) { - mPlayerActor = nullptr; - ksys::setPlayerLink(nullptr); - } -} - -bool PlayerInfo::acquireHorse(BaseProc* horse) { - return mHorseLink.acquire(horse, false); -} - -void PlayerInfo::setHorseLink(const BaseProcLink& horse_link) { - mHorseLink = horse_link; -} - -PlayerBase* PlayerInfo::getPlayer() const { - if (!mPlayerActor) { - return nullptr; - } - BaseProcMgr::instance()->isAccessingProcSafe(mPlayerActor, nullptr); - return mPlayerActor; -} - -PlayerBase* PlayerInfo::getPlayer_() const { - if (!mPlayerActor) { - return nullptr; - } - BaseProcMgr::instance()->isAccessingProcSafe(mPlayerActor, nullptr); - return mPlayerActor; -} - -s32 PlayerInfo::getMaxLifeFromPlayerActor() const { - return mPlayerActor ? mPlayerActor->getMaxLife() : 0; -} - -void PlayerInfo::setMaxHeartValue(s32 quarter_hearts) { - gdt::setFlag_MaxHartValue(quarter_hearts); - mMaxHeartValue = static_cast<f32>(quarter_hearts); -} - -u32 PlayerInfo::getMaxHeartValue() const { - // Return type is unsigned, but the conversion is signed - return static_cast<s32>(mMaxHeartValue); -} - -void PlayerInfo::updateMaxHeartValueFromGameData() { - mMaxHeartValue = static_cast<f32>(gdt::getFlag_MaxHartValue()); -} - -void PlayerInfo::setLifeForPlayerActor(s32 life) { - if (mPlayerActor) { - *mPlayerActor->getLife() = life; - } -} - -s32 PlayerInfo::getLifeFromPlayerActor() const { - if (!mPlayerActor) { - return 0; - } - auto* life = mPlayerActor->getLife(); - return life ? *life : 1; -} - -void PlayerInfo::recoverLife() { - setLifeForPlayerActor(getMaxLifeFromPlayerActor()); -} - -void PlayerInfo::setStaminaCurrentMax(f32 max_stamina) { - gdt::setFlag_StaminaCurrentMax(max_stamina); - mStaminaCurrentMax = max_stamina; -} - -f32 PlayerInfo::getStaminaCurrentMax() const { - return mStaminaCurrentMax; -} - -void PlayerInfo::updateStaminaCurrentMaxFromGameData() { - mStaminaCurrentMax = gdt::getFlag_StaminaCurrentMax(); -} - -void PlayerInfo::setStaminaMax(f32 max_stamina) { - gdt::setFlag_StaminaMax(max_stamina); - mStaminaMax = max_stamina; -} - -f32 PlayerInfo::getStaminaMax() const { - return mStaminaMax; -} - -void PlayerInfo::updateStaminaMaxFromGameData() { - mStaminaMax = gdt::getFlag_StaminaMax(); -} - -PlayerBase* PlayerInfo::getPlayerUnchecked() { - return mPlayerActor; -} - -sead::Vector3f& PlayerInfo::getPlayerPos() { - ActorConstDataAccess accessor; - - acquireActor(&mPlayerLink, &accessor); - accessor.debugLog(1, "getPlayerPos"); - return mPlayerPos; -} - -sead::Vector3f& PlayerInfo::getPlayerPosForPostCalc() { - ActorConstDataAccess accessor; - - acquireActor(&mPlayerLink, &accessor); - accessor.debugLog(0, "getPlayerPosForPostCalc"); - return mPlayerPosForPostCalc; -} - -} // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/actPlayerInfo.h b/src/KingSystem/ActorSystem/actPlayerInfo.h deleted file mode 100644 index a47475c9..00000000 --- a/src/KingSystem/ActorSystem/actPlayerInfo.h +++ /dev/null @@ -1,120 +0,0 @@ -#pragma once - -#include <heap/seadDisposer.h> -#include <math/seadVector.h> -#include "KingSystem/ActorSystem/actBaseProcLink.h" -#include "container/seadRingBuffer.h" - -namespace ksys::act { - -class Actor; -class PlayerBase; - -class PlayerInfoBase { -public: - PlayerInfoBase(); - virtual ~PlayerInfoBase(); -}; - -class PlayerInfo : public PlayerInfoBase { - SEAD_SINGLETON_DISPOSER(PlayerInfo) - PlayerInfo(); - ~PlayerInfo() override; - -public: - BaseProcLink& getPlayerLink() { return mPlayerLink; } - bool init(); - void setAndAcquirePlayer(PlayerBase* player); // requires PlayerOrEnemy and PlayerBase - void resetPlayer(PlayerBase* player); - bool acquireHorse(BaseProc* horse); - void setHorseLink(const BaseProcLink& horse_link); - PlayerBase* getPlayer() const; - PlayerBase* getPlayer_() const; // possibly duped by compiler? - Actor* getRiddenHorse() const; // requires PlayerBase vtable - void setMaxLifeForPlayerActor(s32 max_heart); // requires PlayerBase - s32 getMaxLifeFromPlayerActor() const; - void setMaxHeartValue(s32 quarter_hearts); - u32 getMaxHeartValue() const; - void updateMaxHeartValueFromGameData(); - void setLifeForPlayerActor(s32 life); - s32 getLifeFromPlayerActor() const; - void updateCurrentHartFlagFromPlayerActor(); // TODO - void updateLifeAfterGameOver(); // requires a global flag - void - resetLifeToBeforeSwordPull(); // requires HeartDisplayMgr (0x25D6578) and PlayerBase vtable - void saveLifeInfoForSwordPull(); // requires PlayerBase vtable - void recoverLife(); - void setStaminaCurrentMax(f32 max_stamina); - f32 getStaminaCurrentMax() const; - void updateStaminaCurrentMaxFromGameData(); - void setStaminaMax(f32 max_stamina); - f32 getStaminaMax() const; - void updateStaminaMaxFromGameData(); - void setMaxStaminaForPlayerActor(f32 max_stamina); // requires PlayerBase - f32 getMaxStaminaFromPlayerActor() const; // requires PlayerBase - void recoverStamina(); // requires PlayerBase - void recoverCondition(); // requires PlayerBase - - PlayerBase* getPlayerUnchecked(); - - sead::Vector3f& getPlayerPos(); - sead::Vector3f& getPlayerPosForPostCalc(); - - // TODO: name and PlayerBase vtable - sead::Vector3f& getPlayerM265(); - -private: - // These are probably debug stuff that were removed - class Info1 : public PlayerInfoBase { - public: - Info1(); - ~Info1() override; - } mInfo1; - class Info2 : public PlayerInfoBase { - public: - Info2(); - ~Info2() override; - } mInfo2; - class Info3 : public PlayerInfoBase { - public: - Info3(); - ~Info3() override; - } mInfo3; - class Info4 : public PlayerInfoBase { - public: - Info4(); - ~Info4() override; - } mInfo4; - class Info5 : public PlayerInfoBase { - public: - Info5(); - ~Info5() override; - } mInfo5; - class Info6 : public PlayerInfoBase { - public: - Info6(); - ~Info6() override; - } mInfo6; - class Info7 : public PlayerInfoBase { - public: - Info7(); - ~Info7() override; - } mInfo7; - PlayerBase* mPlayerActor = nullptr; - BaseProcLink mPlayerLink; - BaseProcLink mHorseLink; - sead::Vector3f mPlayerPos{0, 0, 0}; - sead::Vector3f mPlayerPosForPostCalc{0, 0, 0}; - f32 mMaxHeartValue = 0; - f32 mStaminaCurrentMax = 1000; // 1000 = 1 wheel - f32 mStaminaMax = 1000; - f32 mLifeBeforeSwordPull = 0; - f32 mExtraLifeBeforeSwordPull = 0; - sead::FixedRingBuffer<sead::Vector3f, 60> mPreviousPositions; - f32 _3a0 = 65535; - f32 _3a4 = 65535; - f32 _3a8 = -1; -}; -KSYS_CHECK_SIZE_NX150(PlayerInfo, 0x3B0); - -} // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/actPlayerInfoBase.cpp b/src/KingSystem/ActorSystem/actPlayerInfoBase.cpp deleted file mode 100644 index dbca9baa..00000000 --- a/src/KingSystem/ActorSystem/actPlayerInfoBase.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "KingSystem/ActorSystem/actPlayerInfo.h" -namespace ksys::act { -// these are separate from actPlayerInfo.cpp so clang doesn't inline/dedupe them -[[gnu::noinline]] PlayerInfoBase::PlayerInfoBase() = default; -[[gnu::noinline]] PlayerInfoBase::~PlayerInfoBase() = default; -} // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/actPlayerInfoStub.cpp b/src/KingSystem/ActorSystem/actPlayerInfoStub.cpp deleted file mode 100644 index 2f9dc100..00000000 --- a/src/KingSystem/ActorSystem/actPlayerInfoStub.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "KingSystem/ActorSystem/actPlayerInfo.h" -namespace ksys::act { -// these are separate from actPlayerInfo.cpp so clang doesn't inline/dedupe them -PlayerInfo::Info1::Info1() = default; -PlayerInfo::Info1::~Info1() = default; -PlayerInfo::Info2::Info2() = default; -PlayerInfo::Info2::~Info2() = default; -PlayerInfo::Info3::Info3() = default; -PlayerInfo::Info3::~Info3() = default; -PlayerInfo::Info4::Info4() = default; -PlayerInfo::Info4::~Info4() = default; -PlayerInfo::Info5::Info5() = default; -PlayerInfo::Info5::~Info5() = default; -PlayerInfo::Info6::Info6() = default; -PlayerInfo::Info6::~Info6() = default; -PlayerInfo::Info7::Info7() = default; -PlayerInfo::Info7::~Info7() = default; - -} // namespace ksys::act |
