Initial CMetroidPrimeExo imps

This commit is contained in:
Phillip Stephens 2020-09-13 21:12:00 -07:00
parent 82c62b0312
commit 130c60ccc8
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
5 changed files with 720 additions and 4 deletions

View File

@ -3,11 +3,34 @@
#include "DataSpec/DNAMP1/ScriptObjects/MetroidPrimeStage1.hpp" #include "DataSpec/DNAMP1/ScriptObjects/MetroidPrimeStage1.hpp"
#include "Runtime/CSimplePool.hpp" #include "Runtime/CSimplePool.hpp"
#include "Runtime/CStateManager.hpp"
#include "Runtime/Collision/CCollisionActorManager.hpp"
#include "Runtime/GameGlobalObjects.hpp" #include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/Particle/CElementGen.hpp"
#include "Runtime/Particle/CParticleElectric.hpp"
#include "Runtime/Particle/CParticleSwoosh.hpp"
#include "Runtime/World/CPlayer.hpp"
#include "Runtime/World/CProjectedShadow.hpp"
#include "Runtime/World/CWorld.hpp"
#include "Runtime/World/ScriptLoader.hpp" #include "Runtime/World/ScriptLoader.hpp"
#include "Runtime/MP1/World/CMetroidPrimeRelay.hpp"
#include "TCastTo.hpp" // Generated file, do not modify include path
namespace urde::MP1 { namespace urde::MP1 {
namespace {
std::array<pas::ELocomotionType, 3> skLocomotions{{
pas::ELocomotionType::Internal10,
pas::ELocomotionType::Internal11,
pas::ELocomotionType::Internal12,
}};
std::array<pas::ETauntType, 3> skTaunts {{
pas::ETauntType::One,
pas::ETauntType::Two,
pas::ETauntType::Zero,
}};
} // namespace
SPrimeStruct2B::SPrimeStruct2B(CInputStream& in) SPrimeStruct2B::SPrimeStruct2B(CInputStream& in)
: x0_propertyCount(in.readUint32Big()) : x0_propertyCount(in.readUint32Big())
, x4_particle1(in.readUint32Big()) , x4_particle1(in.readUint32Big())
@ -107,8 +130,9 @@ SPrimeExoParameters::SPrimeExoParameters(CInputStream& in)
SPrimeExoRoomParameters::SPrimeExoRoomParameters(CInputStream& in) { SPrimeExoRoomParameters::SPrimeExoRoomParameters(CInputStream& in) {
u32 propCount = std::min(u32(14), in.readUint32Big()); u32 propCount = std::min(u32(14), in.readUint32Big());
for (u32 i = 0; i < propCount; ++i) for (u32 i = 0; i < propCount; ++i) {
x0_.push_back(in.readFloatBig()); x0_.push_back(in.readFloatBig());
}
} }
CMetroidPrimeExo::CMetroidPrimeExo( CMetroidPrimeExo::CMetroidPrimeExo(
@ -121,6 +145,432 @@ CMetroidPrimeExo::CMetroidPrimeExo(
const CCameraShakeData& shakeData6, CAssetId particle2, CAssetId swoosh, CAssetId particle3, CAssetId particle4, const CCameraShakeData& shakeData6, CAssetId particle2, CAssetId swoosh, CAssetId particle3, CAssetId particle4,
const rstl::reserved_vector<SPrimeStruct6, 4>& struct6s) const rstl::reserved_vector<SPrimeStruct6, 4>& struct6s)
: CPatterned(ECharacter::MetroidPrimeExo, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo, : CPatterned(ECharacter::MetroidPrimeExo, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
EMovementType::Flyer, EColliderType::One, EBodyType::Flyer, aParms, EKnockBackVariant::Large) {} EMovementType::Flyer, EColliderType::One, EBodyType::Flyer, aParms, EKnockBackVariant::Large)
, x588_(struct6s)
, x8e8_headUpAdditiveBodyAnimIndex(
GetModelData()->GetAnimationData()->GetCharacterInfo().GetAnimationIndex("B_headup_additive_body"sv))
, x918_(pw1)
, x930_(struct2b)
, xc48_(g_SimplePool->GetObj({FOURCC('PART'), particle1}))
, xc54_(std::make_unique<CElementGen>(xc48_, CElementGen::EModelOrientationType::Normal,
CElementGen::EOptionalSystemFlags::One))
, xc78_(wpsc1, dInfo1)
, xca0_(shakeData4)
, xd74_(wpsc2, dInfo2)
, xd9c_(shakeData5)
, xe70_(projectileInfo)
, xeb4_(dInfo3)
, xed0_(shakeData6)
, xfa4_(g_SimplePool->GetObj("Effect_Electric"sv))
, xfb0_(std::make_unique<CParticleElectric>(xfa4_))
, x1014_(g_SimplePool->GetObj({FOURCC('PART'), particle3}))
, x1024_(std::make_unique<CElementGen>(x1014_, CElementGen::EModelOrientationType::Normal,
CElementGen::EOptionalSystemFlags::One))
, x108c_(shakeData1)
, x1294_(shakeData2)
, x1368_(shakeData3)
, x143c_(std::make_unique<CProjectedShadow>(128, 128, true)) {}
void CMetroidPrimeExo::PreThink(float dt, CStateManager& mgr) { CPatterned::PreThink(dt, mgr); }
void CMetroidPrimeExo::Think(float dt, CStateManager& mgr) {
CPatterned::Think(dt, mgr);
if (!GetActive()) {
return;
}
sub80276528(mgr);
sub80278bd8(dt, mgr);
sub80278f14(dt, mgr);
sub8027894c(mgr);
sub80278044(dt, mgr);
sub8027815c(dt);
sub80277570(dt, mgr);
sub80274e6c(dt, mgr);
sub80273910(dt, mgr);
sub80273f10(mgr);
sub80277e30(mgr);
sub80275780(dt);
sub80276164(dt, mgr);
sub80275e54(dt, mgr);
}
void CMetroidPrimeExo::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId other, CStateManager& mgr) {
switch (msg) {
case EScriptObjectMessage::Activate:
x56c_collisionManager->SetActive(mgr, true);
break;
case EScriptObjectMessage::Deactivate:
x56c_collisionManager->SetActive(mgr, false);
break;
case EScriptObjectMessage::Start:
x1444_24_ = true;
break;
case EScriptObjectMessage::Touched:
sub80278cc8(other, mgr);
break;
case EScriptObjectMessage::Registered:
CreateShadow(false);
x450_bodyController->Activate(mgr);
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Internal11);
sub8027903c();
SetupCollisionActorManager(mgr);
sub80278800(mgr, true);
sub80278b60(mgr, true);
sub80277c04(mgr);
sub802740fc(mgr);
sub802755ac(mgr, true);
sub8027447c(mgr);
mgr.GetPlayer().SetFrozenTimeoutBias(2.f);
break;
case EScriptObjectMessage::Deleted: {
x56c_collisionManager->Destroy(mgr);
sub80277b74(mgr);
sub802740cc(mgr);
sub8027444c(mgr);
mgr.GetPlayer().SetFrozenTimeoutBias(0.f);
break;
}
case EScriptObjectMessage::InitializedInArea:
RemoveMaterial(EMaterialTypes::AIBlock, mgr);
UpdateRelay(mgr, GetAreaIdAlways());
if (GetAreaIdAlways() == mgr.GetWorld()->GetCurrentAreaId()) {
sub802766e4(EScriptObjectState::MaxReached, mgr);
}
if (xfb0_) {
xfb0_->SetParticleEmission(false);
}
break;
case EScriptObjectMessage::Damage:
sub8027827c(other, mgr);
[[fallthrough]];
case EScriptObjectMessage::InvulnDamage:
return;
default:
break;
}
CPatterned::AcceptScriptMsg(msg, other, mgr);
}
void CMetroidPrimeExo::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) {
CPatterned::PreRender(mgr, frustum);
}
void CMetroidPrimeExo::AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr) {
CPatterned::AddToRenderer(frustum, mgr);
}
void CMetroidPrimeExo::Render(CStateManager& mgr) { CPatterned::Render(mgr); }
bool CMetroidPrimeExo::CanRenderUnsorted(const CStateManager& mgr) const { return CPatterned::CanRenderUnsorted(mgr); }
void CMetroidPrimeExo::Touch(CActor& act, CStateManager& mgr) { CPatterned::Touch(act, mgr); }
void CMetroidPrimeExo::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) {
CPatterned::DoUserAnimEvent(mgr, node, type, dt);
}
void CMetroidPrimeExo::SelectTarget(CStateManager& mgr, EStateMsg msg, float arg) { CAi::SelectTarget(mgr, msg, arg); }
void CMetroidPrimeExo::Run(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Run(mgr, msg, arg); }
void CMetroidPrimeExo::Attack(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Attack(mgr, msg, arg); }
void CMetroidPrimeExo::TurnAround(CStateManager& mgr, EStateMsg msg, float arg) { CAi::TurnAround(mgr, msg, arg); }
void CMetroidPrimeExo::Active(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Active(mgr, msg, arg); }
void CMetroidPrimeExo::InActive(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
x1084_ = x1080_;
x1084_ = 0.2f;
x400_24_hitByPlayerProjectile = false;
x914_24_ = true;
sub80278800(mgr, false);
x1078_ = 1;
GetBodyController()->SetLocomotionType(skLocomotions[x1078_]);
sub802788c8(mgr);
x3b4_speed = 1.f;
} else if (msg == EStateMsg::Update) {
if (x107c_ >= 0.f || x1084_ >= 0.f) {
return;
}
x107c_ = x1080_;
x1084_ = 0.90000004f;
x1078_ = mgr.GetActiveRandom()->Next() % 3;
GetBodyController()->SetLocomotionType(skLocomotions[x1078_]);
} else if (msg == EStateMsg::Deactivate) {
x914_24_ = false;
x1444_24_ = false;
sub80278800(mgr, true);
sub802738d4(mgr);
x1084_ = x1080_;
x1088_ = x1084_;
mgr.SetBossParams(GetUniqueId(), 2860.0, 91);
}
}
void CMetroidPrimeExo::CoverAttack(CStateManager& mgr, EStateMsg msg, float arg) { CAi::CoverAttack(mgr, msg, arg); }
void CMetroidPrimeExo::Crouch(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Crouch(mgr, msg, arg); }
void CMetroidPrimeExo::Taunt(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Taunt(mgr, msg, arg); }
void CMetroidPrimeExo::Suck(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Suck(mgr, msg, arg); }
void CMetroidPrimeExo::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float arg) {
CAi::ProjectileAttack(mgr, msg, arg);
}
void CMetroidPrimeExo::Flinch(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Flinch(mgr, msg, arg); }
void CMetroidPrimeExo::Dodge(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Dodge(mgr, msg, arg); }
void CMetroidPrimeExo::Retreat(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Retreat(mgr, msg, arg); }
void CMetroidPrimeExo::Cover(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Cover(mgr, msg, arg); }
void CMetroidPrimeExo::Approach(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Approach(mgr, msg, arg); }
void CMetroidPrimeExo::Enraged(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Enraged(mgr, msg, arg); }
void CMetroidPrimeExo::SpecialAttack(CStateManager& mgr, EStateMsg msg, float arg) {
CAi::SpecialAttack(mgr, msg, arg);
}
void CMetroidPrimeExo::Growth(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Growth(mgr, msg, arg); }
void CMetroidPrimeExo::Land(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Land(mgr, msg, arg); }
bool CMetroidPrimeExo::TooClose(CStateManager& mgr, float arg) { return CPatterned::TooClose(mgr, arg); }
bool CMetroidPrimeExo::InMaxRange(CStateManager& mgr, float arg) { return CPatterned::InMaxRange(mgr, arg); }
bool CMetroidPrimeExo::PlayerSpot(CStateManager& mgr, float arg) { return CPatterned::PlayerSpot(mgr, arg); }
bool CMetroidPrimeExo::ShouldAttack(CStateManager& mgr, float arg) { return CAi::ShouldAttack(mgr, arg); }
bool CMetroidPrimeExo::ShouldDoubleSnap(CStateManager& mgr, float arg) { return CAi::ShouldDoubleSnap(mgr, arg); }
bool CMetroidPrimeExo::InPosition(CStateManager& mgr, float arg) { return CPatterned::InPosition(mgr, arg); }
bool CMetroidPrimeExo::ShouldTurn(CStateManager& mgr, float arg) { return CAi::ShouldTurn(mgr, arg); }
bool CMetroidPrimeExo::CoverCheck(CStateManager& mgr, float arg) { return CAi::CoverCheck(mgr, arg); }
bool CMetroidPrimeExo::CoverFind(CStateManager& mgr, float arg) { return CAi::CoverFind(mgr, arg); }
bool CMetroidPrimeExo::CoveringFire(CStateManager& mgr, float arg) { return CAi::CoveringFire(mgr, arg); }
bool CMetroidPrimeExo::AggressionCheck(CStateManager& mgr, float arg) { return CAi::AggressionCheck(mgr, arg); }
bool CMetroidPrimeExo::AttackOver(CStateManager& mgr, float arg) { return CAi::AttackOver(mgr, arg); }
bool CMetroidPrimeExo::ShouldFire(CStateManager& mgr, float arg) { return CAi::ShouldFire(mgr, arg); }
bool CMetroidPrimeExo::ShouldFlinch(CStateManager& mgr, float arg) { return CAi::ShouldFlinch(mgr, arg); }
bool CMetroidPrimeExo::ShouldRetreat(CStateManager& mgr, float arg) { return CAi::ShouldRetreat(mgr, arg); }
bool CMetroidPrimeExo::ShouldCrouch(CStateManager& mgr, float arg) { return CAi::ShouldCrouch(mgr, arg); }
bool CMetroidPrimeExo::ShouldMove(CStateManager& mgr, float arg) { return CAi::ShouldMove(mgr, arg); }
bool CMetroidPrimeExo::AIStage(CStateManager& mgr, float arg) { return CAi::AIStage(mgr, arg); }
bool CMetroidPrimeExo::StartAttack(CStateManager& mgr, float arg) { return CAi::StartAttack(mgr, arg); }
bool CMetroidPrimeExo::ShouldSpecialAttack(CStateManager& mgr, float arg) { return CAi::ShouldSpecialAttack(mgr, arg); }
bool CMetroidPrimeExo::CodeTrigger(CStateManager& mgr, float arg) { return CPatterned::CodeTrigger(mgr, arg); }
CProjectileInfo* CMetroidPrimeExo::GetProjectileInfo() { return CPatterned::GetProjectileInfo(); }
void CMetroidPrimeExo::sub802738d4(CStateManager& mgr) {}
void CMetroidPrimeExo::sub80273910(float dt, CStateManager& mgr) {}
void CMetroidPrimeExo::sub80273c78(CStateManager& mgr) {}
void CMetroidPrimeExo::sub80273d38(CStateManager& mgr) {}
void CMetroidPrimeExo::sub80273f10(CStateManager& mgr) {}
void CMetroidPrimeExo::sub80274054(CStateManager& mgr) {}
void CMetroidPrimeExo::sub802740cc(CStateManager& mgr) {}
void CMetroidPrimeExo::sub802740fc(CStateManager& mgr) {}
void CMetroidPrimeExo::sub802743e0(CStateManager& mgr, u32) {}
void CMetroidPrimeExo::sub8027444c(CStateManager& mgr) {}
void CMetroidPrimeExo::sub8027447c(CStateManager& mgr) {}
void CMetroidPrimeExo::sub802747b8(float f1, CStateManager& mgr, const zeus::CVector3f& vec) {}
void CMetroidPrimeExo::sub80274e6c(float f1, CStateManager& mgr) {}
void CMetroidPrimeExo::sub802755ac(CStateManager& mgr, bool b1) {}
void CMetroidPrimeExo::sub802756b8(CStateManager& mgr) {}
void CMetroidPrimeExo::sub8027571c(CStateManager& mgr) {}
void CMetroidPrimeExo::sub80275780(float mgr) {}
void CMetroidPrimeExo::sub80275800(CStateManager& mgr) {}
void CMetroidPrimeExo::sub802759a8(CStateManager& mgr, int w1, int w2) {}
void CMetroidPrimeExo::sub80275b04(CStateManager& mgr, int w1, int w2) {}
void CMetroidPrimeExo::sub80275b68() {}
void CMetroidPrimeExo::sub80275c60(CStateManager& mgr, int w1, int w2) {}
void CMetroidPrimeExo::sub80275d68(int w1) {}
void CMetroidPrimeExo::sub80275e14(int w1) {}
void CMetroidPrimeExo::sub80275e34(int w1) {}
void CMetroidPrimeExo::sub80275e54(float f1, CStateManager& mgr) {}
void CMetroidPrimeExo::sub80276164(float f1, CStateManager& mgr) {}
void CMetroidPrimeExo::sub80276204(CStateManager& mgr, bool b1) {}
void CMetroidPrimeExo::sub8027639c(CStateManager& mgr, bool b1) {}
void CMetroidPrimeExo::sub802764c4(CStateManager& mgr, TUniqueId uid, TAreaId aid) {}
void CMetroidPrimeExo::sub80276528(CStateManager& mgr) {
if (!x914_24_) {
return;
}
TAreaId curAreaId = mgr.GetWorld()->GetCurrentAreaId();
if (GetAreaIdAlways() == curAreaId) {
if (x1444_25_) {
x1444_25_ = false;
sub802766e4(EScriptObjectState::MaxReached, mgr);
}
} else if (!sub80276ec0(mgr, curAreaId)) {
x1444_25_ = true;
} else {
sub802764c4(mgr, GetUniqueId(), curAreaId);
for (size_t i = 0; i < x56c_collisionManager->GetNumCollisionActors(); ++i) {
sub802764c4(mgr, x56c_collisionManager->GetCollisionDescFromIndex(i).GetCollisionActorId(), curAreaId);
}
for (const auto& uid : xb24_) {
sub802764c4(mgr, uid, curAreaId);
}
sub802764c4(mgr, xeac_, curAreaId);
UpdateRelay(mgr, GetAreaIdAlways());
sub802766e4(EScriptObjectState::MaxReached, mgr);
}
}
void CMetroidPrimeExo::sub802766e4(EScriptObjectState state, CStateManager& mgr) {}
void CMetroidPrimeExo::sub80276754(CStateManager& mgr) {}
zeus::CVector3f CMetroidPrimeExo::sub802769e0(CStateManager& mgr, bool b1) { return zeus::CVector3f(); }
zeus::CVector3f CMetroidPrimeExo::sub80276b3c(CStateManager& mgr, EScriptObjectState state, EScriptObjectMessage msg) {
return zeus::CVector3f();
}
void CMetroidPrimeExo::UpdateRelay(CStateManager& mgr, TAreaId areaId) {
if (x568_relayId != kInvalidUniqueId) {
if (TCastToPtr<CMetroidPrimeRelay> relay = mgr.ObjectById(x568_relayId)) {
relay->SetMetroidPrimeExoId(kInvalidUniqueId);
}
}
TEditorId tmpEditorId = kInvalidEditorId;
for (auto* ent : mgr.GetAllObjectList()) {
if (TCastToPtr<CMetroidPrimeRelay> relay = ent) {
if (relay->GetActive() && relay->GetAreaIdAlways() == areaId) {
tmpEditorId = relay->GetEditorId();
}
}
}
x568_relayId = kInvalidUniqueId;
if (tmpEditorId == kInvalidEditorId) {
TUniqueId uid = mgr.GetIdForScript(tmpEditorId);
x568_relayId = uid;
if (TCastToPtr<CMetroidPrimeRelay> relay = mgr.ObjectById(uid)) {
relay->SetMetroidPrimeExoId(GetUniqueId());
}
}
sub80276754(mgr);
sub80273d38(mgr);
}
bool CMetroidPrimeExo::sub80276ec0(CStateManager& mgr, TAreaId w2) {
TEditorId tmpId = kInvalidEditorId;
for (const auto* ent : mgr.GetAllObjectList()) {
if (TCastToConstPtr<CMetroidPrimeRelay> relay = ent) {
tmpId = relay->GetEditorId();
}
}
return tmpId != kInvalidEditorId;
}
void CMetroidPrimeExo::sub80277224(float f1, CStateManager& mgr) {}
void CMetroidPrimeExo::sub80277380(CStateManager& mgr, bool b1) {}
void CMetroidPrimeExo::sub80277570(float f1, CStateManager& mgr) {}
zeus::CVector3f CMetroidPrimeExo::sub80778c4(CStateManager& mgr) { return zeus::CVector3f(); }
void CMetroidPrimeExo::sub80277b74(CStateManager& mgr) {}
void CMetroidPrimeExo::sub80277c04(CStateManager& mgr) {}
void CMetroidPrimeExo::sub80277e30(CStateManager& mgr) {}
void CMetroidPrimeExo::sub80278044(float f1, CStateManager& mgr) {}
void CMetroidPrimeExo::sub802781e0(const zeus::CColor& col) {}
void CMetroidPrimeExo::sub8027815c(float f1) {}
void CMetroidPrimeExo::sub8027827c(TUniqueId uid, CStateManager& mgr) {}
void CMetroidPrimeExo::sub80278508(CStateManager& mgr, int w1, bool b1) {}
void CMetroidPrimeExo::sub802786fc(CStateManager& mgr) {}
void CMetroidPrimeExo::sub80278800(CStateManager& mgr, bool b) {}
void CMetroidPrimeExo::sub802788c8(CStateManager& mgr) {}
void CMetroidPrimeExo::sub8027894c(CStateManager& mgr) {}
void CMetroidPrimeExo::sub80278b60(CStateManager& mgr, bool b1) {}
void CMetroidPrimeExo::sub80278bd8(float f1, CStateManager& mgr) {}
void CMetroidPrimeExo::sub80278cc8(TUniqueId uid, CStateManager& mgr) {}
void CMetroidPrimeExo::sub80278f14(float, CStateManager& mgr) {}
void CMetroidPrimeExo::sub8027903c() {}
void CMetroidPrimeExo::sub8027c22c(int w1, int w2) {}
void CMetroidPrimeExo::SetupCollisionActorManager(CStateManager& mgr) {}
} // namespace urde::MP1 } // namespace urde::MP1

View File

@ -1,17 +1,23 @@
#pragma once #pragma once
#include "Runtime/rstl.hpp"
#include "Runtime/Camera/CCameraShakeData.hpp" #include "Runtime/Camera/CCameraShakeData.hpp"
#include "Runtime/Character/CBoneTracking.hpp"
#include "Runtime/MP1/World/CMetroidPrimeProjectile.hpp" #include "Runtime/MP1/World/CMetroidPrimeProjectile.hpp"
#include "Runtime/Weapon/CBeamInfo.hpp" #include "Runtime/Weapon/CBeamInfo.hpp"
#include "Runtime/Weapon/CProjectileInfo.hpp"
#include "Runtime/World/CActorParameters.hpp" #include "Runtime/World/CActorParameters.hpp"
#include "Runtime/World/CPatterned.hpp" #include "Runtime/World/CPatterned.hpp"
#include "Runtime/World/CPatternedInfo.hpp" #include "Runtime/World/CPatternedInfo.hpp"
#include "Runtime/rstl.hpp"
#include <zeus/CColor.hpp> #include <zeus/CColor.hpp>
namespace urde { namespace urde {
class CCameraShakeData; class CCameraShakeData;
class CCollisionActorManager;
class CGenDescription;
class CElementGen;
class CProjectedShadow;
namespace MP1 { namespace MP1 {
@ -95,6 +101,168 @@ struct SPrimeExoRoomParameters {
}; };
class CMetroidPrimeExo : public CPatterned { class CMetroidPrimeExo : public CPatterned {
TUniqueId x568_relayId = kInvalidUniqueId;
std::unique_ptr<CCollisionActorManager> x56c_collisionManager;
u32 x570_ = 1;
u32 x574_ = 1;
u32 x578_ = 0;
u32 x57c_ = 0;
u32 x580_ = 0;
bool x584_ = false;
rstl::reserved_vector<SPrimeStruct6, 4> x588_;
rstl::reserved_vector<CBoneTracking, 6> x76c_;
CHealthInfo x8c0_ = CHealthInfo(150.f, 0.f);
float x8c8_ = 0.f;
TUniqueId x8cc_ = kInvalidUniqueId;
u32 x8d0_ = 3;
u32 x8d4_ = 3;
zeus::CColor x8d8_ = zeus::skBlack;
zeus::CColor x8dc_ = zeus::skBlack;
zeus::CColor x8e0_ = zeus::skBlack;
float x8e4_ = 0.f;
s32 x8e8_headUpAdditiveBodyAnimIndex;
float x8ec_ = 0.f;
float x8f0_ = 0.f;
bool x8f4_24_ : 1 = false;
bool x8f4_25_ : 1 = false;
bool x8f4_26_ : 1 = false;
bool x8f4_27_ : 1 = false;
bool x8f4_28_ : 1 = false;
zeus::CVector3f x8f8_;
zeus::CVector3f x904_;
float x910_ = 5.f;
bool x914_24_ : 1 = false;
s32 x918_ = -1;
s32 x91c_;
float x920_ = 0.f;
float x924_ = 4.f;
float x928_ = 5.f;
u32 x92c_ = 0;
SPrimeStruct2B x930_;
// x96c_;
rstl::reserved_vector<CProjectileInfo, 4> xa80_;
rstl::reserved_vector<TUniqueId, 4> xb24_;
rstl::reserved_vector<SPrimeStruct5, 4> xb30_;
// xbc4_;
TLockedToken<CGenDescription> xc48_;
std::unique_ptr<CElementGen> xc54_;
s32 xc58_ = -1;
float xc5c_ = 0.f;
zeus::CVector3f xc60_;
zeus::CVector3f xc6c_;
CProjectileInfo xc78_;
CCameraShakeData xca0_;
CProjectileInfo xd74_;
CCameraShakeData xd9c_;
SPrimeProjectileInfo xe70_;
TUniqueId xeac_ = kInvalidUniqueId;
u32 xeb0_ = 0;
CDamageInfo xeb4_;
CCameraShakeData xed0_;
TLockedToken<CElectricDescription> xfa4_;
std::unique_ptr<CParticleElectric> xfb0_;
float xfb4_ = 0.f;
float xfb8_ = 0.f;
CSfxHandle xfbc_;
bool xfc0_ = false;
bool xfc1_ = false;
u32 xfc4_ = 0;
u32 xfd8_ = 0;
u32 xfec_ = 0;
u32 x1000_ = 0;
TToken<CGenDescription> x1014_;
TToken<CGenDescription> x101c_;
std::unique_ptr<CElementGen> x1024_;
rstl::reserved_vector<float, 2> x102c_;
rstl::reserved_vector<float, 2> x1038_;
TUniqueId x1044_ = kInvalidUniqueId;
TUniqueId x1046_ = kInvalidUniqueId;
float x1048_ = 0.f;
float x104c_ = 75.f;
float x1050_ = 0.f;
bool x1054_24_ : 1 = false;
bool x1054_25_ : 1 = false;
bool x1054_26_ : 1 = false;
bool x1054_27_ : 1 = false;
u32 x1058_ = 0;
u32 x106c_ = 0;
float x1074_ = 0.f;
s32 x1078_ = -1;
float x107c_ = 0.f;
float x1080_;
float x1084_ = 0.f;
float x1088_ = 0.f;
CCameraShakeData x108c_;
u32 x1160_ = 0;
u32 x1258_ = 0;
CCameraShakeData x1294_;
CCameraShakeData x1368_;
std::unique_ptr<CProjectedShadow> x143c_;
s32 x1440_ = 0;
bool x1444_24_ : 1 = false;
bool x1444_25_ : 1 = false;
void sub802738d4(CStateManager& mgr);
void sub80273910(float dt, CStateManager& mgr);
void sub80273c78(CStateManager& mgr);
void sub80273d38(CStateManager& mgr);
void sub80273f10(CStateManager& mgr);
void sub80274054(CStateManager& mgr);
void sub802740cc(CStateManager& mgr);
void sub802740fc(CStateManager& mgr);
void sub802743e0(CStateManager& mgr, u32);
void sub8027444c(CStateManager& mgr);
void sub8027447c(CStateManager& mgr);
void sub802747b8(float f1, CStateManager& mgr, const zeus::CVector3f& vec);
void sub80274e6c(float f1, CStateManager& mgr);
void sub802755ac(CStateManager& mgr, bool b1);
void sub802756b8(CStateManager& mgr);
void sub8027571c(CStateManager& mgr);
void sub80275780(float mgr);
void sub80275800(CStateManager& mgr);
void sub802759a8(CStateManager& mgr, int w1, int w2);
void sub80275b04(CStateManager& mgr, int w1, int w2);
void sub80275b68();
void sub80275c60(CStateManager& mgr, int w1, int w2);
void sub80275d68(int w1);
void sub80275e14(int w1);
void sub80275e34(int w1);
void sub80275e54(float f1, CStateManager& mgr);
void sub80276164(float f1, CStateManager& mgr);
void sub80276204(CStateManager& mgr, bool b1);
void sub8027639c(CStateManager& mgr, bool b1);
void sub802764c4(CStateManager& mgr, TUniqueId uid, TAreaId aid);
void sub80276528(CStateManager& mgr);
void sub802766e4(EScriptObjectState state, CStateManager& mgr);
void sub80276754(CStateManager& mgr);
zeus::CVector3f sub802769e0(CStateManager& mgr, bool b1);
zeus::CVector3f sub80276b3c(CStateManager& mgr, EScriptObjectState state, EScriptObjectMessage msg);
void UpdateRelay(CStateManager& mgr, TAreaId areaId);
bool sub80276ec0(CStateManager& mgr, TAreaId w2);
void sub80277224(float f1, CStateManager& mgr);
void sub80277380(CStateManager& mgr, bool b1);
void sub80277570(float f1, CStateManager& mgr);
zeus::CVector3f sub80778c4(CStateManager& mgr);
void sub80277b74(CStateManager& mgr);
void sub80277c04(CStateManager& mgr);
void sub80277e30(CStateManager& mgr);
void sub80278044(float f1, CStateManager& mgr);
void sub802781e0(const zeus::CColor& col);
void sub8027815c(float f1);
void sub8027827c(TUniqueId uid, CStateManager& mgr);
void sub80278508(CStateManager& mgr, int w1, bool b1);
void sub802786fc(CStateManager& mgr);
void sub80278800(CStateManager& mgr, bool b);
void sub802788c8(CStateManager& mgr);
void sub8027894c(CStateManager& mgr);
void sub80278b60(CStateManager& mgr, bool b1);
void sub80278bd8(float f1, CStateManager& mgr);
void sub80278cc8(TUniqueId uid, CStateManager& mgr);
void sub80278f14(float, CStateManager& mgr);
void sub8027903c();
void sub8027c22c(int w1, int w2);
void SetupCollisionActorManager(CStateManager& mgr);
public: public:
DEFINE_PATTERNED(MetroidPrimeExo); DEFINE_PATTERNED(MetroidPrimeExo);
CMetroidPrimeExo(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, CMetroidPrimeExo(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
@ -106,6 +274,58 @@ public:
const CCameraShakeData& shakeData5, const SPrimeProjectileInfo& projectileInfo, const CCameraShakeData& shakeData5, const SPrimeProjectileInfo& projectileInfo,
const CDamageInfo& dInfo3, const CCameraShakeData& shakeData6, CAssetId particle2, CAssetId swoosh, const CDamageInfo& dInfo3, const CCameraShakeData& shakeData6, CAssetId particle2, CAssetId swoosh,
CAssetId particle3, CAssetId particle4, const rstl::reserved_vector<SPrimeStruct6, 4>& struct6s); CAssetId particle3, CAssetId particle4, const rstl::reserved_vector<SPrimeStruct6, 4>& struct6s);
void PreThink(float dt, CStateManager& mgr) override;
void Think(float dt, CStateManager& mgr) override;
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId other, CStateManager& mgr) override;
void PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) override;
void AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr) override;
void Render(CStateManager &mgr) override;
bool CanRenderUnsorted(const CStateManager &mgr) const override;
void Touch(CActor &act, CStateManager &mgr) override;
void DoUserAnimEvent(CStateManager &mgr, const CInt32POINode &node, EUserEventType type, float dt) override;
void SelectTarget(CStateManager& mgr, EStateMsg msg, float arg) override;
void Run(CStateManager& mgr, EStateMsg msg, float arg) override;
void Attack(CStateManager& mgr, EStateMsg msg, float arg) override;
void TurnAround(CStateManager& mgr, EStateMsg msg, float arg) override;
void Active(CStateManager& mgr, EStateMsg msg, float arg) override;
void InActive(CStateManager& mgr, EStateMsg msg, float arg) override;
void CoverAttack(CStateManager& mgr, EStateMsg msg, float arg) override;
void Crouch(CStateManager& mgr, EStateMsg msg, float arg) override;
void Taunt(CStateManager& mgr, EStateMsg msg, float arg) override;
void Suck(CStateManager& mgr, EStateMsg msg, float arg) override;
void ProjectileAttack(CStateManager& mgr, EStateMsg msg, float arg) override;
void Flinch(CStateManager& mgr, EStateMsg msg, float arg) override;
void Dodge(CStateManager& mgr, EStateMsg msg, float arg) override;
void Retreat(CStateManager& mgr, EStateMsg msg, float arg) override;
void Cover(CStateManager& mgr, EStateMsg msg, float arg) override;
void Approach(CStateManager& mgr, EStateMsg msg, float arg) override;
void Enraged(CStateManager& mgr, EStateMsg msg, float arg) override;
void SpecialAttack(CStateManager& mgr, EStateMsg msg, float arg) override;
void Growth(CStateManager& mgr, EStateMsg msg, float arg) override;
void Land(CStateManager& mgr, EStateMsg msg, float arg) override;
bool TooClose(CStateManager& mgr,float arg) override;
bool InMaxRange(CStateManager& mgr,float arg) override;
bool PlayerSpot(CStateManager& mgr,float arg) override;
bool ShouldAttack(CStateManager& mgr,float arg) override;
bool ShouldDoubleSnap(CStateManager& mgr,float arg) override;
bool InPosition(CStateManager& mgr,float arg) override;
bool ShouldTurn(CStateManager& mgr,float arg) override;
bool CoverCheck(CStateManager& mgr,float arg) override;
bool CoverFind(CStateManager& mgr,float arg) override;
bool CoveringFire(CStateManager& mgr,float arg) override;
bool AggressionCheck(CStateManager& mgr,float arg) override;
bool AttackOver(CStateManager& mgr,float arg) override;
bool ShouldFire(CStateManager& mgr,float arg) override;
bool ShouldFlinch(CStateManager& mgr,float arg) override;
bool ShouldRetreat(CStateManager& mgr,float arg) override;
bool ShouldCrouch(CStateManager& mgr,float arg) override;
bool ShouldMove(CStateManager& mgr,float arg) override;
bool AIStage(CStateManager& mgr,float arg) override;
bool StartAttack(CStateManager& mgr,float arg) override;
bool ShouldSpecialAttack(CStateManager& mgr,float arg) override;
bool CodeTrigger(CStateManager& mgr,float arg) override;
CProjectileInfo* GetProjectileInfo() override;
}; };
} // namespace MP1 } // namespace MP1

View File

@ -1,5 +1,7 @@
#include "Runtime/MP1/World/CMetroidPrimeRelay.hpp" #include "Runtime/MP1/World/CMetroidPrimeRelay.hpp"
#include "Runtime/MP1/World/CMetroidPrimeExo.hpp"
#include "Runtime/CStateManager.hpp"
#include "TCastTo.hpp" // Generated file, do not modify include path #include "TCastTo.hpp" // Generated file, do not modify include path
namespace urde::MP1 { namespace urde::MP1 {
@ -27,5 +29,44 @@ CMetroidPrimeRelay::CMetroidPrimeRelay(TUniqueId uid, std::string_view name, con
, xcb8_roomParms(std::move(roomParms)) {} , xcb8_roomParms(std::move(roomParms)) {}
void CMetroidPrimeRelay::Accept(IVisitor& visitor) { visitor.Visit(this); } void CMetroidPrimeRelay::Accept(IVisitor& visitor) { visitor.Visit(this); }
void CMetroidPrimeRelay::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& mgr) {
if (x34_mpUid == objId) {
ForwardMessageToMetroidPrimeExo(msg, mgr);
}
if (msg == EScriptObjectMessage::InitializedInArea) {
GetOrBuildMetroidPrimeExo(mgr);
}
}
void CMetroidPrimeRelay::ForwardMessageToMetroidPrimeExo(EScriptObjectMessage msg, CStateManager& mgr) {
if (auto* exo = CPatterned::CastTo<CMetroidPrimeExo>(mgr.ObjectById(x34_mpUid))) {
mgr.SendScriptMsg(exo, GetUniqueId(), msg);
}
}
void CMetroidPrimeRelay::GetOrBuildMetroidPrimeExo(CStateManager& mgr) {
if (!GetActive()) {
return;
}
for (const auto& act : mgr.GetPhysicsActorObjectList()) {
if (CPatterned::CastTo<CMetroidPrimeExo>(act) != nullptr) {
return;
}
}
const auto& animParms = x74_parms.x4_patternedInfo.GetAnimationParameters();
CModelData mData(
CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), x68_scale, animParms.GetInitialAnimation(), true));
auto* exo = new CMetroidPrimeExo(
mgr.AllocateUniqueId(), "Metroid Prime! (Stage 1)"sv, CEntityInfo(GetAreaId(), NullConnectionList), x38_xf, std::move(mData),
x74_parms.x4_patternedInfo, x74_parms.x13c_actorParms, x74_parms.x1a4_, x74_parms.x1a8_, x74_parms.x27c_,
x74_parms.x350_, x74_parms.x424_, x74_parms.x460_particle1, x74_parms.x464_, x74_parms.x708_wpsc1,
x74_parms.x70c_dInfo1, x74_parms.x728_shakeData1, x74_parms.x7fc_wpsc2, x74_parms.x800_dInfo2,
x74_parms.x81c_shakeData2, x74_parms.x8f0_, x74_parms.x92c_, x74_parms.x948_, x74_parms.xa1c_particle2,
x74_parms.xa20_swoosh, x74_parms.xa24_particle3, x74_parms.xa28_particle4, x74_parms.xa2c_);
mgr.AddObject(exo);
mgr.SendScriptMsg(exo, kInvalidUniqueId, EScriptObjectMessage::InitializedInArea);
}
} // namespace urde::MP1 } // namespace urde::MP1

View File

@ -28,13 +28,17 @@ class CMetroidPrimeRelay : public CEntity {
u32 xcb4_w5; u32 xcb4_w5;
rstl::reserved_vector<SPrimeExoRoomParameters, 4> xcb8_roomParms; rstl::reserved_vector<SPrimeExoRoomParameters, 4> xcb8_roomParms;
void ForwardMessageToMetroidPrimeExo(EScriptObjectMessage msg, CStateManager& mgr);
void GetOrBuildMetroidPrimeExo(CStateManager& mgr);
public: public:
CMetroidPrimeRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info, bool active, CMetroidPrimeRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info, bool active,
const zeus::CTransform& xf, const zeus::CVector3f& scale, SPrimeExoParameters&& parms, float f1, const zeus::CTransform& xf, const zeus::CVector3f& scale, SPrimeExoParameters&& parms, float f1,
float f2, float f3, u32 w1, bool b1, u32 w2, const CHealthInfo& hInfo1, const CHealthInfo& hInfo2, float f2, float f3, u32 w1, bool b1, u32 w2, const CHealthInfo& hInfo1, const CHealthInfo& hInfo2,
u32 w3, u32 w4, u32 w5, rstl::reserved_vector<SPrimeExoRoomParameters, 4>&& roomParms); u32 w3, u32 w4, u32 w5, rstl::reserved_vector<SPrimeExoRoomParameters, 4>&& roomParms);
void Accept(IVisitor& visitor) override; void Accept(IVisitor& visitor) override;
TUniqueId GetMetroidPrimeExoId() const { return x34_mpUid; } void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr) override;
[[nodiscard]] TUniqueId GetMetroidPrimeExoId() const { return x34_mpUid; }
void SetMetroidPrimeExoId(TUniqueId uid) { x34_mpUid = uid; }
}; };
} // namespace urde::MP1 } // namespace urde::MP1

View File

@ -605,6 +605,7 @@ public:
bool AttachActorToPlayer(TUniqueId id, bool disableGun); bool AttachActorToPlayer(TUniqueId id, bool disableGun);
TUniqueId GetAttachedActor() const { return x26c_attachedActor; } TUniqueId GetAttachedActor() const { return x26c_attachedActor; }
float GetAttachedActorStruggle() const { return xa28_attachedActorStruggle; } float GetAttachedActorStruggle() const { return xa28_attachedActorStruggle; }
void SetFrozenTimeoutBias(float bias) { x758_frozenTimeoutBias = bias; }
float GetDistanceUnderWater() const { return x828_distanceUnderWater; } float GetDistanceUnderWater() const { return x828_distanceUnderWater; }
TUniqueId GetRidingPlatformId() const { return x82e_ridingPlatform; } TUniqueId GetRidingPlatformId() const { return x82e_ridingPlatform; }
const zeus::CVector3f& GetLastVelocity() const { return x794_lastVelocity; } const zeus::CVector3f& GetLastVelocity() const { return x794_lastVelocity; }