Add almost matching CScriptDistanceFog

This commit is contained in:
Henrique Gemignani Passos Lima
2022-10-21 17:28:54 +03:00
parent 0a0483489c
commit d99637766d
9 changed files with 156 additions and 22 deletions

View File

@@ -7,7 +7,19 @@
#include "Kyoto/Math/CVector2f.hpp"
enum ERglFogMode {
// TODO
kRFM_None = GX_FOG_NONE,
kRFM_PerspLin = GX_FOG_PERSP_LIN,
kRFM_PerspExp = GX_FOG_PERSP_EXP,
kRFM_PerspExp2 = GX_FOG_ORTHO_EXP2,
kRFM_PerspRevExp = GX_FOG_PERSP_REVEXP,
kRFM_PerspRevExp2 = GX_FOG_PERSP_REVEXP2,
kRFM_OrthoLin = GX_FOG_ORTHO_LIN,
kRFM_OrthoExp = GX_FOG_ORTHO_EXP,
kRFM_OrthoExp2 = GX_FOG_ORTHO_EXP2,
kRFM_OrthoRevExp = GX_FOG_ORTHO_REVEXP,
kRFM_OrthoRevExp2 = GX_FOG_ORTHO_REVEXP2,
};
class CAreaFog {
@@ -23,6 +35,16 @@ private:
unkptr x2c_;
unkptr x30_;
float x34_colorDelta;
public:
void SetCurrent() const;
void Update(float dt);
void RollFogOut(float rangeDelta, float colorDelta, const CColor& color);
void FadeFog(ERglFogMode, const CColor& color, const CVector2f& vec1, float,
const CVector2f& vec2);
void SetFogExplicit(ERglFogMode mode, const CColor& color, const CVector2f& range);
bool IsFogDisabled() const;
void DisableFog();
};
CHECK_SIZEOF(CAreaFog, 0x38)

View File

@@ -32,6 +32,7 @@ class Dock;
class CToken;
class IDvdRequest;
class CScriptAreaAttributes;
class CAreaFog;
class CGameArea : public IGameArea {
public:
@@ -48,6 +49,10 @@ public:
bool IsLoaded() const { return xf0_24_postConstructed; }
bool IsActive() const { return xf0_25_active; }
void SetXRaySpeedAndTarget(float speed, float target);
void SetThermalSpeedAndTarget(float speed, float target);
void SetWeaponWorldLighting(float speed, float target);
void SetAreaAttributes(const CScriptAreaAttributes* areaAttributes);
bool TryTakingOutOfARAM();
@@ -85,17 +90,23 @@ public:
enum EOcclusionState { kOS_Occluded, kOS_Visible };
struct CPostConstructed {
uchar x0_pad[0x10dc];
uchar x0_pad[0x10c4];
rstl::single_ptr<CAreaFog> x10c4_areaFog;
rstl::optional_object<void*> x10c8_sclyBuf; // was rstl::optional_object<void*>
u32 x10d0_sclySize;
const u8* x10d4_firstMatPtr;
const CScriptAreaAttributes* x10d8_areaAttributes;
EOcclusionState x10dc_occlusionState;
};
const CAreaFog* GetAreaFog() const { return x12c_postConstructed->x10c4_areaFog.get(); }
CAreaFog* AreaFog() { return x12c_postConstructed->x10c4_areaFog.get(); }
EOcclusionState GetOcclusionState() const { return x12c_postConstructed->x10dc_occlusionState; }
private:
uchar x110_pad[0x1c];
rstl::single_ptr<CPostConstructed> x12c_postConstructed;
};
#endif // _CGAMEAREA

View File

@@ -0,0 +1,31 @@
#ifndef _CSCRIPTDISTANCEFOG
#define _CSCRIPTDISTANCEFOG
#include "MetroidPrime/CEntity.hpp"
#include "MetroidPrime/CAreaFog.hpp"
class CScriptDistanceFog : public CEntity {
ERglFogMode x34_mode;
CColor x38_color;
CVector2f x3c_range;
float x44_colorDelta;
CVector2f x48_rangeDelta;
float x50_thermalTarget;
float x54_thermalSpeed;
float x58_xrayTarget;
float x5c_xraySpeed;
bool x60_explicit;
bool x61_nonZero;
public:
CScriptDistanceFog(TUniqueId, const rstl::string&, const CEntityInfo&, ERglFogMode, const CColor&,
const CVector2f&, float, const CVector2f&, bool, bool, float, float, float,
float);
~CScriptDistanceFog();
void Accept(IVisitor& visitor) override;
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr) override;
};
#endif // _CSCRIPTDISTANCEFOG