mirror of https://github.com/PrimeDecomp/prime.git
parent
dc04591f0d
commit
9cece32038
|
@ -19,7 +19,7 @@ lbl_803E85E8:
|
|||
.4byte Render__13CPhysicsActorCFRC13CStateManager
|
||||
.4byte CanRenderUnsorted__6CActorCFRC13CStateManager
|
||||
.4byte CalculateRenderBounds__6CActorFv
|
||||
.4byte GetHealthInfo__12CScriptActorCFRC13CStateManager
|
||||
.4byte HealthInfo__12CScriptActorFR13CStateManager
|
||||
.4byte GetDamageVulnerability__12CScriptActorCFv
|
||||
.4byte GetDamageVulnerability__6CActorCFRC9CVector3fRC9CVector3fRC11CDamageInfo
|
||||
.4byte GetTouchBounds__12CScriptActorCFv
|
||||
|
@ -28,7 +28,7 @@ lbl_803E85E8:
|
|||
.4byte GetAimPosition__13CPhysicsActorCFRC13CStateManagerf
|
||||
.4byte GetHomingPosition__6CActorCFRC13CStateManagerf
|
||||
.4byte GetScanObjectIndicatorPosition__6CActorCFRC13CStateManager
|
||||
.4byte GetCollisionResponseType__12CScriptActorCFRC9CVector3fRC9CVector3fRC11CWeaponModei
|
||||
.4byte GetCollisionResponseType__12CScriptActorCFRC9CVector3fRC9CVector3fRC11CWeaponMode17EProjectileAttrib
|
||||
.4byte FluidFXThink__6CActorFQ26CActor11EFluidStateR12CScriptWaterR13CStateManager
|
||||
.4byte OnScanStateChange__6CActorFQ26CActor10EScanStateR13CStateManager
|
||||
.4byte GetSortingBounds__12CScriptActorCFRC13CStateManager
|
||||
|
@ -534,7 +534,7 @@ lbl_8023F978:
|
|||
/* 8023F9F0 0023C950 90 01 00 24 */ stw r0, 0x24(r1)
|
||||
/* 8023F9F4 0023C954 90 01 00 28 */ stw r0, 0x28(r1)
|
||||
/* 8023F9F8 0023C958 90 01 00 2C */ stw r0, 0x2c(r1)
|
||||
/* 8023F9FC 0023C95C 4B E3 5E B1 */ bl "__ct__12CScriptActorF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fRC10CModelDataRC6CAABoxRC13CMaterialListffRC11CHealthInfoRC20CDamageVulnerabilityRC16CActorParametersbbUibbbb"
|
||||
/* 8023F9FC 0023C95C 4B E3 5E B1 */ bl "__ct__12CScriptActorF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fRC10CModelDataRC6CAABoxRC13CMaterialListffRC11CHealthInfoRC20CDamageVulnerabilityRC16CActorParametersbbUifbbbb"
|
||||
/* 8023FA00 0023C960 3C 80 80 3F */ lis r4, lbl_803E85E8@ha
|
||||
/* 8023FA04 0023C964 3C 60 80 3D */ lis r3, lbl_803D43A0@ha
|
||||
/* 8023FA08 0023C968 38 04 85 E8 */ addi r0, r4, lbl_803E85E8@l
|
||||
|
|
|
@ -20458,7 +20458,7 @@ lbl_800D7B64:
|
|||
/* 800D7BFC 000D4B5C 91 81 00 24 */ stw r12, 0x24(r1)
|
||||
/* 800D7C00 000D4B60 91 61 00 28 */ stw r11, 0x28(r1)
|
||||
/* 800D7C04 000D4B64 90 01 00 2C */ stw r0, 0x2c(r1)
|
||||
/* 800D7C08 000D4B68 4B F9 DC A5 */ bl "__ct__12CScriptActorF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fRC10CModelDataRC6CAABoxRC13CMaterialListffRC11CHealthInfoRC20CDamageVulnerabilityRC16CActorParametersbbUibbbb"
|
||||
/* 800D7C08 000D4B68 4B F9 DC A5 */ bl "__ct__12CScriptActorF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fRC10CModelDataRC6CAABoxRC13CMaterialListffRC11CHealthInfoRC20CDamageVulnerabilityRC16CActorParametersbbUifbbbb"
|
||||
/* 800D7C0C 000D4B6C 7C 70 1B 78 */ mr r16, r3
|
||||
lbl_800D7C10:
|
||||
/* 800D7C10 000D4B70 38 61 02 64 */ addi r3, r1, 0x264
|
||||
|
|
|
@ -19,7 +19,7 @@ lbl_803DA450:
|
|||
.4byte Render__13CPhysicsActorCFRC13CStateManager
|
||||
.4byte CanRenderUnsorted__6CActorCFRC13CStateManager
|
||||
.4byte CalculateRenderBounds__6CActorFv
|
||||
.4byte GetHealthInfo__12CScriptActorCFRC13CStateManager
|
||||
.4byte HealthInfo__12CScriptActorFR13CStateManager
|
||||
.4byte GetDamageVulnerability__12CScriptActorCFv
|
||||
.4byte GetDamageVulnerability__6CActorCFRC9CVector3fRC9CVector3fRC11CDamageInfo
|
||||
.4byte GetTouchBounds__12CScriptActorCFv
|
||||
|
@ -28,7 +28,7 @@ lbl_803DA450:
|
|||
.4byte GetAimPosition__13CPhysicsActorCFRC13CStateManagerf
|
||||
.4byte GetHomingPosition__6CActorCFRC13CStateManagerf
|
||||
.4byte GetScanObjectIndicatorPosition__6CActorCFRC13CStateManager
|
||||
.4byte GetCollisionResponseType__12CScriptActorCFRC9CVector3fRC9CVector3fRC11CWeaponModei
|
||||
.4byte GetCollisionResponseType__12CScriptActorCFRC9CVector3fRC9CVector3fRC11CWeaponMode17EProjectileAttrib
|
||||
.4byte FluidFXThink__6CActorFQ26CActor11EFluidStateR12CScriptWaterR13CStateManager
|
||||
.4byte OnScanStateChange__6CActorFQ26CActor10EScanStateR13CStateManager
|
||||
.4byte GetSortingBounds__12CScriptActorCFRC13CStateManager
|
||||
|
@ -115,8 +115,8 @@ lbl_80074FC8:
|
|||
/* 80074FDC 00071F3C 38 21 00 20 */ addi r1, r1, 0x20
|
||||
/* 80074FE0 00071F40 4E 80 00 20 */ blr
|
||||
|
||||
.global GetCollisionResponseType__12CScriptActorCFRC9CVector3fRC9CVector3fRC11CWeaponModei
|
||||
GetCollisionResponseType__12CScriptActorCFRC9CVector3fRC9CVector3fRC11CWeaponModei:
|
||||
.global GetCollisionResponseType__12CScriptActorCFRC9CVector3fRC9CVector3fRC11CWeaponMode17EProjectileAttrib
|
||||
GetCollisionResponseType__12CScriptActorCFRC9CVector3fRC9CVector3fRC11CWeaponMode17EProjectileAttrib:
|
||||
/* 80074FE4 00071F44 94 21 FF E0 */ stwu r1, -0x20(r1)
|
||||
/* 80074FE8 00071F48 7C 08 02 A6 */ mflr r0
|
||||
/* 80074FEC 00071F4C 90 01 00 24 */ stw r0, 0x24(r1)
|
||||
|
@ -710,8 +710,8 @@ GetDamageVulnerability__12CScriptActorCFv:
|
|||
/* 8007583C 0007279C 38 63 02 68 */ addi r3, r3, 0x268
|
||||
/* 80075840 000727A0 4E 80 00 20 */ blr
|
||||
|
||||
.global GetHealthInfo__12CScriptActorCFRC13CStateManager
|
||||
GetHealthInfo__12CScriptActorCFRC13CStateManager:
|
||||
.global HealthInfo__12CScriptActorFR13CStateManager
|
||||
HealthInfo__12CScriptActorFR13CStateManager:
|
||||
/* 80075844 000727A4 38 63 02 60 */ addi r3, r3, 0x260
|
||||
/* 80075848 000727A8 4E 80 00 20 */ blr
|
||||
|
||||
|
@ -743,8 +743,8 @@ lbl_80075890:
|
|||
/* 800758A4 00072804 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 800758A8 00072808 4E 80 00 20 */ blr
|
||||
|
||||
.global "__ct__12CScriptActorF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fRC10CModelDataRC6CAABoxRC13CMaterialListffRC11CHealthInfoRC20CDamageVulnerabilityRC16CActorParametersbbUibbbb"
|
||||
"__ct__12CScriptActorF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fRC10CModelDataRC6CAABoxRC13CMaterialListffRC11CHealthInfoRC20CDamageVulnerabilityRC16CActorParametersbbUibbbb":
|
||||
.global "__ct__12CScriptActorF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fRC10CModelDataRC6CAABoxRC13CMaterialListffRC11CHealthInfoRC20CDamageVulnerabilityRC16CActorParametersbbUifbbbb"
|
||||
"__ct__12CScriptActorF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fRC10CModelDataRC6CAABoxRC13CMaterialListffRC11CHealthInfoRC20CDamageVulnerabilityRC16CActorParametersbbUifbbbb":
|
||||
/* 800758AC 0007280C 94 21 FF 30 */ stwu r1, -0xd0(r1)
|
||||
/* 800758B0 00072810 7C 08 02 A6 */ mflr r0
|
||||
/* 800758B4 00072814 90 01 00 D4 */ stw r0, 0xd4(r1)
|
||||
|
|
|
@ -19,7 +19,7 @@ lbl_803E4BE0:
|
|||
.4byte Render__18CScriptPlayerActorCFRC13CStateManager
|
||||
.4byte CanRenderUnsorted__6CActorCFRC13CStateManager
|
||||
.4byte CalculateRenderBounds__6CActorFv
|
||||
.4byte GetHealthInfo__12CScriptActorCFRC13CStateManager
|
||||
.4byte HealthInfo__12CScriptActorFR13CStateManager
|
||||
.4byte GetDamageVulnerability__12CScriptActorCFv
|
||||
.4byte GetDamageVulnerability__6CActorCFRC9CVector3fRC9CVector3fRC11CDamageInfo
|
||||
.4byte GetTouchBounds__12CScriptActorCFv
|
||||
|
@ -28,7 +28,7 @@ lbl_803E4BE0:
|
|||
.4byte GetAimPosition__13CPhysicsActorCFRC13CStateManagerf
|
||||
.4byte GetHomingPosition__6CActorCFRC13CStateManagerf
|
||||
.4byte GetScanObjectIndicatorPosition__6CActorCFRC13CStateManager
|
||||
.4byte GetCollisionResponseType__12CScriptActorCFRC9CVector3fRC9CVector3fRC11CWeaponModei
|
||||
.4byte GetCollisionResponseType__12CScriptActorCFRC9CVector3fRC9CVector3fRC11CWeaponMode17EProjectileAttrib
|
||||
.4byte FluidFXThink__6CActorFQ26CActor11EFluidStateR12CScriptWaterR13CStateManager
|
||||
.4byte OnScanStateChange__6CActorFQ26CActor10EScanStateR13CStateManager
|
||||
.4byte GetSortingBounds__12CScriptActorCFRC13CStateManager
|
||||
|
@ -2235,7 +2235,7 @@ lbl_801ABFAC:
|
|||
/* 801AC054 001A8FB4 90 01 00 24 */ stw r0, 0x24(r1)
|
||||
/* 801AC058 001A8FB8 90 01 00 28 */ stw r0, 0x28(r1)
|
||||
/* 801AC05C 001A8FBC 90 01 00 2C */ stw r0, 0x2c(r1)
|
||||
/* 801AC060 001A8FC0 4B EC 98 4D */ bl "__ct__12CScriptActorF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fRC10CModelDataRC6CAABoxRC13CMaterialListffRC11CHealthInfoRC20CDamageVulnerabilityRC16CActorParametersbbUibbbb"
|
||||
/* 801AC060 001A8FC0 4B EC 98 4D */ bl "__ct__12CScriptActorF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fRC10CModelDataRC6CAABoxRC13CMaterialListffRC11CHealthInfoRC20CDamageVulnerabilityRC16CActorParametersbbUifbbbb"
|
||||
/* 801AC064 001A8FC4 3C 60 80 3E */ lis r3, lbl_803E4BE0@ha
|
||||
/* 801AC068 001A8FC8 38 00 FF FF */ li r0, -1
|
||||
/* 801AC06C 001A8FCC 38 63 4B E0 */ addi r3, r3, lbl_803E4BE0@l
|
||||
|
|
|
@ -61,6 +61,8 @@ public:
|
|||
return CColor((mRgba & ~0xff) | CCast::ToUint8(a * static_cast< float >(mA)));
|
||||
}
|
||||
|
||||
bool operator==(const CColor& other) { return mRgba == other.mRgba; }
|
||||
|
||||
// TODO check
|
||||
static GXColor ToGX(uint c) { return *reinterpret_cast< const GXColor* >(&c); }
|
||||
|
||||
|
|
|
@ -105,4 +105,9 @@ private:
|
|||
};
|
||||
CHECK_SIZEOF(CModelFlags, 0x8)
|
||||
|
||||
static inline bool operator==(const CModelFlags& lhs, const CModelFlags& rhs) {
|
||||
return lhs.GetTrans() == rhs.GetTrans() && lhs.GetShaderSet() == rhs.GetShaderSet() &&
|
||||
lhs.GetOtherFlags() == rhs.GetOtherFlags() && lhs.GetColor() == rhs.GetColor();
|
||||
}
|
||||
|
||||
#endif // _CMODELFLAGS
|
||||
|
|
|
@ -147,6 +147,15 @@ inline CVector3f operator+(const CVector3f& lhs, const CVector3f& rhs) {
|
|||
float z = lhs.GetZ() + rhs.GetZ();
|
||||
return CVector3f(x, y, z);
|
||||
}
|
||||
|
||||
// TODO real?
|
||||
inline CVector3f operator*(const CVector3f& lhs, const CVector3f& rhs) {
|
||||
float x = lhs.GetX() * rhs.GetX();
|
||||
float y = lhs.GetY() * rhs.GetY();
|
||||
float z = lhs.GetZ() * rhs.GetZ();
|
||||
return CVector3f(x, y, z);
|
||||
}
|
||||
|
||||
inline CVector3f operator*(const CVector3f& vec, const float f) {
|
||||
float x = vec.GetX() * f;
|
||||
float y = vec.GetY() * f;
|
||||
|
|
|
@ -311,7 +311,11 @@ public:
|
|||
bool GetDrawShadow() const { return xe5_24_shadowEnabled; }
|
||||
bool GetShadowDirty() const { return xe5_25_shadowDirty; }
|
||||
bool GetMuted() const { return xe5_26_muted; }
|
||||
EThermalFlags GetThermalFlags() const {
|
||||
return static_cast< EThermalFlags >(xe6_27_thermalVisorFlags);
|
||||
}
|
||||
bool GetRenderParticleDatabaseInside() const { return xe6_29_renderParticleDBInside; }
|
||||
bool GetTargetable() const { return xe7_31_targetable; }
|
||||
|
||||
void SetTransformDirty(bool b) { xe4_27_notInSortedLists = b; }
|
||||
void SetTransformDirtySpare(bool b) { xe4_28_transformDirty = b; }
|
||||
|
@ -322,6 +326,7 @@ public:
|
|||
void SetShadowDirty(bool b) { xe5_25_shadowDirty = b; }
|
||||
void SetMuted(bool b) { xe5_26_muted = b; }
|
||||
void SetRenderParticleDatabaseInside(bool b) { xe6_29_renderParticleDBInside = b; }
|
||||
void SetTargetable(bool b) { xe7_31_targetable = b; }
|
||||
|
||||
void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, EMaterialTypes,
|
||||
CStateManager&);
|
||||
|
@ -334,9 +339,7 @@ public:
|
|||
void AddMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
|
||||
void AddMaterial(EMaterialTypes, EMaterialTypes, CStateManager&);
|
||||
void AddMaterial(EMaterialTypes, CStateManager&);
|
||||
void AddMaterial(const CMaterialList& l) {
|
||||
x68_material.Add(l);
|
||||
}
|
||||
void AddMaterial(const CMaterialList& l) { x68_material.Add(l); }
|
||||
|
||||
const CAABox& GetRenderBoundsCached() const { return x9c_renderBounds; }
|
||||
void SetRenderBounds(const CAABox& bounds) { x9c_renderBounds = bounds; }
|
||||
|
@ -353,7 +356,7 @@ public:
|
|||
|
||||
// HasModelParticles__6CActorCFv
|
||||
|
||||
protected:
|
||||
private:
|
||||
CTransform4f x34_transform;
|
||||
rstl::single_ptr< CModelData > x64_modelData;
|
||||
CMaterialList x68_material;
|
||||
|
@ -389,7 +392,7 @@ protected:
|
|||
uint xe5_30_renderUnsorted : 1;
|
||||
uint xe5_31_pointGeneratorParticles : 1;
|
||||
uint xe6_24_fluidCounter : 3;
|
||||
EThermalFlags xe6_27_thermalVisorFlags : 2;
|
||||
uint xe6_27_thermalVisorFlags : 2;
|
||||
uint xe6_29_renderParticleDBInside : 1;
|
||||
uint xe6_30_enablePitchBend : 1;
|
||||
uint xe6_31_targetableVisorFlags : 4;
|
||||
|
|
|
@ -172,7 +172,7 @@ enum EScriptObjectState {
|
|||
kSS_UnFrozen = 29,
|
||||
kSS_Default = 30,
|
||||
kSS_ReflectedDamage = 31,
|
||||
InheritBounds = 32
|
||||
kSS_InheritBounds = 32,
|
||||
};
|
||||
|
||||
enum EScriptObjectMessage {
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef _CCINEMATICCAMERA
|
||||
#define _CCINEMATICCAMERA
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "MetroidPrime/Cameras/CGameCamera.hpp"
|
||||
|
||||
class CCinematicCamera : public CGameCamera {
|
||||
public:
|
||||
// TODO
|
||||
|
||||
private:
|
||||
// TODO
|
||||
};
|
||||
|
||||
#endif // _CCINEMATICCAMERA
|
|
@ -0,0 +1,60 @@
|
|||
#ifndef _CSCRIPTACTOR
|
||||
#define _CSCRIPTACTOR
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "MetroidPrime/CDamageVulnerability.hpp"
|
||||
#include "MetroidPrime/CHealthInfo.hpp"
|
||||
#include "MetroidPrime/CPhysicsActor.hpp"
|
||||
|
||||
class CActorParameters;
|
||||
|
||||
class CScriptActor : public CPhysicsActor {
|
||||
public:
|
||||
CScriptActor(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
|
||||
const CTransform4f& xf, const CModelData& mData, const CAABox& aabb,
|
||||
const CMaterialList& matList, float mass, float zMomentum, const CHealthInfo& hInfo,
|
||||
const CDamageVulnerability& dVuln, const CActorParameters& actParms, bool looping,
|
||||
bool active, uint shaderIdx, float xrayAlpha, bool noThermalHotZ, bool castsShadow,
|
||||
bool scaleAdvancementDelta, bool materialFlag54);
|
||||
|
||||
// CEntity
|
||||
~CScriptActor() override;
|
||||
void Accept(IVisitor& visitor) override;
|
||||
void Think(float dt, CStateManager& mgr) override;
|
||||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override;
|
||||
|
||||
// CActor
|
||||
void PreRender(CStateManager&, const CFrustumPlanes&) override;
|
||||
CHealthInfo* HealthInfo(CStateManager&) override;
|
||||
const CDamageVulnerability* GetDamageVulnerability() const override;
|
||||
rstl::optional_object< CAABox > GetTouchBounds() const override;
|
||||
void Touch(CActor&, CStateManager&) override;
|
||||
|
||||
// CPhysicsActor
|
||||
EWeaponCollisionResponseTypes GetCollisionResponseType(const CVector3f&, const CVector3f&,
|
||||
const CWeaponMode&,
|
||||
EProjectileAttrib) const override;
|
||||
CAABox GetSortingBounds(const CStateManager&) const override;
|
||||
|
||||
private:
|
||||
CHealthInfo x258_initialHealth;
|
||||
CHealthInfo x260_currentHealth;
|
||||
CDamageVulnerability x268_damageVulnerability;
|
||||
float x2d0_fadeInTime;
|
||||
float x2d4_fadeOutTime;
|
||||
int x2d8_shaderIdx;
|
||||
float x2dc_xrayAlpha;
|
||||
TUniqueId x2e0_triggerId;
|
||||
bool x2e2_24_noThermalHotZ : 1;
|
||||
bool x2e2_25_dead : 1;
|
||||
bool x2e2_26_animating : 1;
|
||||
bool x2e2_27_xrayAlphaEnabled : 1;
|
||||
bool x2e2_28_inXrayAlpha : 1;
|
||||
bool x2e2_29_processModelFlags : 1;
|
||||
bool x2e2_30_scaleAdvancementDelta : 1;
|
||||
bool x2e2_31_materialFlag54 : 1;
|
||||
bool x2e3_24_isPlayerActor : 1;
|
||||
};
|
||||
|
||||
#endif // _CSCRIPTACTOR
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef _CSCRIPTCOLORMODULATE
|
||||
#define _CSCRIPTCOLORMODULATE
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "MetroidPrime/CEntity.hpp"
|
||||
|
||||
class CScriptColorModulate : public CEntity {
|
||||
public:
|
||||
// TODO
|
||||
|
||||
static TUniqueId FadeOutHelper(CStateManager& mgr, TUniqueId obj, float fadetime);
|
||||
static TUniqueId FadeInHelper(CStateManager& mgr, TUniqueId obj, float fadetime);
|
||||
|
||||
private:
|
||||
// TODO
|
||||
};
|
||||
|
||||
#endif // _CSCRIPTCOLORMODULATE
|
|
@ -75,12 +75,14 @@ public:
|
|||
struct const_iterator {
|
||||
node* mNode;
|
||||
const header* mHeader;
|
||||
bool x8_;
|
||||
// bool x8_;
|
||||
|
||||
// TODO why is this bool here?
|
||||
const_iterator(node* node, const header* header, bool b)
|
||||
: mNode(node), mHeader(header), x8_(b) {}
|
||||
: mNode(node), mHeader(header)/*, x8_(b)*/ {}
|
||||
|
||||
const P* operator->() const { return mNode->get_value(); }
|
||||
const P* operator*() const { return mNode->get_value(); }
|
||||
bool operator==(const const_iterator& other) const {
|
||||
return mNode == other.mNode && mHeader == other.mHeader;
|
||||
}
|
||||
|
|
|
@ -29,10 +29,10 @@ void CGameLight::SetLight(const CLight& light) {
|
|||
CLight CGameLight::GetLight() const {
|
||||
CLight ret = xec_light;
|
||||
|
||||
ret.SetPosition(x34_transform * xec_light.GetPosition());
|
||||
ret.SetPosition(GetTransform() * xec_light.GetPosition());
|
||||
|
||||
if (ret.GetType() != kLT_Point)
|
||||
ret.SetDirection(x34_transform.Rotate(xec_light.GetDirection()).AsNormalized());
|
||||
ret.SetDirection(GetTransform().Rotate(xec_light.GetDirection()).AsNormalized());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,231 @@
|
|||
#include "MetroidPrime/ScriptObjects/CScriptActor.hpp"
|
||||
|
||||
#include "MetroidPrime/CActorParameters.hpp"
|
||||
#include "MetroidPrime/CAnimData.hpp"
|
||||
#include "MetroidPrime/Cameras/CCameraManager.hpp"
|
||||
#include "MetroidPrime/Cameras/CCinematicCamera.hpp"
|
||||
#include "MetroidPrime/Player/CPlayerState.hpp"
|
||||
#include "MetroidPrime/ScriptObjects/CScriptColorModulate.hpp"
|
||||
#include "MetroidPrime/ScriptObjects/CScriptTrigger.hpp"
|
||||
|
||||
#include "Kyoto/Math/CloseEnough.hpp"
|
||||
|
||||
CScriptActor::CScriptActor(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
|
||||
const CTransform4f& xf, const CModelData& mData, const CAABox& aabb,
|
||||
const CMaterialList& matList, float mass, float zMomentum,
|
||||
const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
|
||||
const CActorParameters& actParms, bool looping, bool active,
|
||||
uint shaderIdx, float xrayAlpha, bool noThermalHotZ, bool castsShadow,
|
||||
bool scaleAdvancementDelta, bool materialFlag54)
|
||||
: CPhysicsActor(uid, active, name, info, xf, mData, matList, aabb, SMoverData(mass), actParms, 0.3f,
|
||||
0.1f)
|
||||
, x258_initialHealth(hInfo)
|
||||
, x260_currentHealth(hInfo)
|
||||
, x268_damageVulnerability(dVuln)
|
||||
, x2d0_fadeInTime(actParms.GetFadeInTime())
|
||||
, x2d4_fadeOutTime(actParms.GetFadeOutTime())
|
||||
, x2d8_shaderIdx(shaderIdx)
|
||||
, x2dc_xrayAlpha(xrayAlpha)
|
||||
, x2e0_triggerId(kInvalidUniqueId)
|
||||
, x2e2_24_noThermalHotZ(noThermalHotZ)
|
||||
, x2e2_25_dead(false)
|
||||
, x2e2_26_animating(true)
|
||||
, x2e2_27_xrayAlphaEnabled(!close_enough(xrayAlpha, 1.f))
|
||||
, x2e2_28_inXrayAlpha(false)
|
||||
, x2e2_29_processModelFlags(x2e2_27_xrayAlphaEnabled || x2e2_24_noThermalHotZ ||
|
||||
x2d8_shaderIdx != 0)
|
||||
, x2e2_30_scaleAdvancementDelta(scaleAdvancementDelta)
|
||||
, x2e2_31_materialFlag54(materialFlag54)
|
||||
, x2e3_24_isPlayerActor(false) {
|
||||
if (HasModelData()) {
|
||||
if (castsShadow) {
|
||||
CreateShadow(true);
|
||||
}
|
||||
|
||||
if (HasAnimation()) {
|
||||
ModelData()->EnableLooping(looping);
|
||||
}
|
||||
}
|
||||
|
||||
SetMomentumWR(CVector3f(0.f, 0.f, -zMomentum));
|
||||
}
|
||||
|
||||
CScriptActor::~CScriptActor() {}
|
||||
|
||||
CHealthInfo* CScriptActor::HealthInfo(CStateManager&) { return &x260_currentHealth; }
|
||||
|
||||
const CDamageVulnerability* CScriptActor::GetDamageVulnerability() const override {
|
||||
return &x268_damageVulnerability;
|
||||
}
|
||||
|
||||
void CScriptActor::Touch(CActor&, CStateManager&) {}
|
||||
|
||||
rstl::optional_object< CAABox > CScriptActor::GetTouchBounds() const {
|
||||
if (GetActive() && GetMaterialList().HasMaterial(kMT_Solid)) {
|
||||
return CPhysicsActor::GetBoundingBox();
|
||||
}
|
||||
return rstl::optional_object_null();
|
||||
}
|
||||
|
||||
void CScriptActor::Think(float dt, CStateManager& mgr) {
|
||||
if (!GetActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasAnimation()) {
|
||||
const bool timeRemaining =
|
||||
GetAnimationData()->IsAnimTimeRemaining(dt - FLT_EPSILON, rstl::string_l("Whole Body"));
|
||||
const bool loop = GetModelData()->GetIsLoop();
|
||||
|
||||
const CAdvancementDeltas deltas = CActor::UpdateAnimation(dt, mgr, true);
|
||||
|
||||
if (timeRemaining || loop) {
|
||||
x2e2_26_animating = true;
|
||||
|
||||
if (x2e2_30_scaleAdvancementDelta) {
|
||||
CVector3f rot = GetTransform().TransposeRotate(deltas.GetOffsetDelta());
|
||||
CVector3f scale = GetModelData()->GetScale();
|
||||
// CVector3f ret = GetTransform().Rotate(scale * rot);
|
||||
CVector3f ret = GetTransform().Rotate(CVector3f(
|
||||
scale.GetX() * rot.GetX(), scale.GetY() * rot.GetY(), scale.GetZ() * rot.GetZ()));
|
||||
MoveToOR(ret, dt);
|
||||
} else {
|
||||
MoveToOR(deltas.GetOffsetDelta(), dt);
|
||||
}
|
||||
|
||||
RotateToOR(deltas.GetOrientationDelta(), dt);
|
||||
}
|
||||
|
||||
if (!timeRemaining && x2e2_26_animating && !loop) {
|
||||
SendScriptMsgs(kSS_MaxReached, mgr, kSM_None);
|
||||
x2e2_26_animating = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!x2e2_25_dead && HealthInfo(mgr)->GetHP() <= 0.f) {
|
||||
x2e2_25_dead = true;
|
||||
SendScriptMsgs(kSS_Dead, mgr, kSM_None);
|
||||
}
|
||||
}
|
||||
|
||||
void CScriptActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
|
||||
switch (msg) {
|
||||
case kSM_InitializedInArea: {
|
||||
rstl::vector< SConnection >::const_iterator conn = GetConnectionList().begin();
|
||||
for (; conn != GetConnectionList().end(); ++conn) {
|
||||
if (conn->x0_state != kSS_InheritBounds || conn->x4_msg != kSM_Activate) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CStateManager::TIdListResult search = mgr.GetIdListForScript(conn->x8_objId);
|
||||
CStateManager::TIdList::const_iterator current = search.first;
|
||||
CStateManager::TIdList::const_iterator end = search.second;
|
||||
while (current != end) {
|
||||
if (TCastToConstPtr< CScriptTrigger >(mgr.GetObjectById(current->second))) {
|
||||
x2e0_triggerId = current->second;
|
||||
}
|
||||
current++;
|
||||
}
|
||||
}
|
||||
|
||||
if (x2e2_31_materialFlag54) {
|
||||
CActor::AddMaterial(kMT_Unknown54, mgr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case kSM_Reset: {
|
||||
x2e2_25_dead = false;
|
||||
x260_currentHealth = x258_initialHealth;
|
||||
break;
|
||||
}
|
||||
case kSM_Increment: {
|
||||
if (!GetActive()) {
|
||||
mgr.SendScriptMsg(this, GetUniqueId(), kSM_Activate);
|
||||
CScriptColorModulate::FadeInHelper(mgr, GetUniqueId(), x2d0_fadeInTime);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case kSM_Decrement: {
|
||||
CScriptColorModulate::FadeOutHelper(mgr, GetUniqueId(), x2d4_fadeOutTime);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
CActor::AcceptScriptMsg(msg, uid, mgr);
|
||||
}
|
||||
|
||||
void CScriptActor::PreRender(CStateManager& mgr, const CFrustumPlanes& frustum) {
|
||||
CActor::PreRender(mgr, frustum);
|
||||
|
||||
if (GetPreRenderClipped() &&
|
||||
TCastToConstPtr< CCinematicCamera >(mgr.GetCameraManager()->GetCurrentCamera(mgr))) {
|
||||
SetPreRenderClipped(false);
|
||||
}
|
||||
|
||||
if (!GetPreRenderClipped() && x2e2_29_processModelFlags) {
|
||||
if (x2e2_27_xrayAlphaEnabled) {
|
||||
CModelFlags xrayFlags = CModelFlags::AlphaBlended(x2dc_xrayAlpha);
|
||||
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::kPV_XRay) {
|
||||
SetModelFlags(xrayFlags);
|
||||
x2e2_28_inXrayAlpha = true;
|
||||
} else if (x2e2_28_inXrayAlpha) {
|
||||
x2e2_28_inXrayAlpha = false;
|
||||
if (GetModelFlags() == xrayFlags) {
|
||||
SetModelFlags(CModelFlags::Normal());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (x2e2_24_noThermalHotZ && GetThermalFlags() == kTF_Hot) {
|
||||
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::kPV_Thermal) {
|
||||
SetModelFlags(GetModelFlags().DepthCompareUpdate(false, false));
|
||||
} else {
|
||||
SetModelFlags(GetModelFlags().DepthCompareUpdate(true, true));
|
||||
}
|
||||
}
|
||||
|
||||
if (x2d8_shaderIdx != 0) {
|
||||
SetModelFlags(GetModelFlags().UseShaderSet(x2d8_shaderIdx));
|
||||
}
|
||||
}
|
||||
|
||||
if (mgr.GetObjectById(x2e0_triggerId) == nullptr) {
|
||||
x2e0_triggerId = kInvalidUniqueId;
|
||||
}
|
||||
}
|
||||
|
||||
void CScriptActor::Accept(IVisitor& visitor) override { visitor.Visit(*this); }
|
||||
|
||||
EWeaponCollisionResponseTypes CScriptActor::GetCollisionResponseType(const CVector3f& v1,
|
||||
const CVector3f& v2,
|
||||
const CWeaponMode& wMode,
|
||||
EProjectileAttrib w) const {
|
||||
|
||||
const CDamageVulnerability* dVuln = GetDamageVulnerability();
|
||||
if (dVuln->GetVulnerability(wMode, false) == kVN_Deflect) {
|
||||
const EDeflectionType deflectType = dVuln->GetDeflectionType(wMode);
|
||||
switch (deflectType) {
|
||||
case kDT_One:
|
||||
case kDT_Two:
|
||||
case kDT_Three:
|
||||
return kWCR_Unknown15;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return CActor::GetCollisionResponseType(v1, v2, wMode, w);
|
||||
}
|
||||
|
||||
CAABox CScriptActor::GetSortingBounds(const CStateManager& mgr) const {
|
||||
if (x2e0_triggerId != kInvalidUniqueId) {
|
||||
const CScriptTrigger* trigger =
|
||||
static_cast< const CScriptTrigger* >(mgr.GetObjectById(x2e0_triggerId));
|
||||
if (trigger) {
|
||||
return trigger->GetTriggerBoundsWR();
|
||||
}
|
||||
}
|
||||
|
||||
return CActor::GetSortingBounds(mgr);
|
||||
}
|
|
@ -14,7 +14,6 @@ CScriptBeam::CScriptBeam(TUniqueId uid, const rstl::string& name, const CEntityI
|
|||
, x138_damageInfo(dInfo)
|
||||
, x154_projectileId(kInvalidUniqueId) {}
|
||||
|
||||
|
||||
void CScriptBeam::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& mgr) {
|
||||
switch (msg) {
|
||||
|
||||
|
@ -22,7 +21,7 @@ void CScriptBeam::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CSt
|
|||
x154_projectileId = mgr.AllocateUniqueId();
|
||||
mgr.AddObject(new CPlasmaProjectile(
|
||||
xe8_weaponDescription, GetDebugName() + rstl::string_l("-Projectile"),
|
||||
x138_damageInfo.GetWeaponMode().GetType(), xf4_beamInfo, x34_transform, kMT_Projectile,
|
||||
x138_damageInfo.GetWeaponMode().GetType(), xf4_beamInfo, GetTransform(), kMT_Projectile,
|
||||
x138_damageInfo, x154_projectileId, GetCurrentAreaId(), GetUniqueId(),
|
||||
CPlasmaProjectile::PlayerEffectResources(), false,
|
||||
kPA_KeepInCinematic // TODO: wrong attrib definition?
|
||||
|
@ -58,7 +57,7 @@ void CScriptBeam::Think(float dt, CStateManager& mgr) {
|
|||
if (CPlasmaProjectile* proj =
|
||||
static_cast< CPlasmaProjectile* >(mgr.ObjectById(x154_projectileId))) {
|
||||
if (proj->GetActive()) {
|
||||
proj->UpdateFx(x34_transform, dt, mgr);
|
||||
proj->UpdateFx(GetTransform(), dt, mgr);
|
||||
}
|
||||
} else {
|
||||
x154_projectileId = kInvalidUniqueId;
|
||||
|
|
|
@ -7,8 +7,8 @@ CScriptGrapplePoint::CScriptGrapplePoint(TUniqueId uid, const rstl::string& name
|
|||
bool active, const CGrappleParameters& params)
|
||||
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(kMT_Orbit),
|
||||
CActorParameters::None(), kInvalidUniqueId)
|
||||
, xe8_touchBounds(x34_transform.GetTranslation() - CVector3f(0.5f, 0.5f, 0.5f),
|
||||
x34_transform.GetTranslation() + CVector3f(0.5f, 0.5f, 0.5f))
|
||||
, xe8_touchBounds(GetTranslation() - CVector3f(0.5f, 0.5f, 0.5f),
|
||||
GetTranslation() + CVector3f(0.5f, 0.5f, 0.5f))
|
||||
, x100_parameters(params) {}
|
||||
|
||||
CScriptGrapplePoint::~CScriptGrapplePoint() {}
|
||||
|
|
|
@ -21,7 +21,7 @@ void CScriptPointOfInterest::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId
|
|||
}
|
||||
|
||||
rstl::optional_object< CAABox > CScriptPointOfInterest::GetTouchBounds() const {
|
||||
return CAABox(x34_transform.GetTranslation(), x34_transform.GetTranslation());
|
||||
return CAABox(GetTranslation(), GetTranslation());
|
||||
}
|
||||
|
||||
void CScriptPointOfInterest::Render(const CStateManager&) const {}
|
||||
|
@ -31,7 +31,7 @@ void CScriptPointOfInterest::AddToRenderer(const CFrustumPlanes&, const CStateMa
|
|||
void CScriptPointOfInterest::Accept(IVisitor& visitor) { visitor.Visit(*this); }
|
||||
|
||||
void CScriptPointOfInterest::Think(float dt, CStateManager& mgr) {
|
||||
xe7_31_targetable = mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::kPV_Scan;
|
||||
SetTargetable(mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::kPV_Scan);
|
||||
CEntity::Think(dt, mgr);
|
||||
}
|
||||
|
||||
|
@ -39,9 +39,8 @@ void CScriptPointOfInterest::CalculateRenderBounds() {
|
|||
if (xe8_pointSize == 0.f) {
|
||||
CActor::CalculateRenderBounds();
|
||||
} else {
|
||||
CVector3f origin = x34_transform.GetTranslation();
|
||||
x9c_renderBounds = CAABox(
|
||||
origin - CVector3f(xe8_pointSize, xe8_pointSize, xe8_pointSize),
|
||||
origin + CVector3f(xe8_pointSize, xe8_pointSize, xe8_pointSize));
|
||||
CVector3f origin = GetTranslation();
|
||||
SetRenderBounds(CAABox(origin - CVector3f(xe8_pointSize, xe8_pointSize, xe8_pointSize),
|
||||
origin + CVector3f(xe8_pointSize, xe8_pointSize, xe8_pointSize)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
#include "MetroidPrime/CActorParameters.hpp"
|
||||
#include "MetroidPrime/CDamageVulnerability.hpp"
|
||||
#include "MetroidPrime/CStateManager.hpp"
|
||||
#include "MetroidPrime/Player/CPlayer.hpp"
|
||||
#include "MetroidPrime/Weapons/CWeapon.hpp"
|
||||
#include "MetroidPrime/Cameras/CCameraManager.hpp"
|
||||
#include "MetroidPrime/Cameras/CGameCamera.hpp"
|
||||
#include "MetroidPrime/Player/CPlayer.hpp"
|
||||
#include "MetroidPrime/Weapons/CWeapon.hpp"
|
||||
|
||||
CScriptTrigger::CScriptTrigger(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
|
||||
const CVector3f& pos, const CAABox& bounds, const CDamageInfo& dInfo,
|
||||
|
@ -132,8 +132,8 @@ void CScriptTrigger::Touch(CActor& act, CStateManager& mgr) {
|
|||
}
|
||||
|
||||
CAABox CScriptTrigger::GetTriggerBoundsWR() const {
|
||||
return CAABox(x130_bounds.GetMinPoint() + x34_transform.GetTranslation(),
|
||||
x130_bounds.GetMaxPoint() + x34_transform.GetTranslation());
|
||||
return CAABox(x130_bounds.GetMinPoint() + GetTranslation(),
|
||||
x130_bounds.GetMaxPoint() + GetTranslation());
|
||||
}
|
||||
|
||||
rstl::optional_object< CAABox > CScriptTrigger::GetTouchBounds() const override {
|
||||
|
@ -193,11 +193,12 @@ void CScriptTrigger::Think(float dt, CStateManager& mgr) override {
|
|||
void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr) {
|
||||
bool sendInside = false;
|
||||
bool sendExited = false;
|
||||
rstl::list<CObjectTracker>::iterator nextIt;
|
||||
for (rstl::list<CObjectTracker>::iterator it = xe8_inhabitants.begin(); it != xe8_inhabitants.end(); it = nextIt) {
|
||||
rstl::list< CObjectTracker >::iterator nextIt;
|
||||
for (rstl::list< CObjectTracker >::iterator it = xe8_inhabitants.begin();
|
||||
it != xe8_inhabitants.end(); it = nextIt) {
|
||||
nextIt = it;
|
||||
++nextIt;
|
||||
if (CActor* act = TCastToPtr<CActor>(mgr.ObjectById(it->GetObjectId()))) {
|
||||
if (CActor* act = TCastToPtr< CActor >(mgr.ObjectById(it->GetObjectId()))) {
|
||||
bool playerValid = true;
|
||||
if (it->GetObjectId() == mgr.GetPlayer()->GetUniqueId()) {
|
||||
if ((x12c_flags & kTFL_DetectPlayer == 0) &&
|
||||
|
@ -229,19 +230,23 @@ void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr) {
|
|||
|
||||
rstl::optional_object< CAABox > touchBounds = GetTouchBounds();
|
||||
rstl::optional_object< CAABox > actTouchBounds = act->GetTouchBounds();
|
||||
if (touchBounds.valid() && actTouchBounds.valid() && touchBounds->DoBoundsOverlap(*actTouchBounds)) {
|
||||
if (touchBounds.valid() && actTouchBounds.valid() &&
|
||||
touchBounds->DoBoundsOverlap(*actTouchBounds)) {
|
||||
sendInside = true;
|
||||
InhabitantIdle(*act, mgr);
|
||||
if (act->HealthInfo(mgr) && x100_damageInfo.GetDamage() > 0.f) {
|
||||
// mgr.ApplyDamage(GetUniqueId(), act->GetUniqueId(), GetUniqueId(), {x100_damageInfo, dt},
|
||||
// CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::skZero3f);
|
||||
// mgr.ApplyDamage(GetUniqueId(), act->GetUniqueId(), GetUniqueId(), {x100_damageInfo,
|
||||
// dt},
|
||||
// CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}),
|
||||
// zeus::skZero3f);
|
||||
}
|
||||
|
||||
if (x128_forceMagnitude > 0.f) {
|
||||
if (CPhysicsActor* pact = TCastToPtr<CPhysicsActor>(act)) {
|
||||
if (CPhysicsActor* pact = TCastToPtr< CPhysicsActor >(act)) {
|
||||
float forceMult = 1.f;
|
||||
if ((x12c_flags & kTFL_UseBooleanIntersection)) {
|
||||
forceMult = touchBounds->GetBooleanIntersection(*actTouchBounds).GetVolume() / actTouchBounds->GetVolume();
|
||||
forceMult = touchBounds->GetBooleanIntersection(*actTouchBounds).GetVolume() /
|
||||
actTouchBounds->GetVolume();
|
||||
}
|
||||
|
||||
const CVector3f force = forceMult * x11c_forceField;
|
||||
|
|
Loading…
Reference in New Issue