Match CFluidPlane, merge with CFluidPlaneManager, I believe this is where it belongs

This commit is contained in:
Phillip Stephens 2025-04-20 14:19:15 -07:00
parent 18e4e12b58
commit 9d29bce46d
15 changed files with 143 additions and 143 deletions

View File

@ -876,18 +876,13 @@ MetroidPrime/Cameras/CPathCamera.cpp:
.sbss start:0x805A8F60 end:0x805A8F70
.sdata2 start:0x805AB5C8 end:0x805AB5E8
MetroidPrime/CFluidPlane.cpp:
.text start:0x8012E90C end:0x8012F0A0
.data start:0x803E0CE0 end:0x803E0D00
.sdata start:0x805A76C8 end:0x805A76D8
.sdata2 start:0x805AB5E8 end:0x805AB610
MetroidPrime/CFluidPlaneManager.cpp:
.text start:0x8012F0A0 end:0x8012F774
.text start:0x8012E90C end:0x8012F774
.rodata start:0x803D0038 end:0x803D0048
.data start:0x803E0CE0 end:0x803E0D00
.bss start:0x8056F8B4 end:0x805719CC align:4 common
.sdata start:0x805A76D8 end:0x805A76E0
.sdata2 start:0x805AB610 end:0x805AB650
.sdata start:0x805A76C8 end:0x805A76E0
.sdata2 start:0x805AB5E8 end:0x805AB650
MetroidPrime/ScriptObjects/CScriptGrapplePoint.cpp:
.text start:0x8012F774 end:0x8012FAD8

View File

@ -6931,15 +6931,15 @@ Reset__11CPathCameraFRC12CTransform4fR13CStateManager = .text:0x8012E208; // typ
__dt__11CPathCameraFv = .text:0x8012E6A8; // type:function size:0x70 scope:global
__ct__11CPathCameraF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fbfffffUlQ211CPathCamera22EInitialSplinePosition = .text:0x8012E718; // type:function size:0x17C scope:global
__sinit_CPathCamera_cpp = .text:0x8012E894; // type:function size:0x78 scope:local
fn_8012E90C = .text:0x8012E90C; // type:function size:0x4
Render__11CFluidPlaneFRC13CStateManagerRC6CAABoxRC14CFrustumPlanesRC14CRippleManagerRC9CVector3f = .text:0x8012E90C; // type:function size:0x4
AddRipple__11CFluidPlaneFRC7CRippleRC12CScriptWaterR13CStateManager = .text:0x8012E910; // type:function size:0x54 scope:global
AddRipple__11CFluidPlaneFf9TUniqueIdRC9CVector3fRC9CVector3fRC12CScriptWaterR13CStateManagerRC9CVector3f = .text:0x8012E964; // type:function size:0xC4 scope:global
AddRipple__11CFluidPlaneFf9TUniqueIdRC9CVector3fR13CStateManager = .text:0x8012EA28; // type:function size:0xA0 scope:global
AddRipple__11CFluidPlaneFf9TUniqueIdRC9CVector3fRC12CScriptWaterR13CStateManager = .text:0x8012EA28; // type:function size:0xA0 scope:global
GetRippleScaleFromKineticEnergy__11CFluidPlaneFff = .text:0x8012EAC8; // type:function size:0x50 scope:global
CalculateRippleIntensity__11CFluidPlaneCFf = .text:0x8012EB18; // type:function size:0xC4 scope:global
__dt__11CFluidPlaneFv = .text:0x8012EBDC; // type:function size:0x158 scope:global
__ct__11CFluidPlaneFUiUiUifQ211CFluidPlane10EFluidTypefRC14CFluidUVMotion = .text:0x8012ED34; // type:function size:0x364 scope:global
fn_8012F098 = .text:0x8012F098; // type:function size:0x8
fn_8012F098__Fv = .text:0x8012F098; // type:function size:0x8
SetupRippleMap__18CFluidPlaneManagerFv = .text:0x8012F0A0; // type:function size:0x218 scope:global
CreateSplash__18CFluidPlaneManagerF9TUniqueIdR13CStateManagerRC12CScriptWaterRC9CVector3ffb = .text:0x8012F2B8; // type:function size:0x2C8 scope:global
GetLastRippleDeltaTime__18CFluidPlaneManagerCF9TUniqueId = .text:0x8012F580; // type:function size:0x2C scope:global
@ -18280,7 +18280,7 @@ __vt__14CBCWallHangCmd = .data:0x803E0B98; // type:object size:0x48 scope:global
lbl_803E0BE0 = .data:0x803E0BE0; // type:object size:0x18
__vt__17CScriptCoverPoint = .data:0x803E0BF8; // type:object size:0x6C scope:global
__vt__11CPathCamera = .data:0x803E0C68; // type:object size:0x78
lbl_803E0CE0 = .data:0x803E0CE0; // type:object size:0x20
__vt__11CFluidPlane = .data:0x803E0CE0; // type:object size:0x20
__vt__19CScriptGrapplePoint = .data:0x803E0D00; // type:object size:0x6C scope:global
__vt__19CHUDBillboardEffect = .data:0x803E0D70; // type:object size:0x6C scope:global
lbl_803E0DE0 = .data:0x803E0DE0; // type:object size:0x2D0

View File

@ -876,18 +876,13 @@ MetroidPrime/Cameras/CPathCamera.cpp:
.sbss start:0x805A9140 end:0x805A9150
.sdata2 start:0x805AB7A8 end:0x805AB7C8
MetroidPrime/CFluidPlane.cpp:
.text start:0x8012E988 end:0x8012F11C
.data start:0x803E0EC0 end:0x803E0EE0
.bss start:0x8056FA94 end:0x80571BAC align:4 common
.sdata start:0x805A78A8 end:0x805A78B8
.sdata2 start:0x805AB7C8 end:0x805AB7F0
MetroidPrime/CFluidPlaneManager.cpp:
.text start:0x8012F11C end:0x8012F7F0
.text start:0x8012E988 end:0x8012F7F0
.data start:0x803E0EC0 end:0x803E0EE0
.rodata start:0x803D0218 end:0x803D0228
.sdata start:0x805A78B8 end:0x805A78C0
.sdata2 start:0x805AB7F0 end:0x805AB830
.bss start:0x8056FA94 end:0x80571BAC align:4 common
.sdata start:0x805A78A8 end:0x805A78C0
.sdata2 start:0x805AB7C8 end:0x805AB830
MetroidPrime/ScriptObjects/CScriptGrapplePoint.cpp:
.text start:0x8012F7F0 end:0x8012FB54

View File

@ -6931,15 +6931,15 @@ Reset__11CPathCameraFRC12CTransform4fR13CStateManager = .text:0x8012E284; // typ
__dt__11CPathCameraFv = .text:0x8012E724; // type:function size:0x70 scope:global
__ct__11CPathCameraF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fbfffffUlQ211CPathCamera22EInitialSplinePosition = .text:0x8012E794; // type:function size:0x17C scope:global
__sinit_CPathCamera_cpp = .text:0x8012E910; // type:function size:0x78 scope:global
nullsub_209 = .text:0x8012E988; // type:function size:0x4 scope:global
Render__11CFluidPlaneFRC13CStateManagerRC6CAABoxRC14CFrustumPlanesRC14CRippleManagerRC9CVector3f = .text:0x8012E988; // type:function size:0x4 scope:global
AddRipple__11CFluidPlaneFRC7CRippleRC12CScriptWaterR13CStateManager = .text:0x8012E98C; // type:function size:0x54 scope:global
AddRipple__11CFluidPlaneFf9TUniqueIdRC9CVector3fRC9CVector3fRC12CScriptWaterR13CStateManagerRC9CVector3f = .text:0x8012E9E0; // type:function size:0xC4 scope:global
AddRipple__11CFluidPlaneFf9TUniqueIdRC9CVector3fR13CStateManager = .text:0x8012EAA4; // type:function size:0xA0 scope:global
AddRipple__11CFluidPlaneFf9TUniqueIdRC9CVector3fRC12CScriptWaterR13CStateManager = .text:0x8012EAA4; // type:function size:0xA0 scope:global
GetRippleScaleFromKineticEnergy__11CFluidPlaneFff = .text:0x8012EB44; // type:function size:0x50 scope:global
CalculateRippleIntensity__11CFluidPlaneCFf = .text:0x8012EB94; // type:function size:0xC4 scope:global
__dt__11CFluidPlaneFv = .text:0x8012EC58; // type:function size:0x158 scope:global
__ct__11CFluidPlaneFUiUiUifQ211CFluidPlane10EFluidTypefRC14CFluidUVMotion = .text:0x8012EDB0; // type:function size:0x364 scope:global
fn_8012F098 = .text:0x8012F114; // type:function size:0x8 scope:global
fn_8012F098__Fv = .text:0x8012F114; // type:function size:0x8 scope:global
SetupRippleMap__18CFluidPlaneManagerFv = .text:0x8012F11C; // type:function size:0x218 scope:global
CreateSplash__18CFluidPlaneManagerF9TUniqueIdR13CStateManagerRC12CScriptWaterRC9CVector3ffb = .text:0x8012F334; // type:function size:0x2C8 scope:global
GetLastRippleDeltaTime__18CFluidPlaneManagerCF9TUniqueId = .text:0x8012F5FC; // type:function size:0x2C scope:global
@ -18316,7 +18316,7 @@ __vt__14CBCWallHangCmd = .data:0x803E0D78; // type:object size:0x48
lbl_803E0DC0 = .data:0x803E0DC0; // type:object size:0x18
__vt__17CScriptCoverPoint = .data:0x803E0DD8; // type:object size:0x6C
lbl_803E0E48 = .data:0x803E0E48; // type:object size:0x78
lbl_803E0EC0 = .data:0x803E0EC0; // type:object size:0x20
__vt__11CFluidPlane = .data:0x803E0EC0; // type:object size:0x20
__vt__19CScriptGrapplePoint = .data:0x803E0EE0; // type:object size:0x6C
__vt__19CHUDBillboardEffect = .data:0x803E0F50; // type:object size:0x6C
lbl_803E0FC0 = .data:0x803E0FC0; // type:object size:0x2D0

View File

@ -538,7 +538,6 @@ config.libs = [
Object(NonMatching, "MetroidPrime/Enemies/CSpacePirate.cpp"),
Object(MatchingFor("GM8E01_00", "GM8E01_01"), "MetroidPrime/ScriptObjects/CScriptCoverPoint.cpp"),
Object(NonMatching, "MetroidPrime/Cameras/CPathCamera.cpp"),
Object(NonMatching, "MetroidPrime/CFluidPlane.cpp"),
Object(NonMatching, "MetroidPrime/CFluidPlaneManager.cpp"),
Object(MatchingFor("GM8E01_00", "GM8E01_01"), "MetroidPrime/ScriptObjects/CScriptGrapplePoint.cpp"),
Object(MatchingFor("GM8E01_00", "GM8E01_01"), "MetroidPrime/ScriptObjects/CHUDBillboardEffect.cpp"),

View File

@ -22,7 +22,7 @@ public:
CEntity(TUniqueId id, const CEntityInfo& info, bool active, const rstl::string& name);
void SendScriptMsgs(EScriptObjectState state, CStateManager& mgr, EScriptObjectMessage msg);
void SendScriptMsgs(const EScriptObjectState state, CStateManager& mgr, const EScriptObjectMessage msg);
TUniqueId GetUniqueId() const { return x8_uid; }
TEditorId GetEditorId() const { return xc_editorId; }
const rstl::string& GetDebugName() const { return x10_name; }

View File

@ -1,75 +1,5 @@
#ifndef _CFLUIDPLANE
#define _CFLUIDPLANE
#include "MetroidPrime/CFluidUVMotion.hpp"
#include "MetroidPrime/TGameTypes.hpp"
#include "Kyoto/Math/CVector3f.hpp"
#include "Kyoto/TToken.hpp"
#include "rstl/optional_object.hpp"
class CScriptWater;
class CStateManager;
class CTexture;
extern "C" uint sub_8012f098();
class CFluidPlaneCPURender {
public:
struct SPatchInfo {};
struct SRippleInfo {};
struct SHFieldSample {};
};
class CFluidPlane {
public:
enum EFluidType {
kFT_NormalWater,
kFT_PoisonWater,
kFT_Lava,
kFT_PhazonFluid,
kFT_Four,
kFT_ThickLava
};
CFluidPlane(uint, uint, uint, CFluidPlane::EFluidType, float, const CFluidUVMotion&);
virtual ~CFluidPlane();
virtual void AddRipple(float mag, TUniqueId rippler, const CVector3f& center, CScriptWater& water,
CStateManager& mgr);
virtual void AddRipple(float intensity, TUniqueId rippler, const CVector3f& center,
const CVector3f& velocity, const CScriptWater& water, CStateManager& mgr,
const CVector3f& upVec);
// Update__11CFluidPlaneFv
float GetRippleScaleFromKineticEnergy(float baseI, float velDot);
float GetAlpha() const { return x40_alpha; }
EFluidType GetFluidType() const { return x44_fluidType; }
const CFluidUVMotion& GetUVMotion() const { return x4c_uvMotion; }
// GetColorTexture__11CFluidPlaneCFv
// HasColorTexture__11CFluidPlaneCFv
// GetTexturePattern2__11CFluidPlaneCFv
// HasTexturePattern2__11CFluidPlaneCFv
// GetTexturePattern1__11CFluidPlaneCFv
// HasTexturePattern1__11CFluidPlaneCFv
protected:
virtual void RenderStripWithRipples(const CFluidPlaneCPURender::SHFieldSample& heights,
const unsigned char& flags, float curY, int startYDiv,
const CFluidPlaneCPURender::SPatchInfo& info);
CAssetId x4_texPattern1Id;
CAssetId x8_texPattern2Id;
CAssetId xc_texColorId;
rstl::optional_object< TLockedToken< CTexture > > x10_texPattern1;
rstl::optional_object< TLockedToken< CTexture > > x20_texPattern2;
rstl::optional_object< TLockedToken< CTexture > > x30_texColor;
float x40_alpha;
EFluidType x44_fluidType;
float x48_rippleIntensity;
CFluidUVMotion x4c_uvMotion;
};
CHECK_SIZEOF(CFluidPlane, 0xA0);
#endif // _CFLUIDPLANE

View File

@ -3,8 +3,8 @@
#include "types.h"
#include "MetroidPrime/CStateManager.hpp"
#include "MetroidPrime/CRippleManager.hpp"
#include "MetroidPrime/CStateManager.hpp"
#include "MetroidPrime/TGameTypes.hpp"
#include "Kyoto/Math/CVector3f.hpp"
@ -15,6 +15,91 @@ class CScriptWater;
class CStateManager;
class CVector3f;
#include "Kyoto/Math/CFrustumPlanes.hpp"
#include "MetroidPrime/CFluidUVMotion.hpp"
#include "MetroidPrime/CRippleManager.hpp"
#include "MetroidPrime/TGameTypes.hpp"
#include "Kyoto/Math/CVector3f.hpp"
#include "Kyoto/TToken.hpp"
#include "rstl/optional_object.hpp"
class CScriptWater;
class CStateManager;
class CRipple;
class CTexture;
extern "C" uint sub_8012f098();
class CFluidPlaneCPURender {
public:
struct SPatchInfo {};
struct SRippleInfo {};
struct SHFieldSample {};
};
class CFluidPlane {
static const float kRippleIntensityRange;
public:
enum EFluidType {
kFT_NormalWater,
kFT_PoisonWater,
kFT_Lava,
kFT_PhazonFluid,
kFT_Four,
kFT_ThickLava
};
CFluidPlane(const CAssetId texPattern1, const CAssetId texPattern2, const CAssetId texColor,
const float alpha, const EFluidType fluidType, const float rippleIntensity,
const CFluidUVMotion& motion);
virtual ~CFluidPlane();
virtual void AddRipple(const float mag, const TUniqueId rippler, const CVector3f& center,
const CScriptWater& water, CStateManager& mgr);
virtual void AddRipple(float intensity, TUniqueId rippler, const CVector3f& center,
const CVector3f& velocity, const CScriptWater& water, CStateManager& mgr,
const CVector3f& upVec);
virtual void AddRipple(const CRipple& ripple, const CScriptWater& water, CStateManager& mgr);
virtual void Render(const CStateManager& mgr, const CAABox&, const CFrustumPlanes&,
const CRippleManager&, const CVector3f&);
// Update__11CFluidPlaneFv
float CalculateRippleIntensity(const float base) const;
float GetRippleScaleFromKineticEnergy(float baseI, float velDot);
float GetAlpha() const { return x40_alpha; }
EFluidType GetFluidType() const { return x44_fluidType; }
const CFluidUVMotion& GetUVMotion() const { return x4c_uvMotion; }
// GetColorTexture__11CFluidPlaneCFv
// HasColorTexture__11CFluidPlaneCFv
// GetTexturePattern2__11CFluidPlaneCFv
// HasTexturePattern2__11CFluidPlaneCFv
// GetTexturePattern1__11CFluidPlaneCFv
// HasTexturePattern1__11CFluidPlaneCFv
static const float GetRippleIntensityRange() { return kRippleIntensityRange; }
protected:
virtual void RenderStripWithRipples(const CFluidPlaneCPURender::SHFieldSample& heights,
const unsigned char& flags, float curY, int startYDiv,
const CFluidPlaneCPURender::SPatchInfo& info);
CAssetId x4_texPattern1Id;
CAssetId x8_texPattern2Id;
CAssetId xc_texColorId;
rstl::optional_object< TLockedToken< CTexture > > x10_texPattern1;
rstl::optional_object< TLockedToken< CTexture > > x20_texPattern2;
rstl::optional_object< TLockedToken< CTexture > > x30_texColor;
float x40_alpha;
EFluidType x44_fluidType;
float x48_rippleIntensity;
CFluidUVMotion x4c_uvMotion;
};
CHECK_SIZEOF(CFluidPlane, 0xA0);
class CFluidPlaneManager {
public:
CFluidPlaneManager();
@ -23,6 +108,7 @@ public:
void CreateSplash(TUniqueId splasher, CStateManager& mgr, const CScriptWater& water,
const CVector3f& pos, float factor, bool sfx);
CRippleManager& RippleManager() { return x0_rippleManager; }
float GetLastSplashDeltaTime(TUniqueId uid) const;
float GetLastRippleDeltaTime(TUniqueId uid) const;

View File

@ -46,7 +46,7 @@ public:
CFluidUVMotion(float timeToWrap, float orientation);
CFluidUVMotion(float timeToWrap, float orientation, const SFluidLayerMotion& colorLayer,
const SFluidLayerMotion& pattern1Layer, const SFluidLayerMotion& pattern2Layer);
CFluidUVMotion(const CFluidUVMotion&);
//CFluidUVMotion(const CFluidUVMotion&);
void CalculateFluidTextureOffset(float t, float offsets[kFM_NumLayers][2]) const;

View File

@ -31,6 +31,7 @@ public:
void SetTime(float t) { x4_time = t; }
float GetTimeFalloff() const { return x14_timeFalloff; }
const CVector3f& GetCenter() const { return x8_center; }
static float kDefaultScale;
};

View File

@ -374,8 +374,8 @@ public:
bool IsInsideFluid() const { return x9c4_31_inWaterMovement; }
void Teleport(const CTransform4f& xf, CStateManager& mgr, bool resetBallCam);
void SetSpawnedMorphBallState(EPlayerMorphBallState state, CStateManager& mgr);
void Teleport(const CTransform4f& xf, CStateManager& mgr, const bool resetBallCam);
void SetSpawnedMorphBallState(const EPlayerMorphBallState state, CStateManager& mgr);
const CVisorSteam& GetVisorSteam() const { return x7a0_visorSteam; }
const float GetVisorSteamAlpha() const { return x7a0_visorSteam.GetAlpha(); }
void SetVisorSteam(float targetAlpha, float alphaInDur, float alphaOutDir, CAssetId txtr,

View File

@ -126,19 +126,19 @@ public:
void ResetVisor();
bool IsAlive() const { return x0_24_alive; }
bool ItemEnabled(EItemType type) const;
void DisableItem(EItemType type);
void EnableItem(EItemType type);
bool HasPowerUp(EItemType type) const;
uint GetPowerUp(EItemType type);
int GetItemCapacity(EItemType type) const;
int GetItemAmount(EItemType type) const;
void DecrPickUp(EItemType type, int amount);
void IncrPickUp(EItemType type, int amount);
void SetPickup(EItemType type, int amount);
const bool ItemEnabled(const EItemType type) const;
void DisableItem(const EItemType type);
void EnableItem(const EItemType type);
const bool HasPowerUp(const EItemType type) const;
const uint GetPowerUp(const EItemType type);
const int GetItemCapacity(const EItemType type) const;
const int GetItemAmount(const EItemType type) const;
void DecrPickUp(const EItemType type, const int amount);
void IncrPickUp(const EItemType type, const int amount);
void SetPickup(const EItemType type, const int amount);
static float GetEnergyTankCapacity();
static float GetBaseHealthCapacity();
float CalculateHealth();
const float CalculateHealth();
void InitializePowerUp(CPlayerState::EItemType type, int capacity);
void SetPowerUp(CPlayerState::EItemType type, int capacity);
static bool IsValidScan(CAssetId res);
@ -147,7 +147,7 @@ public:
void InitializeScanTimes();
static uint GetBitCount(uint);
static const uint GetBitCount(uint);
CStaticInterference& StaticInterference() { return x188_staticIntf; }
const CStaticInterference& GetStaticInterference() const { return x188_staticIntf; }
@ -155,8 +155,8 @@ public:
const rstl::vector< rstl::pair< CAssetId, float > >& GetScanTimes() const {
return x170_scanTimes;
}
int GetLogScans() const { return x180_scanCompletionRateFirst; }
int GetTotalLogScans() const { return x184_scanCompletionRateSecond; }
const int GetLogScans() const { return x180_scanCompletionRateFirst; }
const int GetTotalLogScans() const { return x184_scanCompletionRateSecond; }
CHealthInfo* HealthInfo() { return &xc_health; }
const CHealthInfo& GetHealthInfo() const { return xc_health; }

View File

@ -1,11 +0,0 @@
#include "MetroidPrime/CFluidPlane.hpp"
#include "Kyoto/Math/CMath.hpp"
float CFluidPlane::GetRippleScaleFromKineticEnergy(float baseI, float velDot) {
float tmp = CMath::FastSqrtF(0.5f * baseI * velDot * velDot);
if (tmp >= 160.f) {
return 1.f;
}
return tmp * (1.f / 160.f);
}

View File

@ -10,8 +10,8 @@
#include "Kyoto/Streams/CInputStream.hpp"
#include "Kyoto/Streams/COutputStream.hpp"
#include "rstl/math.hpp"
#include "rstl/algorithm.hpp"
#include "rstl/math.hpp"
#include <math.h>
@ -43,7 +43,7 @@ static const float kMaxVisorTransitionFactor = 0.2f;
static inline void do_nothing() {}
uint CPlayerState::GetBitCount(uint val) {
const uint CPlayerState::GetBitCount(uint val) {
int bits = 0;
for (; val != 0; val >>= 1) {
bits += 1;
@ -179,11 +179,11 @@ void CPlayerState::InitializePowerUp(CPlayerState::EItemType type, int capacity)
}
}
float CPlayerState::CalculateHealth() {
const float CPlayerState::CalculateHealth() {
return (kEnergyTankCapacity * x24_powerups[kIT_EnergyTanks].x0_amount) + kBaseHealthCapacity;
}
void CPlayerState::SetPickup(CPlayerState::EItemType type, int amount) {
void CPlayerState::SetPickup(const CPlayerState::EItemType type, const int amount) {
x24_powerups[uint(type)].x0_amount = 0;
IncrPickUp(type, amount);
}
@ -248,7 +248,7 @@ void CPlayerState::DecrPickUp(CPlayerState::EItemType type, int amount) {
}
}
int CPlayerState::GetItemAmount(CPlayerState::EItemType type) const {
const int CPlayerState::GetItemAmount(const CPlayerState::EItemType type) const {
if (type < 0 || kIT_Max - 1 < type) {
return 0;
}
@ -272,43 +272,45 @@ int CPlayerState::GetItemAmount(CPlayerState::EItemType type) const {
case kIT_Spirit:
case kIT_Newborn:
return x24_powerups[uint(type)].x0_amount;
default:
break;
}
return 0;
}
int CPlayerState::GetItemCapacity(CPlayerState::EItemType type) const {
const int CPlayerState::GetItemCapacity(const CPlayerState::EItemType type) const {
if (type < 0 || kIT_Max - 1 < type) {
return 0;
}
return x24_powerups[uint(type)].x4_capacity;
}
bool CPlayerState::HasPowerUp(CPlayerState::EItemType type) const {
const bool CPlayerState::HasPowerUp(const CPlayerState::EItemType type) const {
if (type < 0 || kIT_Max - 1 < type) {
return false;
}
return x24_powerups[uint(type)].x4_capacity > 0;
}
uint CPlayerState::GetPowerUp(CPlayerState::EItemType type) {
const uint CPlayerState::GetPowerUp(const CPlayerState::EItemType type) {
if (type < 0 || kIT_Max - 1 < type) {
return 0;
}
return x24_powerups[uint(type)].x4_capacity;
}
void CPlayerState::EnableItem(CPlayerState::EItemType type) {
void CPlayerState::EnableItem(const CPlayerState::EItemType type) {
if (HasPowerUp(type))
x4_enabledItems |= (1 << uint(type));
}
void CPlayerState::DisableItem(CPlayerState::EItemType type) {
void CPlayerState::DisableItem(const CPlayerState::EItemType type) {
if (HasPowerUp(type))
x4_enabledItems &= ~(1 << uint(type));
}
bool CPlayerState::ItemEnabled(CPlayerState::EItemType type) const {
const bool CPlayerState::ItemEnabled(const CPlayerState::EItemType type) const {
if (HasPowerUp(type))
return (x4_enabledItems & (1 << uint(type)));
return false;
@ -319,7 +321,7 @@ void CPlayerState::ResetVisor() {
x1c_visorTransitionFactor = 0.0f;
}
void CPlayerState::StartTransitionToVisor(CPlayerState::EPlayerVisor visor) {
void CPlayerState::StartTransitionToVisor(const CPlayerState::EPlayerVisor visor) {
if (visor == x18_transitioningVisor)
return;
@ -371,12 +373,14 @@ void CPlayerState::InitializeScanTimes() {
}
float CPlayerState::GetScanTime(CAssetId res) const {
rstl::vector< rstl::pair< CAssetId, float > >::const_iterator it = rstl::find_by_key(x170_scanTimes, res);
rstl::vector< rstl::pair< CAssetId, float > >::const_iterator it =
rstl::find_by_key(x170_scanTimes, res);
return it->second;
}
void CPlayerState::SetScanTime(CAssetId res, float time) {
rstl::vector< rstl::pair< CAssetId, float > >::iterator it = rstl::find_by_key_nc(x170_scanTimes, res);
rstl::vector< rstl::pair< CAssetId, float > >::iterator it =
rstl::find_by_key_nc(x170_scanTimes, res);
it->second = time;
}

View File

@ -37,7 +37,6 @@ void CScriptSpawnPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objI
stateMgr.PlayerState()->SetPowerUp(e, GetPowerup(e));
stateMgr.PlayerState()->SetPickup(e, GetPowerup(e));
}
case kSM_SetToZero:
if (GetActive()) {
CPlayer* player = stateMgr.Player();
@ -76,6 +75,8 @@ void CScriptSpawnPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objI
}
CEntity::SendScriptMsgs(kSS_Zero, stateMgr, kSM_None);
}
default:
break;
}
}