From b9b56f4e9ff85f2f1df0d6a3520568ab2c70c510 Mon Sep 17 00:00:00 2001 From: Aetias Date: Sat, 30 Mar 2024 12:10:44 +0100 Subject: [PATCH] Add `PlayerBase.cpp` --- include/Player/PlayerBase.hpp | 50 ++++++++++++++++++++++++++++--- include/Player/PlayerLinkBase.hpp | 35 ++++++++++++++++++++-- include/Render/FadeControl.hpp | 3 ++ src/00_Core/Player/PlayerBase.cpp | 24 +++++++++++++++ 4 files changed, 106 insertions(+), 6 deletions(-) create mode 100644 include/Render/FadeControl.hpp create mode 100644 src/00_Core/Player/PlayerBase.cpp diff --git a/include/Player/PlayerBase.hpp b/include/Player/PlayerBase.hpp index 4e13b2c2..53daf578 100644 --- a/include/Player/PlayerBase.hpp +++ b/include/Player/PlayerBase.hpp @@ -3,17 +3,59 @@ #include "global.h" #include "types.h" +#include "Item/Item.hpp" +#include "Player/EquipSword.hpp" +#include "Player/EquipShield.hpp" + +#include "Physics/Cylinder.hpp" +#include "Render/FadeControl.hpp" #include "System/SysNew.hpp" class PlayerBase : public SysObject { +public: /* 00 (vtable) */ - /* 04 */ void *mUnk_04; - /* 08 */ s16 mUnk_08; + /* 04 */ FadeControl *mFadeControl; + /* 08 */ s16 mInvincibleFrames; /* 0a */ s16 mHealth; /* 0c */ unk8 mUnk_0c[2]; - /* 0e */ unk16 mUnk_0e; + /* 0e */ s16 mEntranceId; /* 10 */ bool mUpdatePos; /* 11 */ bool mVisible; - /* 12 */ bool mUnk_12; + /* 12 */ bool mInvincible; /* 13 */ + + /* 00 */ virtual s32 GetMaxHealth() = 0; + /* 04 */ virtual bool vfunc_04(); + /* 08 */ virtual ItemFlag GetEquipId(); + /* 0c */ virtual bool CanMove(); + /* 10 */ virtual void vfunc_10(Cylinder *param1) = 0; + /* 14 */ virtual void vfunc_14(Cylinder *param1) = 0; + /* 18 */ virtual void vfunc_18() = 0; + /* 1c */ virtual void Init() = 0; + /* 20 */ virtual void vfunc_20() = 0; + /* 24 */ virtual void vfunc_24() = 0; + /* 28 */ virtual void vfunc_28(s32 param1) = 0; + /* 2c */ virtual void vfunc_2c(s32 param1, unk8 param2) = 0; + /* 30 */ virtual void vfunc_30() = 0; + /* 34 */ virtual bool Teleport(Vec3p *pos, s16 angle, unk32 param3, bool param4, bool param5); + /* 38 */ virtual bool TeleportToEntrance(unk32 entranceId, bool param2); + /* 3c */ virtual bool TeleportToLastEntrance(bool param1); + /* 40 */ virtual void AddHealth(s16 amount); + /* 44 */ virtual void vfunc_44() = 0; + /* 48 */ virtual void vfunc_48() = 0; + /* 4c */ virtual void vfunc_4c() = 0; + /* 50 */ virtual ~PlayerBase(); + /* 58 */ + + void SetUpdatePos(bool updatePos); + void SetVisible(bool visible); + EquipSword* GetEquipSword(); + EquipShield* GetEquipShield(); + void LookAt(Vec3p *target); + bool func_ov00_020a7c00(s32 param1); + bool func_ov00_020a7c1c(Cylinder *cylinder); + bool func_ov00_020a7c60(Vec3p *param1, Vec3p *param2, s32 param3); + void EquipItem_vfunc_3c(Cylinder *cylinder, ItemFlag equipId); + void EquipItem_vfunc_2c(); + void SetHealth(s16 health); }; diff --git a/include/Player/PlayerLinkBase.hpp b/include/Player/PlayerLinkBase.hpp index d70423dd..631343fb 100644 --- a/include/Player/PlayerLinkBase.hpp +++ b/include/Player/PlayerLinkBase.hpp @@ -15,17 +15,18 @@ typedef s32 PlayerCharacter; enum PlayerCharacter_ { PlayerCharacter_Link = 0, PlayerCharacter_Gongoron = 1, + PlayerCharacter_COUNT = 2, }; class PlayerLinkBase: public PlayerBase { /* 00 (base) */ /* 14 */ Vec3p mPos; /* 20 */ Vec3p mVel; - /* 2c */ unk8 mTilePos[2][2]; + /* 2c */ unk8 mTilePos[2][PlayerCharacter_COUNT]; /* 30 */ unk32 mAltitude; /* 34 */ unk8 mUnk_34[4]; /* 38 */ s32 mUnk_38; - /* 3c */ ActorRef mUnkRef_03c; + /* 3c */ ActorRef mGrabActor; /* 44 */ s32 mUnk_44; /* 48 */ unk16 mUnk_48; /* 4a */ unk16 mUnk_4a; @@ -42,4 +43,34 @@ class PlayerLinkBase: public PlayerBase { /* 68 */ DebugHierarchy *mDebugHierarchy_1; /* 6c */ DebugHierarchy *mDebugHierarchy_2; /* 70 */ + + /* 00 */ s32 GetMaxHealth() override; + /* 08 */ ItemFlag GetEquipId() override; + /* 0c */ bool CanMove() override; + /* 10 */ void vfunc_10(Cylinder *param1) override; + /* 14 */ void vfunc_14(Cylinder *param1) override; + /* 18 */ void vfunc_18(s32 param1) override; + /* 1c */ void Init() override; + /* 20 */ void vfunc_20() override; + /* 24 */ void vfunc_24() override; + /* 28 */ void vfunc_28(s32 param1) override; + /* 2c */ void vfunc_2c(s32 param1, unk8 param2) override; + /* 30 */ void vfunc_30(s32 param1, Vec3p *param2, s32 param3) override; + /* 34 */ bool Teleport(Vec3p *pos, s16 angle, unk32 param3, bool param4, bool param5) override; + /* 38 */ bool TeleportToEntrance(unk32 entranceId, bool param2) override; + /* 3c */ bool TeleportToLastEntrance(bool param1) override; + /* 50 */ ~PlayerLinkBase() override; + /* 58 */ virtual bool vfunc_58(); + /* 5c */ virtual bool vfunc_5c(); + /* 60 */ virtual bool vfunc_60(); + /* 64 */ virtual void vfunc_64(); + /* 68 */ virtual void vfunc_68(); + /* 6c */ virtual void vfunc_6c(); + /* 70 */ virtual void vfunc_70(s32 param1, Vec3p *param2, unk32 param3); + /* 74 */ virtual void vfunc_74(); + /* 78 */ virtual bool vfunc_78(); + /* 7c */ virtual void vfunc_7c(); + /* 80 */ virtual void SetUnk_5e(); + /* 84 */ virtual void ResetUnk_5e(); + /* 88 */ }; diff --git a/include/Render/FadeControl.hpp b/include/Render/FadeControl.hpp new file mode 100644 index 00000000..805cbcb7 --- /dev/null +++ b/include/Render/FadeControl.hpp @@ -0,0 +1,3 @@ +#pragma once + +struct FadeControl; diff --git a/src/00_Core/Player/PlayerBase.cpp b/src/00_Core/Player/PlayerBase.cpp new file mode 100644 index 00000000..24619493 --- /dev/null +++ b/src/00_Core/Player/PlayerBase.cpp @@ -0,0 +1,24 @@ +#include "Player/PlayerLinkBase.hpp" + +#ifdef STUBS + +bool PlayerBase::vfunc_04() {} +ItemFlag PlayerBase::GetEquipId() {} +bool PlayerBase::CanMove() {} +void PlayerBase::SetUpdatePos(bool updatePos) {} +void PlayerBase::SetVisible(bool visible) {} +EquipSword* PlayerBase::GetEquipSword() {} +EquipShield* PlayerBase::GetEquipShield() {} +void PlayerBase::LookAt(Vec3p *target) {} +bool PlayerBase::func_ov00_020a7c00(s32 param1) {} +bool PlayerBase::func_ov00_020a7c1c(Cylinder *cylinder) {} +bool PlayerBase::func_ov00_020a7c60(Vec3p *param1, Vec3p *param2, s32 param3) {} +void PlayerBase::EquipItem_vfunc_3c(Cylinder *cylinder, ItemFlag equipId) {} +void PlayerBase::EquipItem_vfunc_2c() {} +void PlayerBase::SetHealth(s16 health) {} +void PlayerBase::AddHealth(s16 amount) {} +bool PlayerBase::Teleport(Vec3p *pos, s16 angle, unk32 param3, bool param4, bool param5) {} +bool PlayerBase::TeleportToEntrance(unk32 entranceId, bool param2) {} +bool PlayerBase::TeleportToLastEntrance(bool param1) {} + +#endif