2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _CGAMEAREA
|
|
|
|
#define _CGAMEAREA
|
2022-08-16 02:14:28 +00:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
|
|
|
#include "MetroidPrime/TGameTypes.hpp"
|
|
|
|
|
2022-11-07 00:20:46 +00:00
|
|
|
#include "Kyoto/Graphics/CColor.hpp"
|
2022-08-16 02:14:28 +00:00
|
|
|
#include "Kyoto/IObjectStore.hpp"
|
|
|
|
#include "Kyoto/Math/CAABox.hpp"
|
|
|
|
#include "Kyoto/Math/CTransform4f.hpp"
|
2022-11-07 00:20:46 +00:00
|
|
|
#include "Kyoto/Math/CVector2f.hpp"
|
2022-08-16 02:14:28 +00:00
|
|
|
|
|
|
|
#include "rstl/auto_ptr.hpp"
|
|
|
|
#include "rstl/list.hpp"
|
2022-11-14 13:37:44 +00:00
|
|
|
#include "rstl/optional_object.hpp"
|
2022-08-16 02:14:28 +00:00
|
|
|
#include "rstl/pair.hpp"
|
|
|
|
#include "rstl/rc_ptr.hpp"
|
2022-11-07 00:20:46 +00:00
|
|
|
#include "rstl/single_ptr.hpp"
|
2022-08-16 02:14:28 +00:00
|
|
|
#include "rstl/vector.hpp"
|
2022-11-14 13:37:44 +00:00
|
|
|
|
2022-11-07 00:20:46 +00:00
|
|
|
|
|
|
|
enum ERglFogMode {
|
|
|
|
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,
|
|
|
|
};
|
2022-08-16 02:14:28 +00:00
|
|
|
|
|
|
|
class IGameArea {
|
|
|
|
public:
|
|
|
|
virtual ~IGameArea();
|
|
|
|
virtual const CTransform4f& IGetTM() const = 0;
|
|
|
|
virtual CAssetId IGetStringTableAssetId() const = 0;
|
2022-09-05 04:01:13 +00:00
|
|
|
virtual uint IGetNumAttachedAreas() const = 0;
|
2022-08-16 02:14:28 +00:00
|
|
|
virtual TAreaId IGetAttachedAreaId(int) const = 0;
|
|
|
|
virtual bool IIsActive() const = 0;
|
|
|
|
virtual CAssetId IGetAreaAssetId() const = 0;
|
2022-09-05 04:01:13 +00:00
|
|
|
virtual int IGetAreaSaveId() const = 0;
|
2022-10-09 05:37:23 +00:00
|
|
|
virtual rstl::pair< rstl::auto_ptr< uchar >, int > IGetScriptingMemoryAlways() const = 0;
|
2022-08-16 02:14:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Dock;
|
|
|
|
class CToken;
|
|
|
|
class IDvdRequest;
|
2022-10-14 16:03:05 +00:00
|
|
|
class CScriptAreaAttributes;
|
2022-08-16 02:14:28 +00:00
|
|
|
|
|
|
|
class CGameArea : public IGameArea {
|
|
|
|
public:
|
2022-11-07 00:20:46 +00:00
|
|
|
class CAreaFog {
|
|
|
|
private:
|
|
|
|
ERglFogMode x0_fogMode;
|
|
|
|
CVector2f x4_rangeCur;
|
|
|
|
CVector2f xc_rangeTarget;
|
|
|
|
CVector2f x14_rangeDelta;
|
|
|
|
CColor x1c_colorCur;
|
|
|
|
unkptr x20_;
|
|
|
|
unkptr x24_;
|
|
|
|
CColor x28_colorTarget;
|
|
|
|
unkptr x2c_;
|
|
|
|
unkptr x30_;
|
|
|
|
float x34_colorDelta;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CAreaFog();
|
|
|
|
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();
|
|
|
|
};
|
|
|
|
|
2022-08-16 02:14:28 +00:00
|
|
|
~CGameArea();
|
|
|
|
const CTransform4f& IGetTM() const override;
|
|
|
|
CAssetId IGetStringTableAssetId() const override;
|
2022-09-05 04:01:13 +00:00
|
|
|
uint IGetNumAttachedAreas() const override;
|
2022-08-16 02:14:28 +00:00
|
|
|
TAreaId IGetAttachedAreaId(int) const override;
|
|
|
|
bool IIsActive() const override;
|
|
|
|
CAssetId IGetAreaAssetId() const override;
|
2022-09-05 04:01:13 +00:00
|
|
|
int IGetAreaSaveId() const override;
|
2022-10-09 05:37:23 +00:00
|
|
|
rstl::pair< rstl::auto_ptr< uchar >, int > IGetScriptingMemoryAlways() const override;
|
2022-08-16 02:14:28 +00:00
|
|
|
|
2022-11-14 13:37:44 +00:00
|
|
|
const CTransform4f& GetTM() const { return xc_transform; }
|
2022-08-16 02:14:28 +00:00
|
|
|
bool IsLoaded() const { return xf0_24_postConstructed; }
|
|
|
|
bool IsActive() const { return xf0_25_active; }
|
|
|
|
|
2022-10-21 14:28:54 +00:00
|
|
|
void SetXRaySpeedAndTarget(float speed, float target);
|
|
|
|
void SetThermalSpeedAndTarget(float speed, float target);
|
|
|
|
void SetWeaponWorldLighting(float speed, float target);
|
|
|
|
|
2022-10-14 16:03:05 +00:00
|
|
|
void SetAreaAttributes(const CScriptAreaAttributes* areaAttributes);
|
2022-10-17 19:19:07 +00:00
|
|
|
bool TryTakingOutOfARAM();
|
2022-10-14 16:03:05 +00:00
|
|
|
|
2022-08-16 02:14:28 +00:00
|
|
|
private:
|
|
|
|
enum EPhase {
|
|
|
|
kP_LoadHeader,
|
|
|
|
kP_LoadSecSizes,
|
|
|
|
kP_ReserveSections,
|
|
|
|
kP_LoadDataSections,
|
|
|
|
kP_WaitForFinish,
|
|
|
|
};
|
|
|
|
TAreaId x4_selfIdx;
|
|
|
|
CAssetId x8_nameSTRG;
|
|
|
|
CTransform4f xc_transform;
|
|
|
|
CTransform4f x3c_invTransform;
|
|
|
|
CAABox x6c_aabb;
|
|
|
|
CAssetId x84_mrea;
|
2022-09-05 04:01:13 +00:00
|
|
|
int x88_areaId;
|
2022-10-09 05:37:23 +00:00
|
|
|
rstl::vector< ushort > x8c_attachedAreaIndices;
|
2022-08-16 02:14:28 +00:00
|
|
|
rstl::vector< SObjectTag > x9c_deps1;
|
|
|
|
rstl::vector< SObjectTag > xac_deps2;
|
2022-09-05 04:01:13 +00:00
|
|
|
rstl::vector< uint > xbc_layerDepOffsets;
|
2022-08-16 02:14:28 +00:00
|
|
|
rstl::vector< Dock > xcc_docks;
|
|
|
|
rstl::vector< CToken > xdc_tokens;
|
2022-09-05 04:01:13 +00:00
|
|
|
uint xec_totalResourcesSize;
|
2022-08-16 02:14:28 +00:00
|
|
|
bool xf0_24_postConstructed : 1;
|
|
|
|
bool xf0_25_active : 1;
|
|
|
|
bool xf0_26_tokensReady : 1;
|
|
|
|
bool xf0_27_loadPaused : 1;
|
|
|
|
bool xf0_28_validated : 1;
|
|
|
|
EPhase xf4_phase;
|
|
|
|
rstl::list< rstl::rc_ptr< IDvdRequest > > xf8_loadTransactions;
|
2022-10-17 19:19:07 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
enum EOcclusionState { kOS_Occluded, kOS_Visible };
|
|
|
|
|
|
|
|
struct CPostConstructed {
|
2022-10-21 14:28:54 +00:00
|
|
|
uchar x0_pad[0x10c4];
|
2022-11-07 00:20:46 +00:00
|
|
|
rstl::single_ptr< CAreaFog > x10c4_areaFog;
|
|
|
|
rstl::optional_object< void* > x10c8_sclyBuf; // was rstl::optional_object<void*>
|
2022-10-21 14:28:54 +00:00
|
|
|
u32 x10d0_sclySize;
|
|
|
|
const u8* x10d4_firstMatPtr;
|
|
|
|
const CScriptAreaAttributes* x10d8_areaAttributes;
|
2022-10-17 19:19:07 +00:00
|
|
|
EOcclusionState x10dc_occlusionState;
|
|
|
|
};
|
|
|
|
|
2022-10-21 21:40:29 +00:00
|
|
|
CAssetId GetAreaAssetId() const { return x84_mrea; }
|
2022-10-21 14:28:54 +00:00
|
|
|
const CAreaFog* GetAreaFog() const { return x12c_postConstructed->x10c4_areaFog.get(); }
|
|
|
|
CAreaFog* AreaFog() { return x12c_postConstructed->x10c4_areaFog.get(); }
|
2022-10-17 19:19:07 +00:00
|
|
|
EOcclusionState GetOcclusionState() const { return x12c_postConstructed->x10dc_occlusionState; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
uchar x110_pad[0x1c];
|
2022-11-07 00:20:46 +00:00
|
|
|
rstl::single_ptr< CPostConstructed > x12c_postConstructed;
|
2022-08-16 02:14:28 +00:00
|
|
|
};
|
|
|
|
|
2022-11-14 13:37:44 +00:00
|
|
|
// CHECK_SIZEOF(CGamearea::CAreaFog, 0x38)
|
2022-11-07 00:20:46 +00:00
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _CGAMEAREA
|