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)
This commit is contained in:
Léo Lam
2026-09-28 03:39:30 +02:00
parent 34e57daf61
commit d8da4fc5f2
21 changed files with 316 additions and 304 deletions
+9
View File
@@ -1,2 +1,11 @@
add_subdirectory(AI)
add_subdirectory(Action)
target_sources(uking PRIVATE
actPlayerBase.cpp
actPlayerBase.h
actPlayerInfo.cpp
actPlayerInfo.h
actPlayerInfoBase.cpp
actPlayerInfoStub.cpp
)
+1
View File
@@ -0,0 +1 @@
#include "Game/Actor/Player/actPlayerBase.h"
@@ -3,10 +3,10 @@
#include <prim/seadSafeString.h>
#include "KingSystem/ActorSystem/actActor.h"
namespace ksys::act {
namespace uking::act {
// TODO
class PlayerBase : public Actor {
class PlayerBase : public ksys::act::Actor {
public:
// FIXME: name for x and name+type for y
void switchEquipment(const sead::SafeString& slot, int frames, int x = -1,
@@ -16,4 +16,4 @@ public:
void setExtraLife(s32 extra_life, f32 x);
};
} // namespace ksys::act
} // namespace uking::act
@@ -1,5 +1,5 @@
#include "KingSystem/ActorSystem/actPlayerInfo.h"
#include "KingSystem/ActorSystem/Profiles/actPlayerBase.h"
#include "Game/Actor/Player/actPlayerInfo.h"
#include "Game/Actor/Player/actPlayerBase.h"
#include "KingSystem/ActorSystem/actActorConstDataAccess.h"
#include "KingSystem/ActorSystem/actActorLinkConstDataAccess.h"
#include "KingSystem/ActorSystem/actBaseProc.h"
@@ -7,7 +7,7 @@
#include "KingSystem/GameData/gdtCommonFlagsUtils.h"
#include "KingSystem/ksys.h"
namespace ksys::act {
namespace uking::act {
SEAD_SINGLETON_DISPOSER_IMPL(PlayerInfo)
@@ -25,11 +25,11 @@ void PlayerInfo::resetPlayer(PlayerBase* player) {
}
}
bool PlayerInfo::acquireHorse(BaseProc* horse) {
bool PlayerInfo::acquireHorse(ksys::act::BaseProc* horse) {
return mHorseLink.acquire(horse, false);
}
void PlayerInfo::setHorseLink(const BaseProcLink& horse_link) {
void PlayerInfo::setHorseLink(const ksys::act::BaseProcLink& horse_link) {
mHorseLink = horse_link;
}
@@ -37,7 +37,7 @@ PlayerBase* PlayerInfo::getPlayer() const {
if (!mPlayerActor) {
return nullptr;
}
BaseProcMgr::instance()->isAccessingProcSafe(mPlayerActor, nullptr);
ksys::act::BaseProcMgr::instance()->isAccessingProcSafe(mPlayerActor, nullptr);
return mPlayerActor;
}
@@ -45,7 +45,7 @@ PlayerBase* PlayerInfo::getPlayer_() const {
if (!mPlayerActor) {
return nullptr;
}
BaseProcMgr::instance()->isAccessingProcSafe(mPlayerActor, nullptr);
ksys::act::BaseProcMgr::instance()->isAccessingProcSafe(mPlayerActor, nullptr);
return mPlayerActor;
}
@@ -54,7 +54,7 @@ s32 PlayerInfo::getMaxLifeFromPlayerActor() const {
}
void PlayerInfo::setMaxHeartValue(s32 quarter_hearts) {
gdt::setFlag_MaxHartValue(quarter_hearts);
ksys::gdt::setFlag_MaxHartValue(quarter_hearts);
mMaxHeartValue = static_cast<f32>(quarter_hearts);
}
@@ -64,7 +64,7 @@ u32 PlayerInfo::getMaxHeartValue() const {
}
void PlayerInfo::updateMaxHeartValueFromGameData() {
mMaxHeartValue = static_cast<f32>(gdt::getFlag_MaxHartValue());
mMaxHeartValue = static_cast<f32>(ksys::gdt::getFlag_MaxHartValue());
}
void PlayerInfo::setLifeForPlayerActor(s32 life) {
@@ -86,7 +86,7 @@ void PlayerInfo::recoverLife() {
}
void PlayerInfo::setStaminaCurrentMax(f32 max_stamina) {
gdt::setFlag_StaminaCurrentMax(max_stamina);
ksys::gdt::setFlag_StaminaCurrentMax(max_stamina);
mStaminaCurrentMax = max_stamina;
}
@@ -95,11 +95,11 @@ f32 PlayerInfo::getStaminaCurrentMax() const {
}
void PlayerInfo::updateStaminaCurrentMaxFromGameData() {
mStaminaCurrentMax = gdt::getFlag_StaminaCurrentMax();
mStaminaCurrentMax = ksys::gdt::getFlag_StaminaCurrentMax();
}
void PlayerInfo::setStaminaMax(f32 max_stamina) {
gdt::setFlag_StaminaMax(max_stamina);
ksys::gdt::setFlag_StaminaMax(max_stamina);
mStaminaMax = max_stamina;
}
@@ -108,7 +108,7 @@ f32 PlayerInfo::getStaminaMax() const {
}
void PlayerInfo::updateStaminaMaxFromGameData() {
mStaminaMax = gdt::getFlag_StaminaMax();
mStaminaMax = ksys::gdt::getFlag_StaminaMax();
}
PlayerBase* PlayerInfo::getPlayerUnchecked() {
@@ -116,19 +116,19 @@ PlayerBase* PlayerInfo::getPlayerUnchecked() {
}
sead::Vector3f& PlayerInfo::getPlayerPos() {
ActorConstDataAccess accessor;
ksys::act::ActorConstDataAccess accessor;
acquireActor(&mPlayerLink, &accessor);
ksys::act::acquireActor(&mPlayerLink, &accessor);
accessor.debugLog(1, "getPlayerPos");
return mPlayerPos;
}
sead::Vector3f& PlayerInfo::getPlayerPosForPostCalc() {
ActorConstDataAccess accessor;
ksys::act::ActorConstDataAccess accessor;
acquireActor(&mPlayerLink, &accessor);
ksys::act::acquireActor(&mPlayerLink, &accessor);
accessor.debugLog(0, "getPlayerPosForPostCalc");
return mPlayerPosForPostCalc;
}
} // namespace ksys::act
} // namespace uking::act
@@ -6,8 +6,11 @@
#include "container/seadRingBuffer.h"
namespace ksys::act {
class Actor;
}
namespace uking::act {
class PlayerBase;
class PlayerInfoBase {
@@ -22,15 +25,15 @@ class PlayerInfo : public PlayerInfoBase {
~PlayerInfo() override;
public:
BaseProcLink& getPlayerLink() { return mPlayerLink; }
ksys::act::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);
bool acquireHorse(ksys::act::BaseProc* horse);
void setHorseLink(const ksys::act::BaseProcLink& horse_link);
PlayerBase* getPlayer() const;
PlayerBase* getPlayer_() const; // possibly duped by compiler?
Actor* getRiddenHorse() const; // requires PlayerBase vtable
ksys::act::Actor* getRiddenHorse() const; // requires PlayerBase vtable
void setMaxLifeForPlayerActor(s32 max_heart); // requires PlayerBase
s32 getMaxLifeFromPlayerActor() const;
void setMaxHeartValue(s32 quarter_hearts);
@@ -101,8 +104,8 @@ private:
~Info7() override;
} mInfo7;
PlayerBase* mPlayerActor = nullptr;
BaseProcLink mPlayerLink;
BaseProcLink mHorseLink;
ksys::act::BaseProcLink mPlayerLink;
ksys::act::BaseProcLink mHorseLink;
sead::Vector3f mPlayerPos{0, 0, 0};
sead::Vector3f mPlayerPosForPostCalc{0, 0, 0};
f32 mMaxHeartValue = 0;
@@ -117,4 +120,4 @@ private:
};
KSYS_CHECK_SIZE_NX150(PlayerInfo, 0x3B0);
} // namespace ksys::act
} // namespace uking::act
@@ -1,6 +1,6 @@
#include "KingSystem/ActorSystem/actPlayerInfo.h"
namespace ksys::act {
#include "Game/Actor/Player/actPlayerInfo.h"
namespace uking::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
} // namespace uking::act
@@ -1,5 +1,5 @@
#include "KingSystem/ActorSystem/actPlayerInfo.h"
namespace ksys::act {
#include "Game/Actor/Player/actPlayerInfo.h"
namespace uking::act {
// these are separate from actPlayerInfo.cpp so clang doesn't inline/dedupe them
PlayerInfo::Info1::Info1() = default;
PlayerInfo::Info1::~Info1() = default;
@@ -16,4 +16,4 @@ PlayerInfo::Info6::~Info6() = default;
PlayerInfo::Info7::Info7() = default;
PlayerInfo::Info7::~Info7() = default;
} // namespace ksys::act
} // namespace uking::act
@@ -1,6 +1,6 @@
#include "Game/Actor/Query/queryComparePlayerHeart.h"
#include <evfl/Query.h>
#include "KingSystem/ActorSystem/actPlayerInfo.h"
#include "Game/Actor/Player/actPlayerInfo.h"
namespace uking::query {
@@ -9,7 +9,7 @@ ComparePlayerHeart::ComparePlayerHeart(const InitArg& arg) : ksys::act::ai::Quer
ComparePlayerHeart::~ComparePlayerHeart() = default;
int ComparePlayerHeart::doQuery() {
auto* pi = ksys::act::PlayerInfo::instance();
auto* pi = uking::act::PlayerInfo::instance();
if (pi == nullptr)
return 0;
@@ -1,6 +1,6 @@
#include "Game/Actor/Query/queryComparePlayerMaxHeart.h"
#include <evfl/Query.h>
#include "KingSystem/ActorSystem/actPlayerInfo.h"
#include "Game/Actor/Player/actPlayerInfo.h"
namespace uking::query {
@@ -9,7 +9,7 @@ ComparePlayerMaxHeart::ComparePlayerMaxHeart(const InitArg& arg) : ksys::act::ai
ComparePlayerMaxHeart::~ComparePlayerMaxHeart() = default;
int ComparePlayerMaxHeart::doQuery() {
auto* pi = ksys::act::PlayerInfo::instance();
auto* pi = uking::act::PlayerInfo::instance();
if (pi == nullptr)
return 0;
@@ -1,6 +1,6 @@
#include "Game/Actor/Query/queryComparePlayerMaxStamina.h"
#include <evfl/Query.h>
#include "KingSystem/ActorSystem/actPlayerInfo.h"
#include "Game/Actor/Player/actPlayerInfo.h"
namespace uking::query {
@@ -9,7 +9,7 @@ ComparePlayerMaxStamina::ComparePlayerMaxStamina(const InitArg& arg) : ksys::act
ComparePlayerMaxStamina::~ComparePlayerMaxStamina() = default;
int ComparePlayerMaxStamina::doQuery() {
auto* pi = ksys::act::PlayerInfo::instance();
auto* pi = uking::act::PlayerInfo::instance();
if (pi == nullptr)
return 0;
@@ -1,6 +1,6 @@
#include "Game/Actor/Query/queryComparePlayerOriginalHeart.h"
#include <evfl/Query.h>
#include "KingSystem/ActorSystem/actPlayerInfo.h"
#include "Game/Actor/Player/actPlayerInfo.h"
namespace uking::query {
@@ -10,7 +10,7 @@ ComparePlayerOriginalHeart::ComparePlayerOriginalHeart(const InitArg& arg)
ComparePlayerOriginalHeart::~ComparePlayerOriginalHeart() = default;
int ComparePlayerOriginalHeart::doQuery() {
using PlayerInfo = ksys::act::PlayerInfo;
using PlayerInfo = uking::act::PlayerInfo;
if (PlayerInfo::instance() == nullptr)
return 0;
+4 -4
View File
@@ -1,10 +1,11 @@
#include "Game/Actor/actPlayerCreateMgr.h"
#include <prim/seadRuntimeTypeInfo.h>
#include <prim/seadStringBuilder.h>
#include "Game/Actor/Player/actPlayerBase.h"
#include "Game/Actor/Player/actPlayerInfo.h"
#include "Game/Actor/actPlayerCreateUtils.h"
#include "Game/Actor/actWeapon.h"
#include "Game/UI/uiPauseMenuDataMgr.h"
#include "KingSystem/ActorSystem/Profiles/actPlayerBase.h"
#include "KingSystem/ActorSystem/Profiles/actWeaponBase.h"
#include "KingSystem/ActorSystem/actActorConstDataAccess.h"
#include "KingSystem/ActorSystem/actActorCreator.h"
@@ -13,7 +14,6 @@
#include "KingSystem/ActorSystem/actInfoCommon.h"
#include "KingSystem/ActorSystem/actInfoData.h"
#include "KingSystem/ActorSystem/actInstParamPack.h"
#include "KingSystem/ActorSystem/actPlayerInfo.h"
#include "KingSystem/GameData/gdtCommonFlagsUtils.h"
namespace uking::act {
@@ -154,7 +154,7 @@ void CreatePlayerEquipActorMgr::requestCreateWeapon(s32 slot_idx, const sead::Sa
auto scope = mTracer.trace()->makeScope("requestCreateWeapon", caller, 1);
deleteLoadingProc(slot_idx);
auto* player = ksys::act::PlayerInfo::instance()->getPlayer();
auto* player = PlayerInfo::instance()->getPlayer();
sead::Matrix34f pos;
pos.makeT(player->getMtx().getTranslation());
@@ -213,7 +213,7 @@ void CreatePlayerEquipActorMgr::requestCreateArmor(s32 slot_idx, const sead::Saf
{
ksys::act::ActorConstDataAccess access;
ksys::act::acquireActor(&ksys::act::PlayerInfo::instance()->getPlayerLink(), &access);
ksys::act::acquireActor(&PlayerInfo::instance()->getPlayerLink(), &access);
sead::Vector3f pos;
access.getActorMtx().getTranslation(pos);
params->addPosition(pos);
+5 -5
View File
@@ -4,6 +4,8 @@
#include <limits>
#include <math/seadMathCalcCommon.h>
#include <prim/seadScopedLock.h>
#include "Game/Actor/Player/actPlayerBase.h"
#include "Game/Actor/Player/actPlayerInfo.h"
#include "Game/Actor/actPlayerCreateMgr.h"
#include "Game/Actor/actPlayerCreateUtils.h"
#include "Game/Actor/actWeapon.h"
@@ -12,14 +14,12 @@
#include "Game/Scene/gameScene.h"
#include "Game/UI/uiUtils.h"
#include "Game/gameItemUtils.h"
#include "KingSystem/ActorSystem/Profiles/actPlayerBase.h"
#include "KingSystem/ActorSystem/actActorConstDataAccess.h"
#include "KingSystem/ActorSystem/actActorHeapUtil.h"
#include "KingSystem/ActorSystem/actActorUtil.h"
#include "KingSystem/ActorSystem/actBaseProcLink.h"
#include "KingSystem/ActorSystem/actInfoCommon.h"
#include "KingSystem/ActorSystem/actInfoData.h"
#include "KingSystem/ActorSystem/actPlayerInfo.h"
#include "KingSystem/GameData/gdtCommonFlagsUtils.h"
#include "KingSystem/GameData/gdtManager.h"
#include "KingSystem/GameData/gdtSpecialFlagNames.h"
@@ -315,7 +315,7 @@ void PauseMenuDataMgr::initForNewSave() {
mCanSeeHealthBar = false;
mEquippedWeapons.fill({});
auto* player = ksys::act::PlayerInfo::instance()->getPlayer();
auto* player = uking::act::PlayerInfo::instance()->getPlayer();
if (player) {
player->switchEquipment(getDefaultEquipment(EquipmentSlot::WeaponRight), 1);
player->switchEquipment(getDefaultEquipment(EquipmentSlot::WeaponLeft), 1);
@@ -1357,7 +1357,7 @@ void PauseMenuDataMgr::removeItem(const sead::SafeString& name) {
void PauseMenuDataMgr::removeWeaponIfEquipped(const sead::SafeString& name) {
const auto lock = sead::makeScopedLock(mCritSection);
if (!ksys::act::PlayerInfo::instance()->getPlayer())
if (!uking::act::PlayerInfo::instance()->getPlayer())
return;
const auto& items = getItems();
@@ -1502,7 +1502,7 @@ void PauseMenuDataMgr::createPlayerEquipment() {
}
}
auto* player = ksys::act::PlayerInfo::instance()->getPlayer();
auto* player = uking::act::PlayerInfo::instance()->getPlayer();
s32 slot = 0; // <- this is required to match
for (u64 i = 0; i != equipment_items.size(); slot = s32(++i)) {
@@ -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
@@ -1 +0,0 @@
#include "KingSystem/ActorSystem/Profiles/actPlayerBase.h"
+1
View File
@@ -16,6 +16,7 @@ target_sources(uking PRIVATE
DebugFinder.cpp
DebugFinder.h
DebugMessage.h
GameConfig.h
HavokWorkerMgr.cpp
HavokWorkerMgr.h
Hio.cpp
@@ -2,6 +2,8 @@
#include <prim/seadSafeString.h>
namespace ksys {
class GameConfig {
public:
static GameConfig* getInstance() { return sInstancePtr; }
@@ -15,3 +17,5 @@ public:
private:
static GameConfig* sInstancePtr;
};
} // namespace ksys
+1 -1
View File
@@ -1,6 +1,6 @@
#include "KingSystem/System/Patrol.h"
#include <devenv/seadEnvUtil.h>
#include "KingSystem/Framework/GameConfig.h"
#include "KingSystem/System/GameConfig.h"
namespace ksys {
+1 -1
View File
@@ -4,13 +4,13 @@
#include <heap/seadExpHeap.h>
#include <prim/seadSafeString.h>
#include "Game/DLC/aocManager.h"
#include "KingSystem/Framework/GameConfig.h"
#include "KingSystem/Resource/resEntryFactory.h"
#include "KingSystem/Resource/resHandle.h"
#include "KingSystem/Resource/resLoadRequest.h"
#include "KingSystem/Resource/resResourceArchive.h"
#include "KingSystem/Resource/resResourceMgrTask.h"
#include "KingSystem/Resource/resSystem.h"
#include "KingSystem/System/GameConfig.h"
#include "KingSystem/System/OverlayArena.h"
#include "KingSystem/Utils/Types.h"