2016-04-13 06:07:23 +00:00
|
|
|
#ifndef __URDE_CPLAYERSTATE_HPP__
|
|
|
|
#define __URDE_CPLAYERSTATE_HPP__
|
2015-08-17 05:26:58 +00:00
|
|
|
|
2015-08-19 05:48:57 +00:00
|
|
|
#include "RetroTypes.hpp"
|
2015-08-20 02:52:07 +00:00
|
|
|
#include "CBasics.hpp"
|
2015-08-17 20:33:58 +00:00
|
|
|
#include "CStaticInterference.hpp"
|
2015-08-23 23:58:07 +00:00
|
|
|
#include "IOStreams.hpp"
|
2016-03-19 19:19:43 +00:00
|
|
|
#include "rstl.hpp"
|
2016-06-30 19:33:38 +00:00
|
|
|
#include "World/CHealthInfo.hpp"
|
2015-08-17 20:33:58 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2015-08-17 22:05:00 +00:00
|
|
|
{
|
|
|
|
|
2015-08-18 05:54:43 +00:00
|
|
|
class CPlayerState
|
2015-08-17 05:26:58 +00:00
|
|
|
{
|
2016-08-16 22:49:19 +00:00
|
|
|
friend class CWorldTransManager;
|
2016-03-23 20:38:01 +00:00
|
|
|
public:
|
|
|
|
enum class EItemType : u32
|
|
|
|
{
|
2016-08-18 18:34:06 +00:00
|
|
|
PowerBeam = 0,
|
|
|
|
IceBeam = 1,
|
|
|
|
WaveBeam = 2,
|
|
|
|
PlasmaBeam = 3,
|
|
|
|
Missiles = 4,
|
|
|
|
ScanVisor = 5,
|
|
|
|
MorphBallBombs = 6,
|
|
|
|
PowerBombs = 7,
|
|
|
|
Flamethrower = 8,
|
|
|
|
ThermalVisor = 9,
|
|
|
|
ChargeBeam = 10,
|
|
|
|
SuperMissile = 11,
|
|
|
|
GrappleBeam = 12,
|
|
|
|
XRayVisor = 13,
|
|
|
|
IceSpreader = 14,
|
|
|
|
SpaceJumpBoots = 15,
|
|
|
|
MorphBall = 16,
|
|
|
|
CombatVisor = 17,
|
|
|
|
BoostBall = 18,
|
|
|
|
SpiderBall = 19,
|
|
|
|
PowerSuit = 20,
|
|
|
|
GravitySuit = 21,
|
|
|
|
VariaSuit = 22,
|
|
|
|
PhazonSuit = 23,
|
|
|
|
EnergyTanks = 24,
|
|
|
|
UnknownItem1 = 25,
|
|
|
|
HealthRefill = 26,
|
|
|
|
UnknownItem2 = 27,
|
|
|
|
Wavebuster = 28,
|
|
|
|
ArtifactOfTruth = 29,
|
|
|
|
ArtifactOfStrength = 30,
|
|
|
|
ArtifactOfElder = 31,
|
|
|
|
ArtifactOfWild = 32,
|
|
|
|
ArtifactOfLifegiver = 33,
|
|
|
|
ArtifactOfWarrior = 34,
|
|
|
|
ArtifactOfChozo = 35,
|
|
|
|
ArtifactOfNature = 36,
|
|
|
|
ArtifactOfSun = 37,
|
|
|
|
ArtifactOfWorld = 38,
|
|
|
|
ArtifactOfSpirit = 39,
|
|
|
|
ArtifactOfNewborn = 40,
|
2016-03-23 20:38:01 +00:00
|
|
|
|
|
|
|
/* This must remain at the end of the list */
|
|
|
|
Max
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class EPlayerVisor : u32
|
2015-08-17 20:33:58 +00:00
|
|
|
{
|
2016-03-23 20:38:01 +00:00
|
|
|
Combat,
|
|
|
|
XRay,
|
|
|
|
Scan,
|
|
|
|
Thermal,
|
|
|
|
|
|
|
|
/* This must remain at the end of the list */
|
|
|
|
Max
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class EPlayerSuit : u32
|
|
|
|
{
|
|
|
|
Power,
|
|
|
|
Gravity,
|
|
|
|
Varia,
|
|
|
|
Phazon,
|
|
|
|
FusionPower,
|
|
|
|
FusionGravity,
|
|
|
|
FusionVaria,
|
|
|
|
FusionPhazon
|
|
|
|
};
|
|
|
|
|
2016-03-28 08:54:02 +00:00
|
|
|
enum class EBeamId : u32
|
|
|
|
{
|
|
|
|
Power,
|
|
|
|
Ice,
|
|
|
|
Plasma,
|
|
|
|
Wave,
|
|
|
|
Phazon
|
|
|
|
};
|
|
|
|
|
2016-12-10 02:35:20 +00:00
|
|
|
enum class EChargeState : u32
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2016-03-23 20:38:01 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
static const u32 PowerUpMaxValues[41];
|
|
|
|
struct CPowerUp
|
|
|
|
{
|
|
|
|
int x0_amount = 0;
|
|
|
|
int x4_capacity = 0;
|
2015-08-20 02:52:07 +00:00
|
|
|
CPowerUp() {}
|
2016-03-23 20:38:01 +00:00
|
|
|
CPowerUp(int amount, int capacity) : x0_amount(amount), x4_capacity(capacity) {}
|
2016-03-19 19:19:43 +00:00
|
|
|
};
|
|
|
|
union
|
|
|
|
{
|
2016-12-10 02:35:20 +00:00
|
|
|
struct { bool x0_24_ : 1; bool x0_25_ : 1; bool x0_26_fusion : 1; };
|
2016-03-19 19:19:43 +00:00
|
|
|
u32 dummy = 0;
|
2015-08-17 20:33:58 +00:00
|
|
|
};
|
2015-08-20 02:52:07 +00:00
|
|
|
|
2016-03-19 19:19:43 +00:00
|
|
|
u32 x4_ = 0;
|
2016-03-28 08:54:02 +00:00
|
|
|
EBeamId x8_currentBeam = EBeamId::Power;
|
2016-06-30 19:33:38 +00:00
|
|
|
CHealthInfo xc_health = {99.f, 50.f};
|
2016-03-23 20:38:01 +00:00
|
|
|
EPlayerVisor x14_currentVisor = EPlayerVisor::Combat;
|
|
|
|
EPlayerVisor x18_transitioningVisor = x14_currentVisor;
|
|
|
|
float x1c_visorTransitionFactor = 0.2f;
|
|
|
|
EPlayerSuit x20_currentSuit = EPlayerSuit::Power;
|
2016-03-19 19:19:43 +00:00
|
|
|
rstl::reserved_vector<CPowerUp, 41> x24_powerups;
|
2016-03-28 08:54:02 +00:00
|
|
|
rstl::reserved_vector<std::pair<u32, float>, 846> x170_scanTimes;
|
|
|
|
u32 x180_ = 0;
|
|
|
|
u32 x184_ = 0;
|
2016-03-19 19:19:43 +00:00
|
|
|
CStaticInterference x188_staticIntf;
|
2015-08-20 02:52:07 +00:00
|
|
|
public:
|
2016-03-23 20:38:01 +00:00
|
|
|
|
2016-03-28 08:54:02 +00:00
|
|
|
float sub_80091204() const;
|
|
|
|
u32 GetMissileCostForAltAttack() const;
|
2016-03-23 20:38:01 +00:00
|
|
|
u32 CalculateItemCollectionRate() const;
|
|
|
|
|
2016-06-30 19:33:38 +00:00
|
|
|
CHealthInfo& HealthInfo();
|
|
|
|
CHealthInfo GetHealthInfo() const;
|
2016-03-28 08:54:02 +00:00
|
|
|
u32 GetPickupTotal() { return 99; }
|
2016-03-23 20:38:01 +00:00
|
|
|
void SetFusion(bool val) { x0_26_fusion = val; }
|
|
|
|
bool GetFusion() const { return x0_26_fusion; }
|
|
|
|
EPlayerSuit GetCurrentSuit() const;
|
2016-08-16 22:49:19 +00:00
|
|
|
EBeamId GetCurrentBeam() const { return x8_currentBeam; }
|
2016-03-23 20:38:01 +00:00
|
|
|
bool CanVisorSeeFog(const CStateManager& stateMgr) const;
|
2016-12-10 02:35:20 +00:00
|
|
|
EPlayerVisor GetCurrentVisor() const { return x14_currentVisor; }
|
2016-03-23 20:38:01 +00:00
|
|
|
EPlayerVisor GetActiveVisor(const CStateManager& stateMgr) const;
|
|
|
|
void UpdateStaticInterference(CStateManager& stateMgr, const float& dt);
|
|
|
|
void IncreaseScanTime(u32 time, float val);
|
2016-03-28 08:54:02 +00:00
|
|
|
void SetScanTime(u32 time, float val);
|
|
|
|
float GetScanTime(u32 time, float val);
|
2016-03-23 20:38:01 +00:00
|
|
|
bool GetIsVisorTransitioning() const;
|
|
|
|
float GetVisorTransitionFactor() const;
|
|
|
|
void UpdateVisorTransition(float dt);
|
|
|
|
bool StartVisorTransition(EPlayerVisor visor);
|
|
|
|
void ResetVisor();
|
|
|
|
bool ItemEnabled(EItemType type);
|
|
|
|
void DisableItem(EItemType type);
|
|
|
|
void EnableItem(EItemType type);
|
|
|
|
bool HasPowerUp(EItemType type);
|
|
|
|
u32 GetItemCapacity(EItemType type) const;
|
|
|
|
u32 GetItemAmount(EItemType type) const;
|
|
|
|
void DecrPickup(EItemType type, s32 amount);
|
|
|
|
void IncrPickup(EItemType type, s32 amount);
|
|
|
|
void ResetAndIncrPickUp(EItemType type, s32 amount);
|
|
|
|
float GetEnergyTankCapacity() const { return 100.f; }
|
|
|
|
float GetBaseHealthCapacity() const { return 99.f; }
|
|
|
|
float CalculateHealth(u32 health);
|
|
|
|
void ReInitalizePowerUp(EItemType type, u32 capacity);
|
|
|
|
void InitializePowerUp(EItemType type, u32 capacity);
|
2016-03-19 19:19:43 +00:00
|
|
|
CPlayerState() : x188_staticIntf(5) { x0_24_ = true; }
|
|
|
|
CPlayerState(CBitStreamReader& stream);
|
2016-03-28 08:54:02 +00:00
|
|
|
void PutTo(CBitStreamWriter& stream);
|
2016-08-14 21:11:44 +00:00
|
|
|
|
2015-08-17 05:26:58 +00:00
|
|
|
};
|
2015-08-17 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
#endif // __URDE_CPLAYERSTATE_HPP__
|