summaryrefslogtreecommitdiff
path: root/src/KingSystem/ActorSystem/actPlayerInfo.h
blob: a47475c94bf46b611c687f7e610476f0af7eafb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#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