mirror of
https://github.com/PrimeDecomp/prime.git
synced 2025-12-14 04:06:07 +00:00
Add CPlayerState (#5)
* Start CPlayerState
* CPlayerState::CalculateHealth symbol rename
* Add inline constructor for CHealthInfo
* Add skeleton for the rest of CPlayerState
* Match CPlayerState::DecrPickUp
* Match more methods in CPlayerState
* Run formatting
* Fix function order
* Improving the constants
Former-commit-id: 1e30daa096
This commit is contained in:
committed by
GitHub
parent
ba75752e14
commit
bb86f3dc01
@@ -1,12 +1,66 @@
|
||||
#ifndef _CPLAYERSTATE_HPP
|
||||
#define _CPLAYERSTATE_HPP
|
||||
|
||||
#include "Kyoto/IObjectStore.hpp"
|
||||
#include "MetroidPrime/CHealthInfo.hpp"
|
||||
#include "MetroidPrime/Player/CStaticInterference.hpp"
|
||||
#include "rstl/pair.hpp"
|
||||
#include "rstl/reserved_vector.hpp"
|
||||
#include "rstl/vector.hpp"
|
||||
#include "types.h"
|
||||
|
||||
class CStateManager;
|
||||
|
||||
class CPlayerState {
|
||||
public:
|
||||
enum EItemType {
|
||||
kIT_Invalid = -1,
|
||||
kIT_PowerBeam = 0,
|
||||
kIT_IceBeam = 1,
|
||||
kIT_WaveBeam = 2,
|
||||
kIT_PlasmaBeam = 3,
|
||||
kIT_Missiles = 4,
|
||||
kIT_ScanVisor = 5,
|
||||
kIT_MorphBallBombs = 6,
|
||||
kIT_PowerBombs = 7,
|
||||
kIT_Flamethrower = 8,
|
||||
kIT_ThermalVisor = 9,
|
||||
kIT_ChargeBeam = 10,
|
||||
kIT_SuperMissile = 11,
|
||||
kIT_GrappleBeam = 12,
|
||||
kIT_XRayVisor = 13,
|
||||
kIT_IceSpreader = 14,
|
||||
kIT_SpaceJumpBoots = 15,
|
||||
kIT_MorphBall = 16,
|
||||
kIT_CombatVisor = 17,
|
||||
kIT_BoostBall = 18,
|
||||
kIT_SpiderBall = 19,
|
||||
kIT_PowerSuit = 20,
|
||||
kIT_GravitySuit = 21,
|
||||
kIT_VariaSuit = 22,
|
||||
kIT_PhazonSuit = 23,
|
||||
kIT_EnergyTanks = 24,
|
||||
kIT_UnknownItem1 = 25,
|
||||
kIT_HealthRefill = 26,
|
||||
kIT_UnknownItem2 = 27,
|
||||
kIT_Wavebuster = 28,
|
||||
kIT_Truth = 29,
|
||||
kIT_Strength = 30,
|
||||
kIT_Elder = 31,
|
||||
kIT_Wild = 32,
|
||||
kIT_Lifegiver = 33,
|
||||
kIT_Warrior = 34,
|
||||
kIT_Chozo = 35,
|
||||
kIT_Nature = 36,
|
||||
kIT_Sun = 37,
|
||||
kIT_World = 38,
|
||||
kIT_Spirit = 39,
|
||||
kIT_Newborn = 40,
|
||||
|
||||
/* This must remain at the end of the list */
|
||||
kIT_Max
|
||||
};
|
||||
|
||||
enum EPlayerVisor {
|
||||
kPV_Combat,
|
||||
kPV_XRay,
|
||||
@@ -34,12 +88,91 @@ public:
|
||||
kBI_Phazon2 = 27,
|
||||
};
|
||||
|
||||
EPlayerVisor GetActiveVisor(const CStateManager& mgr) const;
|
||||
CPlayerState();
|
||||
explicit CPlayerState(CInputStream& stream);
|
||||
void PutTo(COutputStream& stream);
|
||||
|
||||
u32 GetMissileCostForAltAttack() const;
|
||||
float GetComboFireAmmoPeriod() const;
|
||||
static float GetMissileComboChargeFactor();
|
||||
u32 CalculateItemCollectionRate();
|
||||
u32 GetTotalPickupCount();
|
||||
|
||||
void SetIsFusionEnabled(bool v);
|
||||
bool GetIsFusionEnabled();
|
||||
|
||||
EPlayerSuit GetCurrentSuit();
|
||||
EPlayerSuit GetCurrentSuitRaw() const { return x20_currentSuit; }
|
||||
EBeamId GetCurrentBeam() const { return x8_currentBeam; }
|
||||
void SetCurrentBeam(EBeamId beam) { x8_currentBeam = beam; }
|
||||
bool CanVisorSeeFog(const CStateManager& stateMgr) const;
|
||||
EPlayerVisor GetCurrentVisor() const { return x14_currentVisor; }
|
||||
EPlayerVisor GetTransitioningVisor() const { return x18_transitioningVisor; }
|
||||
EPlayerVisor GetActiveVisor(const CStateManager& mgr) const;
|
||||
|
||||
void UpdateStaticInterference(CStateManager& stateMgr, const float& dt);
|
||||
void IncreaseScanTime(u32 time, float val);
|
||||
void SetScanTime(CAssetId res, float time);
|
||||
float GetScanTime(CAssetId time) const;
|
||||
bool GetIsVisorTransitioning() const;
|
||||
float GetVisorTransitionFactor() const;
|
||||
void UpdateVisorTransition(float dt);
|
||||
void StartTransitionToVisor(EPlayerVisor visor);
|
||||
void ResetVisor();
|
||||
|
||||
bool ItemEnabled(EItemType type) const;
|
||||
void DisableItem(EItemType type);
|
||||
void EnableItem(EItemType type);
|
||||
bool HasPowerUp(EItemType type) const;
|
||||
u32 GetPowerUp(EItemType type);
|
||||
u32 GetItemCapacity(EItemType type) const;
|
||||
u32 GetItemAmount(EItemType type) const;
|
||||
void DecrPickUp(EItemType type, int amount);
|
||||
void IncrPickUp(EItemType type, int amount);
|
||||
void ResetAndIncrPickUp(EItemType type, int amount);
|
||||
static float GetEnergyTankCapacity();
|
||||
static float GetBaseHealthCapacity();
|
||||
float CalculateHealth();
|
||||
void InitializePowerUp(CPlayerState::EItemType type, int capacity);
|
||||
void ReInitializePowerUp(CPlayerState::EItemType type, int capacity);
|
||||
|
||||
void InitializeScanTimes();
|
||||
|
||||
static uint GetBitCount(uint);
|
||||
|
||||
CStaticInterference& GetStaticInterference() { return x188_staticIntf; }
|
||||
|
||||
const rstl::vector< rstl::pair< CAssetId, float > >& GetScanTimes() const {
|
||||
return x170_scanTimes;
|
||||
}
|
||||
|
||||
CHealthInfo& GetHealthInfo() { return xc_health; }
|
||||
|
||||
const CHealthInfo& GetHealthInfo() const { return xc_health; }
|
||||
|
||||
|
||||
private:
|
||||
u8 pad[0x198];
|
||||
struct CPowerUp {
|
||||
int x0_amount;
|
||||
int x4_capacity;
|
||||
CPowerUp() : x0_amount(0), x4_capacity(0) {}
|
||||
CPowerUp(int amount, int capacity);
|
||||
};
|
||||
|
||||
bool x0_24_alive : 1;
|
||||
bool x0_25_firingComboBeam : 1;
|
||||
bool x0_26_fusion : 1;
|
||||
u32 x4_enabledItems;
|
||||
EBeamId x8_currentBeam;
|
||||
CHealthInfo xc_health;
|
||||
EPlayerVisor x14_currentVisor;
|
||||
EPlayerVisor x18_transitioningVisor;
|
||||
float x1c_visorTransitionFactor;
|
||||
EPlayerSuit x20_currentSuit;
|
||||
rstl::reserved_vector< CPowerUp, 41 > x24_powerups;
|
||||
rstl::vector< rstl::pair< CAssetId, float > > x170_scanTimes;
|
||||
rstl::pair< u32, u32 > x180_scanCompletionRate;
|
||||
CStaticInterference x188_staticIntf;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user