Add CStateManager::CStateManager

This commit is contained in:
Henrique Gemignani Passos Lima 2022-11-15 03:08:30 +02:00
parent 7dc8252b27
commit e1682c741f
No known key found for this signature in database
GPG Key ID: E224F951761145F8
15 changed files with 421 additions and 18 deletions

View File

@ -254,7 +254,7 @@ lbl_80023B58:
/* 80023BDC 00020B3C 7F 66 DB 78 */ mr r6, r27
/* 80023BE0 00020B40 7F E7 FB 78 */ mr r7, r31
/* 80023BE4 00020B44 7F 48 D3 78 */ mr r8, r26
/* 80023BE8 00020B48 48 02 A5 4D */ bl "__ct__13CStateManagerFRCQ24rstl26ncrc_ptr<14CScriptMailbox>RCQ24rstl25ncrc_ptr<13CMapWorldInfo>RCQ24rstl24ncrc_ptr<12CPlayerState>RCQ24rstl30ncrc_ptr<18CWorldTransManager>"
/* 80023BE8 00020B48 48 02 A5 4D */ bl "__ct__13CStateManagerFRCQ24rstl26ncrc_ptr<14CScriptMailbox>RCQ24rstl25ncrc_ptr<13CMapWorldInfo>RCQ24rstl24ncrc_ptr<12CPlayerState>RCQ24rstl30ncrc_ptr<18CWorldTransManager>RCQ24rstl28ncrc_ptr<16CWorldLayerState>"
/* 80023BEC 00020B4C 7C 79 1B 78 */ mr r25, r3
lbl_80023BF0:
/* 80023BF0 00020B50 3C 80 80 3D */ lis r4, lbl_803CCAB8@ha

View File

@ -12171,8 +12171,8 @@ lbl_8004E100:
/* 8004E12C 0004B08C 38 21 00 20 */ addi r1, r1, 0x20
/* 8004E130 0004B090 4E 80 00 20 */ blr
.global "__ct__13CStateManagerFRCQ24rstl26ncrc_ptr<14CScriptMailbox>RCQ24rstl25ncrc_ptr<13CMapWorldInfo>RCQ24rstl24ncrc_ptr<12CPlayerState>RCQ24rstl30ncrc_ptr<18CWorldTransManager>"
"__ct__13CStateManagerFRCQ24rstl26ncrc_ptr<14CScriptMailbox>RCQ24rstl25ncrc_ptr<13CMapWorldInfo>RCQ24rstl24ncrc_ptr<12CPlayerState>RCQ24rstl30ncrc_ptr<18CWorldTransManager>":
.global "__ct__13CStateManagerFRCQ24rstl26ncrc_ptr<14CScriptMailbox>RCQ24rstl25ncrc_ptr<13CMapWorldInfo>RCQ24rstl24ncrc_ptr<12CPlayerState>RCQ24rstl30ncrc_ptr<18CWorldTransManager>RCQ24rstl28ncrc_ptr<16CWorldLayerState>"
"__ct__13CStateManagerFRCQ24rstl26ncrc_ptr<14CScriptMailbox>RCQ24rstl25ncrc_ptr<13CMapWorldInfo>RCQ24rstl24ncrc_ptr<12CPlayerState>RCQ24rstl30ncrc_ptr<18CWorldTransManager>RCQ24rstl28ncrc_ptr<16CWorldLayerState>":
/* 8004E134 0004B094 94 21 FF 00 */ stwu r1, -0x100(r1)
/* 8004E138 0004B098 7C 08 02 A6 */ mflr r0
/* 8004E13C 0004B09C 39 20 00 00 */ li r9, 0

View File

@ -39,7 +39,7 @@ public:
void AddPlaneObject() override;
void AddDrawable(const void* obj, const CVector3f& pos, const CAABox& bounds, int mode,
IRenderer::EDrawableSorting sorting) override;
void SetDrawableCallback() override;
void SetDrawableCallback(TDrawableCallback cb, void* ctx) override;
void SetWorldViewpoint() override;
void SetPerspective1(float, float, float, float, float) override;
void SetPerspective2() override;

View File

@ -16,6 +16,8 @@ class CVector3f;
class IRenderer {
public:
typedef void (*TDrawableCallback)(void*, void*, int);
enum EDrawableSorting {
kDS_SortedCallback,
kDS_UnsortedCallback,
@ -39,7 +41,7 @@ public:
virtual void AddPlaneObject();
virtual void AddDrawable(const void* obj, const CVector3f& pos, const CAABox& bounds, int mode,
IRenderer::EDrawableSorting sorting);
virtual void SetDrawableCallback();
virtual void SetDrawableCallback(TDrawableCallback cb, void* ctx);
virtual void SetWorldViewpoint();
virtual void SetPerspective1(float, float, float, float, float);
virtual void SetPerspective2();

View File

@ -8,6 +8,7 @@ class CStateManager;
class CActorModelParticles {
public:
CActorModelParticles();
void Render(const CStateManager& mgr, const CActor& actor) const;
private:

View File

@ -9,6 +9,7 @@
enum EScriptObjectType {
kST_Actor = 0x00,
kST_Enemy = 0x01,
kST_Waypoint = 0x02,
kST_Door = 0x03,
kST_Trigger = 0x04,
@ -25,6 +26,7 @@ enum EScriptObjectType {
kST_SpawnPoint = 0x0F,
kST_CameraHint = 0x10,
kST_Pickup = 0x11,
kST_JumpPoint = 0x12,
kST_MemoryRelay = 0x13,
kST_RandomRelay = 0x14,
kST_Relay = 0x15,
@ -38,6 +40,7 @@ enum EScriptObjectType {
kST_ActorKeyframe = 0x1D,
kST_Water = 0x20,
kST_Warwasp = 0x21,
kST_MapStation = 0x21,
kST_SpacePirate = 0x24,
kST_FlyingPirate = 0x25,
kST_ElitePirate = 0x26,
@ -88,6 +91,7 @@ enum EScriptObjectType {
kST_Switch = 0x56,
kST_PlayerStateChange = 0x57,
kST_Thardus = 0x58,
kST_SaveStation = 0x59,
kST_WallCrawlerSwarm = 0x5A,
kST_AIJumpPoint = 0x5B,
kST_FlaahgraTentacle = 0x5C,

View File

@ -38,6 +38,8 @@ private:
class CEnvFxManager {
public:
CEnvFxManager();
static void Initialize();
void SetFxDensity(int, float);
void SetSplashRate(float f) { xb54_baseSplashRate = f; }

View File

@ -12,6 +12,7 @@ class CScriptWater;
class CFluidPlaneManager {
public:
CFluidPlaneManager();
// TODO
void CreateSplash(TUniqueId splasher, CStateManager& mgr, const CScriptWater& water,

View File

@ -10,9 +10,11 @@ class CMaterialFilter;
class CStateManager;
class CTransform4f;
class CRayCastResult;
class CPhysicsActor;
class CGameCollision {
public:
static void InitCollision();
static bool DetectStaticCollisionBoolean(const CStateManager&, const CCollisionPrimitive&,
const CTransform4f&, const CMaterialFilter&);
static bool DetectDynamicCollisionBoolean(const CCollisionPrimitive&, const CTransform4f&,

View File

@ -26,6 +26,10 @@ struct SSortedList {
CHECK_SIZEOF(SSortedList, 0x804);
class CSortedListManager {
public:
CSortedListManager();
private:
SNode x0_nodes[kMaxObjects];
SSortedList xb000_sortedLists[6];
};

View File

@ -5,19 +5,20 @@
#include "Kyoto/CObjectReference.hpp"
#include "Kyoto/CRandom16.hpp"
#include "Kyoto/Input/CFinalInput.hpp"
#include "Kyoto/Math/CVector2f.hpp"
#include "Kyoto/Math/CVector2i.hpp"
#include "Kyoto/TOneStatic.hpp"
#include "Kyoto/TToken.hpp"
#include "Kyoto/Input/CFinalInput.hpp"
#include "MetroidPrime/CEntityInfo.hpp"
#include "MetroidPrime/CObjectList.hpp"
#include "MetroidPrime/Cameras/CCameraBlurPass.hpp"
#include "MetroidPrime/Cameras/CCameraFilterPass.hpp"
#include "MetroidPrime/Enemies/EListenNoiseType.hpp"
#include "MetroidPrime/ScriptLoader.hpp"
#include "MetroidPrime/TGameTypes.hpp"
#include "MetroidPrime/Weapons/WeaponTypes.hpp"
#include "MetroidPrime/Enemies/EListenNoiseType.hpp"
#include "rstl/auto_ptr.hpp"
#include "rstl/list.hpp"
@ -80,6 +81,8 @@ struct SOnScreenTex {
CAssetId x0_id;
CVector2i x4_origin;
CVector2i xc_extent;
SOnScreenTex() : x0_id(kInvalidAssetId), x4_origin(0, 0), xc_extent(0, 0) {}
};
class CStateManager : public TOneStatic< CStateManager > {
@ -87,6 +90,8 @@ public:
typedef rstl::map< TEditorId, TUniqueId > TIdList;
typedef rstl::pair< TIdList::const_iterator, TIdList::const_iterator > TIdListResult;
enum EGameState { kGS_Running, kGS_SoftPaused, kGS_Paused };
enum ECameraFilterStage {
kCFS_Zero,
kCFS_One,
@ -100,7 +105,9 @@ public:
kCFS_Max,
};
CStateManager();
CStateManager(const rstl::ncrc_ptr< CScriptMailbox >&, const rstl::ncrc_ptr< CMapWorldInfo >&,
const rstl::ncrc_ptr< CPlayerState >&, const rstl::ncrc_ptr< CWorldTransManager >&,
const rstl::ncrc_ptr< CWorldLayerState >&);
~CStateManager();
bool RenderLast(const TUniqueId&);
@ -170,7 +177,7 @@ public:
CObjectList& ObjectListById(EGameObjectList id) { return *x808_objectLists[id]; }
const CObjectList& GetObjectListById(EGameObjectList id) const { return *x808_objectLists[id]; }
void RemoveObject(TUniqueId);
const CFinalInput& GetFinalInput() const { return xb54_finalInput; }
@ -258,6 +265,8 @@ public:
uint GetInputFrameIdx() const { return x8d4_inputFrameIdx; }
private:
enum EInitPhase { kIP_LoadWorld, kIP_LoadFirstArea, kIP_Done };
ushort x0_nextFreeIndex;
rstl::reserved_vector< ushort, 1024 > x8_objectIndexArray;
rstl::reserved_vector< rstl::auto_ptr< CObjectList >, 8 > x808_objectLists;
@ -291,11 +300,14 @@ private:
rstl::vector< CLight > x8e0_dynamicLights;
TLockedToken< CTexture > x8f0_shadowTex;
TCachedToken< CTexture > x8f0_shadowTex;
CRandom16 x8fc_random;
CRandom16* x900_random;
uchar x904_pad[0x250];
EGameState x904_gameState;
rstl::reserved_vector< FScriptLoader, int(kST_MAX) > x90c_loaderFuncs;
EInitPhase xb3c_initPhase;
uchar xb40_pad[0x14]; // rstl::set<rstl::string> xb40_uniqueInstanceNames;
CFinalInput xb54_finalInput;
rstl::reserved_vector< CCameraFilterPass, kCFS_Max > xb84_camFilterPasses;
@ -337,6 +349,8 @@ private:
bool xf94_30_fullThreat : 1;
void ClearGraveyard();
static void RendererDrawCallback(void*, void*, int);
static const bool MemoryAllocatorAllocationFailedCallback(const void*, unsigned int);
};
CHECK_SIZEOF(CStateManager, 0xf98)

View File

@ -14,7 +14,12 @@
#include "rstl/reserved_vector.hpp"
class CStateManagerContainer {
class CStateManagerContainer;
class CStateManagerContainer : public TOneStatic<CStateManagerContainer> {
private:
friend class CStateManager;
CCameraManager x0_cameraManager;
SL::CSortedListManager x3c0_sortedListManager;
CWeaponMgr xe3d8_weaponManager;

View File

@ -33,7 +33,7 @@ class CCameraManager {
static float lbl_805A6BE4;
static float lbl_805A6BE8;
public:
CCameraManager(TUniqueId curCamera);
CCameraManager(TUniqueId curCamera = kInvalidUniqueId);
void CreateStandardCameras(CStateManager& mgr);
void ThinkCameras(float dt, CStateManager& mgr);

View File

@ -8,14 +8,144 @@ class CEntityInfo;
class CTransform4f;
class CVector3f;
typedef CEntity* (*FScriptLoader)(CStateManager& mgr, CInputStream& in, int propCount,
const CEntityInfo& info);
class ScriptLoader {
public:
static CEntity* LoadActor(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadEnemy(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadWaypoint(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadDoor(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadTrigger(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadCameraHintTrigger(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadDamageableTrigger(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadSpawnPoint(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadTimer(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadCounter(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadEffect(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadPlatform(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadSound(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadGenerator(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadDock(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadActor(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadCamera(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadCameraWaypoint(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadNewIntroBoss(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadSpawnPoint(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadCameraHint(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadPickup(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadJumpPoint(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadMemoryRelay(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadRandomRelay(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadRelay(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadBeetle(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadHUDMemo(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadCameraFilterKeyframe(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadCameraBlurKeyframe(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadDamageableTrigger(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadDebris(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadCameraShaker(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadActorKeyframe(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadWater(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadWarWasp(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadMapStation(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadSpacePirate(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadFlyingPirate(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadElitePirate(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadMetroidBeta(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadChozoGhost(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadCoverPoint(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadSpiderBallWaypoint(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadBloodFlower(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadFlickerBat(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadPathCamera(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadGrapplePoint(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadPuddleSpore(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadDebugCameraWaypoint(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadSpiderBallAttractionSurface(CStateManager&, CInputStream&, int,
const CEntityInfo&);
static CEntity* LoadPuddleToadGamma(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadDistanceFog(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadFireFlea(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadMetaree(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadDockAreaChange(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadActorRotate(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadSpecialFunction(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadSpankWeed(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadParasite(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadPlayerHint(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadRipper(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadPickupGenerator(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadAIKeyframe(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadPointOfInterest(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadDrone(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadMetroid(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadDebrisExtended(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadSteam(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadRipple(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadBallTrigger(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadTargetingPoint(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadEMPulse(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadIceSheegoth(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadPlayerActor(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadFlaahgra(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadAreaAttributes(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadFishCloud(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadFishCloudModifier(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadVisorFlare(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadWorldTeleporter(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadVisorGoo(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadJellyZap(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadControllerAction(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadSwitch(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadPlayerStateChange(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadThardus(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadSaveStation(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadWallCrawlerSwarm(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadAiJumpPoint(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadFlaahgraTentacle(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadRoomAcoustics(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadColorModulate(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadThardusRockProjectile(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadMidi(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadStreamedAudio(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadRepulsor(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadGunTurret(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadFogVolume(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadBabygoth(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadEyeball(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadRadialDamage(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadCameraPitchVolume(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadEnvFxDensityController(CStateManager&, CInputStream&, int,
const CEntityInfo&);
static CEntity* LoadMagdolite(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadTeamAIMgr(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadSnakeWeedSwarm(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadActorContraption(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadOculus(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadGeemer(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadSpindleCamera(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadAtomicAlpha(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadCameraHintTrigger(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadRumbleEffect(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadAmbientAI(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadAtomicBeta(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadIceZoomer(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadPuffer(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadTryclops(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadRidley(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadSeedling(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadThermalHeatFader(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadBurrower(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadBeam(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadWorldLightFader(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadMetroidPrimeEssence(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadMetroidPrimeStage1(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadMazeNode(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadOmegaPirate(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadPhazonPool(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadPhazonHealingNodule(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadNewCameraShaker(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadShadowProjector(CStateManager&, CInputStream&, int, const CEntityInfo&);
static CEntity* LoadEnergyBall(CStateManager&, CInputStream&, int, const CEntityInfo&);
};
#endif // _SCRIPTLOADER

View File

@ -1,12 +1,15 @@
#include "MetroidPrime/CStateManager.hpp"
#include "MetroidPrime/CControlMapper.hpp"
#include "MetroidPrime/CEnvFxManager.hpp"
#include "MetroidPrime/CGameCollision.hpp"
#include "MetroidPrime/CMapWorldInfo.hpp"
#include "MetroidPrime/CRipple.hpp"
#include "MetroidPrime/CRumbleManager.hpp"
#include "MetroidPrime/CScriptMailbox.hpp"
#include "MetroidPrime/CStateManagerContainer.hpp"
#include "MetroidPrime/CWorld.hpp"
#include "MetroidPrime/GameObjectLists.hpp"
#include "MetroidPrime/Player/CPlayer.hpp"
#include "MetroidPrime/Player/CPlayerState.hpp"
#include "MetroidPrime/Player/CWorldLayerState.hpp"
@ -15,8 +18,243 @@
#include "Collision/CCollisionPrimitive.hpp"
#include "Kyoto/Graphics/CLight.hpp"
#include "MetaRender/CCubeRenderer.hpp"
CStateManager::CStateManager(const rstl::ncrc_ptr< CScriptMailbox >& mailbox,
const rstl::ncrc_ptr< CMapWorldInfo >& mwInfo,
const rstl::ncrc_ptr< CPlayerState >& playerState,
const rstl::ncrc_ptr< CWorldTransManager >& wtMgr,
const rstl::ncrc_ptr< CWorldLayerState >& layerState)
: x808_objectLists(rstl::auto_ptr< CObjectList >())
, x86c_stateManagerContainer(new CStateManagerContainer())
, x870_cameraManager(&x86c_stateManagerContainer->x0_cameraManager)
, x874_sortedListManager(&x86c_stateManagerContainer->x3c0_sortedListManager)
, x878_weaponMgr(&x86c_stateManagerContainer->xe3d8_weaponManager)
, x87c_fluidPlaneManager(&x86c_stateManagerContainer->xe3ec_fluidPlaneManager)
, x880_envFxManager(&x86c_stateManagerContainer->xe510_envFxManager)
, x884_actorModelParticles(&x86c_stateManagerContainer->xf168_actorModelParticles)
, x88c_rumbleManager(&x86c_stateManagerContainer->xf250_rumbleManager)
, x8b8_playerState(playerState)
, x8bc_mailbox(mailbox)
, x8c0_mapWorldInfo(mwInfo)
, x8c4_worldTransManager(wtMgr)
, x8c8_worldLayerState(layerState)
, x8cc_nextAreaId(0)
, x8d0_prevAreaId(kInvalidAreaId)
, x8d4_inputFrameIdx(0)
, x8d8_updateFrameIdx(0)
, x8dc_objectDrawToken(0)
, x8f0_shadowTex(gpSimplePool->GetObj("DefaultShadow"))
, x8fc_random(0)
, x900_random(nullptr)
, x904_gameState(kGS_Running)
, xb3c_initPhase(kIP_LoadWorld)
, xeec_hintIdx(-1)
, xef0_hintPeriods(0)
, xf08_pauseHudMessage(kInvalidAssetId)
, xf0c_escapeTimer(0.0f)
, xf10_escapeTotalTime(0.0f)
, xf14_curTimeMod900(0.0f)
, xf18_bossId(kInvalidUniqueId)
, xf1c_totalBossEnergy(0.0f)
, xf20_bossStringIdx(0)
, xf24_thermColdScale1(0.0f)
, xf28_thermColdScale2(0.0f)
, xf2c_viewportScale(1.f, 1.f)
, xf34_thermalFlag(kTD_Bypass)
, xf38_skipCineSpecialFunc(kInvalidUniqueId)
, xf6c_playerActorHead(kInvalidUniqueId)
, xf70_currentMaze(nullptr)
, xf74_lastTrigger(kInvalidUniqueId)
, xf76_lastRelay(kInvalidUniqueId)
, xf78_hudMessageTime(0.0f)
, xf7c_projectedShadow(nullptr)
, xf80_hudMessageFrameCount(0)
, xf84_(kInvalidAssetId)
, xf88_(kInvalidAssetId)
, xf8c_(0.0f)
, xf90_deferredTransition(kSMT_InGame)
, xf94_24_readyToRender(false)
, xf94_25_quitGame(false)
, xf94_26_generatingObject(false)
, xf94_27_inMapScreen(false)
, xf94_28_inSaveUI(false)
, xf94_29_cinematicPause(false)
, xf94_30_fullThreat(false)
{
x808_objectLists[0] = new CObjectList(kOL_All);
x808_objectLists[1] = new CActorList();
x808_objectLists[2] = new CPhysicsActorList();
x808_objectLists[3] = new CGameCameraList();
x808_objectLists[4] = new CGameLightList();
x808_objectLists[5] = new CListeningAiList();
x808_objectLists[6] = new CAiWaypointList();
x808_objectLists[7] = new CPlatformAndDoorList();
gpRender->SetDrawableCallback(RendererDrawCallback, this);
CMemory::SetOutOfMemoryCallback(MemoryAllocatorAllocationFailedCallback, this);
for (int i = x90c_loaderFuncs.size(); i < x90c_loaderFuncs.capacity(); ++i) {
x90c_loaderFuncs.push_back(nullptr);
}
x90c_loaderFuncs[kST_Trigger] = ScriptLoader::LoadTrigger;
x90c_loaderFuncs[kST_DamageableTrigger] = ScriptLoader::LoadDamageableTrigger;
x90c_loaderFuncs[kST_Actor] = ScriptLoader::LoadActor;
x90c_loaderFuncs[kST_Enemy] = ScriptLoader::LoadEnemy;
x90c_loaderFuncs[kST_Waypoint] = ScriptLoader::LoadWaypoint;
x90c_loaderFuncs[kST_Door] = ScriptLoader::LoadDoor;
x90c_loaderFuncs[kST_Effect] = ScriptLoader::LoadEffect;
x90c_loaderFuncs[kST_Timer] = ScriptLoader::LoadTimer;
x90c_loaderFuncs[kST_Counter] = ScriptLoader::LoadCounter;
x90c_loaderFuncs[kST_Sound] = ScriptLoader::LoadSound;
x90c_loaderFuncs[kST_Platform] = ScriptLoader::LoadPlatform;
x90c_loaderFuncs[kST_Generator] = ScriptLoader::LoadGenerator;
x90c_loaderFuncs[kST_Dock] = ScriptLoader::LoadDock;
x90c_loaderFuncs[kST_Camera] = ScriptLoader::LoadCamera;
x90c_loaderFuncs[kST_CameraWaypoint] = ScriptLoader::LoadCameraWaypoint;
x90c_loaderFuncs[kST_NewIntroBoss] = ScriptLoader::LoadNewIntroBoss;
x90c_loaderFuncs[kST_SpawnPoint] = ScriptLoader::LoadSpawnPoint;
x90c_loaderFuncs[kST_CameraHint] = ScriptLoader::LoadCameraHint;
x90c_loaderFuncs[kST_CameraHintTrigger] = ScriptLoader::LoadCameraHintTrigger;
x90c_loaderFuncs[kST_Pickup] = ScriptLoader::LoadPickup;
x90c_loaderFuncs[kST_Pickup] = ScriptLoader::LoadJumpPoint;
x90c_loaderFuncs[kST_MemoryRelay] = ScriptLoader::LoadMemoryRelay;
x90c_loaderFuncs[kST_RandomRelay] = ScriptLoader::LoadRandomRelay;
x90c_loaderFuncs[kST_Relay] = ScriptLoader::LoadRelay;
x90c_loaderFuncs[kST_Beetle] = ScriptLoader::LoadBeetle;
x90c_loaderFuncs[kST_HUDMemo] = ScriptLoader::LoadHUDMemo;
x90c_loaderFuncs[kST_CameraFilterKeyframe] = ScriptLoader::LoadCameraFilterKeyframe;
x90c_loaderFuncs[kST_CameraBlurKeyframe] = ScriptLoader::LoadCameraBlurKeyframe;
x90c_loaderFuncs[kST_Debris] = ScriptLoader::LoadDebris;
x90c_loaderFuncs[kST_CameraShaker] = ScriptLoader::LoadCameraShaker;
x90c_loaderFuncs[kST_ActorKeyframe] = ScriptLoader::LoadActorKeyframe;
x90c_loaderFuncs[kST_AIKeyframe] = ScriptLoader::LoadAIKeyframe;
x90c_loaderFuncs[kST_Water] = ScriptLoader::LoadWater;
x90c_loaderFuncs[kST_Steam] = ScriptLoader::LoadSteam;
x90c_loaderFuncs[kST_Ripple] = ScriptLoader::LoadRipple;
x90c_loaderFuncs[kST_Warwasp] = ScriptLoader::LoadWarWasp;
x90c_loaderFuncs[kST_MapStation] = ScriptLoader::LoadMapStation;
x90c_loaderFuncs[kST_SpacePirate] = ScriptLoader::LoadSpacePirate;
x90c_loaderFuncs[kST_CoverPoint] = ScriptLoader::LoadCoverPoint;
x90c_loaderFuncs[kST_SpiderBallWaypoint] = ScriptLoader::LoadSpiderBallWaypoint;
x90c_loaderFuncs[kST_BloodFlower] = ScriptLoader::LoadBloodFlower;
x90c_loaderFuncs[kST_PathCamera] = ScriptLoader::LoadPathCamera;
x90c_loaderFuncs[kST_GrapplePoint] = ScriptLoader::LoadGrapplePoint;
x90c_loaderFuncs[kST_FlickerBat] = ScriptLoader::LoadFlickerBat;
x90c_loaderFuncs[kST_ChozoGhost] = ScriptLoader::LoadChozoGhost;
x90c_loaderFuncs[kST_PuddleSpore] = ScriptLoader::LoadPuddleSpore;
x90c_loaderFuncs[kST_DebugCameraWaypoint] = ScriptLoader::LoadDebugCameraWaypoint;
x90c_loaderFuncs[kST_SpiderBallAttractionSurface] = ScriptLoader::LoadSpiderBallAttractionSurface;
x90c_loaderFuncs[kST_PuddleToadGamma] = ScriptLoader::LoadPuddleToadGamma;
x90c_loaderFuncs[kST_FireFlea] = ScriptLoader::LoadFireFlea;
x90c_loaderFuncs[kST_DistanceFog] = ScriptLoader::LoadDistanceFog;
x90c_loaderFuncs[kST_DockAreaChange] = ScriptLoader::LoadDockAreaChange;
x90c_loaderFuncs[kST_ActorRotate] = ScriptLoader::LoadActorRotate;
x90c_loaderFuncs[kST_SpecialFunction] = ScriptLoader::LoadSpecialFunction;
x90c_loaderFuncs[kST_Metaree] = ScriptLoader::LoadMetaree;
x90c_loaderFuncs[kST_SpankWeed] = ScriptLoader::LoadSpankWeed;
x90c_loaderFuncs[kST_Parasite] = ScriptLoader::LoadParasite;
x90c_loaderFuncs[kST_PlayerHint] = ScriptLoader::LoadPlayerHint;
x90c_loaderFuncs[kST_Ripper] = ScriptLoader::LoadRipper;
x90c_loaderFuncs[kST_PickupGenerator] = ScriptLoader::LoadPickupGenerator;
x90c_loaderFuncs[kST_PointOfInterest] = ScriptLoader::LoadPointOfInterest;
x90c_loaderFuncs[kST_Drone] = ScriptLoader::LoadDrone;
x90c_loaderFuncs[kST_Metroid] = ScriptLoader::LoadMetroid;
x90c_loaderFuncs[kST_DebrisExtended] = ScriptLoader::LoadDebrisExtended;
x90c_loaderFuncs[kST_BallTrigger] = ScriptLoader::LoadBallTrigger;
x90c_loaderFuncs[kST_TargetingPoint] = ScriptLoader::LoadTargetingPoint;
x90c_loaderFuncs[kST_EMPulse] = ScriptLoader::LoadEMPulse;
x90c_loaderFuncs[kST_IceSheegoth] = ScriptLoader::LoadIceSheegoth;
x90c_loaderFuncs[kST_PlayerActor] = ScriptLoader::LoadPlayerActor;
x90c_loaderFuncs[kST_Flaahgra] = ScriptLoader::LoadFlaahgra;
x90c_loaderFuncs[kST_AreaAttributes] = ScriptLoader::LoadAreaAttributes;
x90c_loaderFuncs[kST_FishCloud] = ScriptLoader::LoadFishCloud;
x90c_loaderFuncs[kST_FishCloudModifier] = ScriptLoader::LoadFishCloudModifier;
x90c_loaderFuncs[kST_VisorFlare] = ScriptLoader::LoadVisorFlare;
x90c_loaderFuncs[kST_WorldTeleporter] = ScriptLoader::LoadWorldTeleporter;
x90c_loaderFuncs[kST_VisorGoo] = ScriptLoader::LoadVisorGoo;
x90c_loaderFuncs[kST_JellyZap] = ScriptLoader::LoadJellyZap;
x90c_loaderFuncs[kST_ControllerAction] = ScriptLoader::LoadControllerAction;
x90c_loaderFuncs[kST_Switch] = ScriptLoader::LoadSwitch;
x90c_loaderFuncs[kST_PlayerStateChange] = ScriptLoader::LoadPlayerStateChange;
x90c_loaderFuncs[kST_Thardus] = ScriptLoader::LoadThardus;
x90c_loaderFuncs[kST_SaveStation] = ScriptLoader::LoadSaveStation;
x90c_loaderFuncs[kST_WallCrawlerSwarm] = ScriptLoader::LoadWallCrawlerSwarm;
x90c_loaderFuncs[kST_AIJumpPoint] = ScriptLoader::LoadAiJumpPoint;
x90c_loaderFuncs[kST_FlaahgraTentacle] = ScriptLoader::LoadFlaahgraTentacle;
x90c_loaderFuncs[kST_RoomAcoustics] = ScriptLoader::LoadRoomAcoustics;
x90c_loaderFuncs[kST_FlyingPirate] = ScriptLoader::LoadFlyingPirate;
x90c_loaderFuncs[kST_ColorModulate] = ScriptLoader::LoadColorModulate;
x90c_loaderFuncs[kST_ThardusRockProjectile] = ScriptLoader::LoadThardusRockProjectile;
x90c_loaderFuncs[kST_Midi] = ScriptLoader::LoadMidi;
x90c_loaderFuncs[kST_StreamedAudio] = ScriptLoader::LoadStreamedAudio; // Or music?
x90c_loaderFuncs[kST_WorldTeleporterToo] = ScriptLoader::LoadWorldTeleporter;
x90c_loaderFuncs[kST_Repulsor] = ScriptLoader::LoadRepulsor;
x90c_loaderFuncs[kST_GunTurret] = ScriptLoader::LoadGunTurret;
x90c_loaderFuncs[kST_FogVolume] = ScriptLoader::LoadFogVolume;
x90c_loaderFuncs[kST_Babygoth] = ScriptLoader::LoadBabygoth;
x90c_loaderFuncs[kST_Eyeball] = ScriptLoader::LoadEyeball;
x90c_loaderFuncs[kST_RadialDamage] = ScriptLoader::LoadRadialDamage;
x90c_loaderFuncs[kST_CameraPitchVolume] =
ScriptLoader::LoadCameraPitchVolume; // LoadScriptCameraPitchVolume
x90c_loaderFuncs[kST_ElitePirate] = ScriptLoader::LoadElitePirate;
x90c_loaderFuncs[kST_MetroidBeta] = ScriptLoader::LoadMetroidBeta;
x90c_loaderFuncs[kST_EnvFxDensityController] = ScriptLoader::LoadEnvFxDensityController;
x90c_loaderFuncs[kST_Magdolite] = ScriptLoader::LoadMagdolite;
x90c_loaderFuncs[kST_TeamAIMgr] = ScriptLoader::LoadTeamAIMgr;
x90c_loaderFuncs[kST_SnakeWeedSwarm] = ScriptLoader::LoadSnakeWeedSwarm;
x90c_loaderFuncs[kST_ActorContraption] = ScriptLoader::LoadActorContraption;
x90c_loaderFuncs[kST_AtomicAlpha] = ScriptLoader::LoadAtomicAlpha;
x90c_loaderFuncs[kST_Oculus] = ScriptLoader::LoadOculus;
x90c_loaderFuncs[kST_Geemer] = ScriptLoader::LoadGeemer;
x90c_loaderFuncs[kST_SpindleCamera] = ScriptLoader::LoadSpindleCamera;
x90c_loaderFuncs[kST_RumbleEffect] = ScriptLoader::LoadRumbleEffect;
x90c_loaderFuncs[kST_AmbientAI] = ScriptLoader::LoadAmbientAI;
x90c_loaderFuncs[0x76] = NULL;
x90c_loaderFuncs[kST_AtomicBeta] = ScriptLoader::LoadAtomicBeta;
x90c_loaderFuncs[kST_IceZoomer] = ScriptLoader::LoadIceZoomer;
x90c_loaderFuncs[kST_Puffer] = ScriptLoader::LoadPuffer;
x90c_loaderFuncs[kST_Tryclops] = ScriptLoader::LoadTryclops;
x90c_loaderFuncs[kST_Ridley] = ScriptLoader::LoadRidley;
x90c_loaderFuncs[kST_Seedling] = ScriptLoader::LoadSeedling;
x90c_loaderFuncs[kST_ThermalHeatFader] = ScriptLoader::LoadThermalHeatFader;
x90c_loaderFuncs[0x7e] = NULL;
x90c_loaderFuncs[kST_Burrower] = ScriptLoader::LoadBurrower;
x90c_loaderFuncs[kST_ScriptBeam] = ScriptLoader::LoadBeam;
x90c_loaderFuncs[0x80] = NULL;
x90c_loaderFuncs[kST_MetroidPrimeStage1] = ScriptLoader::LoadMetroidPrimeStage1;
x90c_loaderFuncs[0x1f] = NULL;
x90c_loaderFuncs[0x23] = NULL;
x90c_loaderFuncs[kST_WorldLightFader] = ScriptLoader::LoadWorldLightFader;
x90c_loaderFuncs[kST_MetroidPrimeStage2] = ScriptLoader::LoadMetroidPrimeEssence;
x90c_loaderFuncs[kST_MazeNode] = ScriptLoader::LoadMazeNode;
x90c_loaderFuncs[kST_OmegaPirate] = ScriptLoader::LoadOmegaPirate;
x90c_loaderFuncs[kST_PhazonPool] = ScriptLoader::LoadPhazonPool;
x90c_loaderFuncs[kST_PhazonHealingNodule] = ScriptLoader::LoadPhazonHealingNodule;
x90c_loaderFuncs[kST_NewCameraShaker] = ScriptLoader::LoadNewCameraShaker;
x90c_loaderFuncs[kST_ShadowProjector] = ScriptLoader::LoadShadowProjector;
x90c_loaderFuncs[kST_EnergyBall] = ScriptLoader::LoadEnergyBall;
CGameCollision::InitCollision();
CMemory::OffsetFakeStatics(x808_objectLists.size() * sizeof(CObjectList) + 0x11c);
ControlMapper::ResetCommandFilters();
x8f0_shadowTex.Lock();
}
// CStateManager::CStateManager();
CStateManager::~CStateManager() {
CMemory::OffsetFakeStatics(
-(x808_objectLists.size() * sizeof(CObjectList) + 0x11c)); // TODO what is this 11c?