diff --git a/data/data_symbols.csv b/data/data_symbols.csv index 610d12488..be8e2a863 100644 --- a/data/data_symbols.csv +++ b/data/data_symbols.csv @@ -26,6 +26,7 @@ 0x00000071024D8D58,_ZTVN4ksys3act2ai10ActionBaseE 0x00000071025129E0,_ZTVN4ksys3act2ai6ActionE 0x0000007102513268,_ZTVN4ksys3act2ai2AiE +0x00000071025CDB60,_ZN4ksys3act10PlayerInfo9sInstanceE 0x00000071025F75B0,pfnc_nvnDeviceBuilderSetDefaults 0x00000071025F75B8,pfnc_nvnDeviceBuilderSetFlags 0x00000071025F75C0,pfnc_nvnDeviceInitialize diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 2ad868dad..63390331f 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -51629,7 +51629,7 @@ Address,Quality,Size,Name 0x000000710084b62c,U,000084,Player::setItemVel 0x000000710084b680,U,000084,Player::setItemSwimVel 0x000000710084b6d4,U,000084, -0x000000710084b728,U,000080,Player::addExtraLife +0x000000710084b728,U,000080,Player::setExtraLife 0x000000710084b778,U,000072,Player::addExtraStamina 0x000000710084b7c0,U,000080, 0x000000710084b810,U,000080, @@ -52122,32 +52122,32 @@ Address,Quality,Size,Name 0x00000071008525f8,U,000092, 0x0000007100852654,U,000072, 0x000000710085269c,U,000372, -0x0000007100852810,U,000048,PlayerInfo::S1::ctor -0x0000007100852840,U,000004,j_nullsub_2594 -0x0000007100852844,U,000036, -0x0000007100852868,U,000020,PlayerInfo::S0::ctor -0x000000710085287c,U,000004,nullsub_2594 -0x0000007100852880,U,000004,j__ZdlPv_369 -0x0000007100852884,U,000048,PlayerInfo::S2::ctor -0x00000071008528b4,U,000004,j_nullsub_2594_0 -0x00000071008528b8,U,000036, +0x0000007100852810,O,000048,_ZN4ksys3act10PlayerInfo5Info1C1Ev +0x0000007100852840,O,000004,_ZN4ksys3act10PlayerInfo5Info1D2Ev +0x0000007100852844,O,000036,_ZN4ksys3act10PlayerInfo5Info1D0Ev +0x0000007100852868,O,000020,_ZN4ksys3act14PlayerInfoBaseC1Ev +0x000000710085287c,O,000004,_ZN4ksys3act14PlayerInfoBaseD2Ev +0x0000007100852880,O,000004,_ZN4ksys3act14PlayerInfoBaseD0Ev +0x0000007100852884,O,000048,_ZN4ksys3act10PlayerInfo5Info2C1Ev +0x00000071008528b4,O,000004,_ZN4ksys3act10PlayerInfo5Info2D2Ev +0x00000071008528b8,O,000036,_ZN4ksys3act10PlayerInfo5Info2D0Ev 0x00000071008528dc,U,000004,nullsub_2595 -0x00000071008528e0,U,000048,PlayerInfo::S3::ctor -0x0000007100852910,U,000004,j_nullsub_2594_1 -0x0000007100852914,U,000036, -0x0000007100852938,U,000048,PlayerInfo::S4::ctor -0x0000007100852968,U,000004,j_nullsub_2594_2 -0x000000710085296c,U,000036, -0x0000007100852990,U,000048,PlayerInfo::S5::ctor -0x00000071008529c0,U,000004,j_nullsub_2594_3 -0x00000071008529c4,U,000036, +0x00000071008528e0,O,000048,_ZN4ksys3act10PlayerInfo5Info3C1Ev +0x0000007100852910,O,000004,_ZN4ksys3act10PlayerInfo5Info3D2Ev +0x0000007100852914,O,000036,_ZN4ksys3act10PlayerInfo5Info3D0Ev +0x0000007100852938,O,000048,_ZN4ksys3act10PlayerInfo5Info4C1Ev +0x0000007100852968,O,000004,_ZN4ksys3act10PlayerInfo5Info4D2Ev +0x000000710085296c,O,000036,_ZN4ksys3act10PlayerInfo5Info4D0Ev +0x0000007100852990,O,000048,_ZN4ksys3act10PlayerInfo5Info5C1Ev +0x00000071008529c0,O,000004,_ZN4ksys3act10PlayerInfo5Info5D2Ev +0x00000071008529c4,O,000036,_ZN4ksys3act10PlayerInfo5Info5D0Ev 0x00000071008529e8,U,000008,return1_0 -0x00000071008529f0,U,000048,PlayerInfo::S6::ctor -0x0000007100852a20,U,000004,j_nullsub_2594_4 -0x0000007100852a24,U,000036, -0x0000007100852a48,U,000048,PlayerInfo::S7::ctor -0x0000007100852a78,U,000004,j_nullsub_2594_5 -0x0000007100852a7c,U,000036, +0x00000071008529f0,O,000048,_ZN4ksys3act10PlayerInfo5Info6C1Ev +0x0000007100852a20,O,000004,_ZN4ksys3act10PlayerInfo5Info6D2Ev +0x0000007100852a24,O,000036,_ZN4ksys3act10PlayerInfo5Info6D0Ev +0x0000007100852a48,O,000048,_ZN4ksys3act10PlayerInfo5Info7C1Ev +0x0000007100852a78,O,000004,_ZN4ksys3act10PlayerInfo5Info7D2Ev +0x0000007100852a7c,O,000036,_ZN4ksys3act10PlayerInfo5Info7D0Ev 0x0000007100852aa0,U,000240,Player::RideInfo::ctor 0x0000007100852b90,U,000152,Player::RideInfo::init 0x0000007100852c28,U,000044,Player::RideInfo::x_0 @@ -52164,46 +52164,46 @@ Address,Quality,Size,Name 0x0000007100854028,U,000036, 0x000000710085404c,U,000288, 0x000000710085416c,U,000092, -0x00000071008541c8,U,000100, -0x000000710085422c,U,000108, -0x0000007100854298,U,000136,PlayerInfo::createInstance -0x0000007100854320,U,000192,PlayerInfo::ctor -0x00000071008543e0,U,000124,PlayerInfo::dtor -0x000000710085445c,U,000132,PlayerInfo::dtorDelete -0x00000071008544e0,U,000008,PlayerInfo::init +0x00000071008541c8,O,000100,_ZN4ksys3act10PlayerInfo18SingletonDisposer_D1Ev +0x000000710085422c,O,000108,_ZN4ksys3act10PlayerInfo18SingletonDisposer_D0Ev +0x0000007100854298,O,000136,_ZN4ksys3act10PlayerInfo14createInstanceEPN4sead4HeapE +0x0000007100854320,O,000192,_ZN4ksys3act10PlayerInfoC1Ev +0x00000071008543e0,O,000124,_ZN4ksys3act10PlayerInfoD1Ev +0x000000710085445c,O,000132,_ZN4ksys3act10PlayerInfoD0Ev +0x00000071008544e0,O,000008,_ZN4ksys3act10PlayerInfo4initEv 0x00000071008544e8,U,000084,PlayerInfo::setPlayerActor -0x000000710085453c,U,000028,PlayerInfo::resetActor -0x0000007100854558,U,000012, -0x0000007100854564,U,000008,PlayerInfo::__auto2 -0x000000710085456c,U,000068,PlayerInfo::getActor -0x00000071008545b0,U,000068,PlayerInfo::getActor_0 +0x000000710085453c,O,000028,_ZN4ksys3act10PlayerInfo11resetPlayerEPNS0_10PlayerBaseE +0x0000007100854558,O,000012,_ZN4ksys3act10PlayerInfo12acquireHorseEPNS0_8BaseProcE +0x0000007100854564,O,000008,_ZN4ksys3act10PlayerInfo12setHorseLinkERKNS0_12BaseProcLinkE +0x000000710085456c,O,000068,_ZNK4ksys3act10PlayerInfo9getPlayerEv +0x00000071008545b0,O,000068,_ZNK4ksys3act10PlayerInfo10getPlayer_Ev 0x00000071008545f4,U,000212,PlayerInfo::getRiddenHorse -0x00000071008546c8,U,000016,PlayerInfo::setPlayerActorMaxHeartValue -0x00000071008546d8,U,000024,PlayerInfo::getMaxLife -0x00000071008546f0,U,000052,PlayerInfo::setMaxHeartValue -0x0000007100854724,U,000012,PlayerInfo::getMaxHeartValue -0x0000007100854730,U,000044,PlayerInfo::updateMaxHeartValue -0x000000710085475c,U,000052,PlayerInfo::setLife -0x0000007100854790,U,000052,PlayerInfo::getLife -0x00000071008547c4,U,000164,PlayerInfo::updateCurrentHartFlagFromPlayer +0x00000071008546c8,U,000016,PlayerInfo::setMaxLifeForPlayerActor +0x00000071008546d8,O,000024,_ZNK4ksys3act10PlayerInfo25getMaxLifeFromPlayerActorEv +0x00000071008546f0,O,000052,_ZN4ksys3act10PlayerInfo16setMaxHeartValueEi +0x0000007100854724,O,000012,_ZNK4ksys3act10PlayerInfo16getMaxHeartValueEv +0x0000007100854730,O,000044,_ZN4ksys3act10PlayerInfo31updateMaxHeartValueFromGameDataEv +0x000000710085475c,O,000052,_ZN4ksys3act10PlayerInfo21setLifeForPlayerActorEi +0x0000007100854790,O,000052,_ZNK4ksys3act10PlayerInfo22getLifeFromPlayerActorEv +0x00000071008547c4,U,000164,PlayerInfo::updateCurrentHartFlagFromPlayerActor 0x0000007100854868,U,000100,PlayerInfo::updateLifeAfterGameOver -0x00000071008548cc,U,000168,PlayerInfo::resetPlayerPullSwordStartLife -0x0000007100854974,U,000096,PlayerInfo::saveLifeInfoForPlayerPullSword -0x00000071008549d4,U,000076, -0x0000007100854a20,U,000052,PlayerInfo::setStamina -0x0000007100854a54,U,000008,PlayerInfo::getStaminaCurrentMax_0 -0x0000007100854a5c,U,000040,PlayerInfo::updateStaminaCurrentMax -0x0000007100854a84,U,000052,PlayerInfo::setStaminaMax -0x0000007100854ab8,U,000008,PlayerInfo::getStaminaMax -0x0000007100854ac0,U,000040,PlayerInfo::updateStaminaMax -0x0000007100854ae8,U,000016,PlayerInfo::x_1 -0x0000007100854af8,U,000024,PlayerInfo::getMaxStamina -0x0000007100854b10,U,000072,PlayerInfo::recoverEnergy -0x0000007100854b58,U,000072,PlayerInfo::recoverPlayerCondition -0x0000007100854ba0,U,000008,PlayerInfo::getActorWithoutAnyChecks -0x0000007100854ba8,U,000120,PlayerInfo::getPlayerPos -0x0000007100854c20,U,000120,PlayerInfo::getPlayerPosForPostCalc -0x0000007100854c98,U,000048, +0x00000071008548cc,U,000168,PlayerInfo::resetLifeToBeforeSwordPull +0x0000007100854974,U,000096,PlayerInfo::saveLifeInfoForSwordPull +0x00000071008549d4,O,000076,_ZN4ksys3act10PlayerInfo11recoverLifeEv +0x0000007100854a20,O,000052,_ZN4ksys3act10PlayerInfo20setStaminaCurrentMaxEf +0x0000007100854a54,O,000008,_ZNK4ksys3act10PlayerInfo20getStaminaCurrentMaxEv +0x0000007100854a5c,O,000040,_ZN4ksys3act10PlayerInfo35updateStaminaCurrentMaxFromGameDataEv +0x0000007100854a84,O,000052,_ZN4ksys3act10PlayerInfo13setStaminaMaxEf +0x0000007100854ab8,O,000008,_ZNK4ksys3act10PlayerInfo13getStaminaMaxEv +0x0000007100854ac0,O,000040,_ZN4ksys3act10PlayerInfo28updateStaminaMaxFromGameDataEv +0x0000007100854ae8,U,000016,PlayerInfo::setStaminaMax +0x0000007100854af8,U,000024,PlayerInfo::getStaminaMax +0x0000007100854b10,U,000072,PlayerInfo::recoverStamina +0x0000007100854b58,U,000072,PlayerInfo::recoverCondition +0x0000007100854ba0,O,000008,_ZN4ksys3act10PlayerInfo18getPlayerUncheckedEv +0x0000007100854ba8,O,000120,_ZN4ksys3act10PlayerInfo12getPlayerPosEv +0x0000007100854c20,O,000120,_ZN4ksys3act10PlayerInfo23getPlayerPosForPostCalcEv +0x0000007100854c98,U,000048,PlayerInfo::getPlayerM265 0x0000007100854cc8,U,001052,Player::x_43 0x00000071008550e4,U,000280, 0x00000071008551fc,U,000292,Player::x_25 diff --git a/src/Game/AI/Query/queryComparePlayerHeart.cpp b/src/Game/AI/Query/queryComparePlayerHeart.cpp index b7742ad6c..deed74e08 100644 --- a/src/Game/AI/Query/queryComparePlayerHeart.cpp +++ b/src/Game/AI/Query/queryComparePlayerHeart.cpp @@ -13,7 +13,7 @@ int ComparePlayerHeart::doQuery() { if (pi == nullptr) return 0; - return pi->getLife() >= *mThreshold; + return pi->getLifeFromPlayerActor() >= *mThreshold; } void ComparePlayerHeart::loadParams(const evfl::QueryArg& arg) { diff --git a/src/Game/AI/Query/queryComparePlayerMaxHeart.cpp b/src/Game/AI/Query/queryComparePlayerMaxHeart.cpp index 4482a6f70..3c0dade0f 100644 --- a/src/Game/AI/Query/queryComparePlayerMaxHeart.cpp +++ b/src/Game/AI/Query/queryComparePlayerMaxHeart.cpp @@ -13,7 +13,7 @@ int ComparePlayerMaxHeart::doQuery() { if (pi == nullptr) return 0; - s32 full_hearts = pi->getMaxHearts() / 4; + s32 full_hearts = pi->getMaxHeartValue() / 4; return full_hearts >= *mThreshold; } diff --git a/src/Game/AI/Query/queryComparePlayerMaxStamina.cpp b/src/Game/AI/Query/queryComparePlayerMaxStamina.cpp index fa2c8c54d..82a15bdd9 100644 --- a/src/Game/AI/Query/queryComparePlayerMaxStamina.cpp +++ b/src/Game/AI/Query/queryComparePlayerMaxStamina.cpp @@ -13,7 +13,7 @@ int ComparePlayerMaxStamina::doQuery() { if (pi == nullptr) return 0; - s32 stamina = pi->getMaxStamina(); + s32 stamina = pi->getStaminaMax(); if (stamina % 200 <= 0) return stamina / 200 >= *mThreshold; else diff --git a/src/Game/AI/Query/queryComparePlayerOriginalHeart.cpp b/src/Game/AI/Query/queryComparePlayerOriginalHeart.cpp index a107699a0..1b9d7a75f 100644 --- a/src/Game/AI/Query/queryComparePlayerOriginalHeart.cpp +++ b/src/Game/AI/Query/queryComparePlayerOriginalHeart.cpp @@ -15,8 +15,8 @@ int ComparePlayerOriginalHeart::doQuery() { if (PlayerInfo::instance() == nullptr) return 0; - s32 life = PlayerInfo::instance()->getLife(); - s32 hearts = PlayerInfo::instance()->getMaxHearts(); + s32 life = PlayerInfo::instance()->getLifeFromPlayerActor(); + s32 hearts = PlayerInfo::instance()->getMaxHeartValue(); s32 compare; if (life <= hearts) compare = life; diff --git a/src/KingSystem/ActorSystem/CMakeLists.txt b/src/KingSystem/ActorSystem/CMakeLists.txt index 307975d0f..2c4514ea0 100644 --- a/src/KingSystem/ActorSystem/CMakeLists.txt +++ b/src/KingSystem/ActorSystem/CMakeLists.txt @@ -118,6 +118,8 @@ target_sources(uking PRIVATE actPhysicsUserTag.h actPlayerInfo.cpp actPlayerInfo.h + actPlayerInfoBase.cpp + actPlayerInfoStub.cpp actTag.h actionDummyAction.cpp diff --git a/src/KingSystem/ActorSystem/Profiles/actPlayerBase.h b/src/KingSystem/ActorSystem/Profiles/actPlayerBase.h index 47c9cacea..4b6e6ec74 100644 --- a/src/KingSystem/ActorSystem/Profiles/actPlayerBase.h +++ b/src/KingSystem/ActorSystem/Profiles/actPlayerBase.h @@ -1,15 +1,19 @@ #pragma once #include +#include "KingSystem/ActorSystem/actActor.h" namespace ksys::act { // TODO -class PlayerBase { +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 index fca8b6589..5b5b9ca1f 100644 --- a/src/KingSystem/ActorSystem/actPlayerInfo.cpp +++ b/src/KingSystem/ActorSystem/actPlayerInfo.cpp @@ -1 +1,134 @@ #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(quarter_hearts); +} + +u32 PlayerInfo::getMaxHeartValue() const { + // Return type is unsigned, but the conversion is signed + return static_cast(mMaxHeartValue); +} + +void PlayerInfo::updateMaxHeartValueFromGameData() { + mMaxHeartValue = static_cast(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 index c356c3f9d..317b126bd 100644 --- a/src/KingSystem/ActorSystem/actPlayerInfo.h +++ b/src/KingSystem/ActorSystem/actPlayerInfo.h @@ -1,22 +1,119 @@ #pragma once #include +#include +#include "KingSystem/ActorSystem/actBaseProcLink.h" +#include "container/seadRingBuffer.h" namespace ksys::act { +class Actor; class PlayerBase; -// TODO -class PlayerInfo { +class PlayerInfoBase { +public: + PlayerInfoBase(); + virtual ~PlayerInfoBase(); +}; + +class PlayerInfo : public PlayerInfoBase { SEAD_SINGLETON_DISPOSER(PlayerInfo) PlayerInfo(); - virtual ~PlayerInfo(); + ~PlayerInfo() override; public: + 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; - s32 getLife() const; - u32 getMaxHearts() const; - f32 getMaxStamina() 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 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 new file mode 100644 index 000000000..dbca9baa7 --- /dev/null +++ b/src/KingSystem/ActorSystem/actPlayerInfoBase.cpp @@ -0,0 +1,6 @@ +#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 new file mode 100644 index 000000000..2f9dc1002 --- /dev/null +++ b/src/KingSystem/ActorSystem/actPlayerInfoStub.cpp @@ -0,0 +1,19 @@ +#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 diff --git a/src/KingSystem/ksys.h b/src/KingSystem/ksys.h index 46c17c824..5d78f4c4e 100644 --- a/src/KingSystem/ksys.h +++ b/src/KingSystem/ksys.h @@ -5,6 +5,9 @@ class Heap; } namespace ksys { +namespace act { +class PlayerLink; +} struct InitParams { sead::Heap* king_sys_heap; @@ -20,4 +23,7 @@ void initBaseProcMgr(sead::Heap* heap); // 0x0000007100f3a8d8 void preInitializeApp(const InitParams& params); +// 0x0000007100f40370 +void setPlayerLink(act::PlayerLink* link); + } // namespace ksys