More MetroidPrimeExo imps

This commit is contained in:
Phillip Stephens 2020-09-27 11:10:07 -07:00
parent bc60a237a4
commit 0903b478f6
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
7 changed files with 609 additions and 147 deletions

View File

@ -7,14 +7,17 @@
#include "Runtime/Collision/CCollisionActor.hpp"
#include "Runtime/Collision/CCollisionActorManager.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/MP1/World/CEnergyBall.hpp"
#include "Runtime/MP1/World/CMetroidPrimeRelay.hpp"
#include "Runtime/Particle/CElementGen.hpp"
#include "Runtime/Particle/CParticleElectric.hpp"
#include "Runtime/Particle/CParticleSwoosh.hpp"
#include "Runtime/Weapon/CPlasmaProjectile.hpp"
#include "Runtime/World/CHUDBillboardEffect.hpp"
#include "Runtime/World/CPlayer.hpp"
#include "Runtime/World/CProjectedShadow.hpp"
#include "Runtime/World/CWorld.hpp"
#include "Runtime/World/CScriptWaypoint.hpp"
#include "Runtime/World/CWorld.hpp"
#include "Runtime/World/ScriptLoader.hpp"
#include "TCastTo.hpp" // Generated file, do not modify include path
@ -60,6 +63,41 @@ std::array<float, 4> skHealthConstants{{
880.f,
0.f,
}};
std::array<std::string_view, 2> skDrillerLocators{{"driller_LCTR1"sv, "driller_LCTR2"sv}};
std::array<std::string_view, 4> skEffectNames{{
"Flame_Head"sv,
"Flame_HeadLockOn"sv,
"Flame_Lshoulder"sv,
"Flame_Rshoulder"sv,
}};
std::array<std::string_view, 6> skBoneTrackingNames{{
"L_eye_1"sv,
"L_eye_2"sv,
"L_eye_3"sv,
"R_eye_1"sv,
"R_eye_2"sv,
"R_eye_3"sv,
}};
std::array<std::array<s32, 3>, 14> skSomeMeleeValues{{
{{3, 3, 3}},
{{-1, -1, -1}},
{{2, 2, 2}},
{{5, 5, 5}},
{{8, 8, 8}},
{{11, 11, 11}},
{{1, 1, 1}},
{{4, 4, 4}},
{{7, 7, 7}},
{{4, 7, 1}},
{{-1, -1, -1}},
{{-1, 2, -1}},
{{-1, -1, -1}},
{{0, 0, 0}},
}};
} // namespace
SPrimeStruct2B::SPrimeStruct2B(CInputStream& in)
: x0_propertyCount(in.readUint32Big())
@ -73,26 +111,19 @@ SPrimeStruct2B::SPrimeStruct2B(CInputStream& in)
, x38_(CSfxManager::TranslateSFXID(u16(in.readUint32Big())))
, x3a_(CSfxManager::TranslateSFXID(u16(in.readUint32Big()))) {}
SPrimeStruct5::SPrimeStruct5(CInputStream& in)
: x0_propertyCount(in.readUint32Big())
, x4_(in.readUint32Big())
, x8_(in.readUint32Big())
, xc_(in.readUint32Big())
, x10_(in.readUint32Big())
, x14_(in.readUint32Big())
, x18_(in.readUint32Big())
, x1c_(in.readUint32Big())
, x20_(in.readUint32Big()) {}
SPrimeStruct4::SPrimeStruct4(CInputStream& in)
: x0_beamInfo(in), x44_(in.readUint32Big()), x48_dInfo1(in), x64_struct5(in), x88_(in.readFloatBig()), x8c_dInfo2(in) {}
: x0_beamInfo(in)
, x44_(in.readUint32Big())
, x48_dInfo1(in)
, x64_struct5(CPlasmaProjectile::LoadPlayerEffectResources(in))
, x88_(in.readFloatBig())
, x8c_dInfo2(in) {}
SPrimeStruct6::SPrimeStruct6(CInputStream& in)
: x0_propertyCount(in.readUint32Big())
, x4_damageVulnerability(in)
, x6c_color(zeus::CColor::ReadRGBABig(in))
, x70_(in.readUint32Big())
, x74_(in.readUint32Big()) {}
: x0_propertyCount(in.readUint32Big()), x4_damageVulnerability(in), x6c_color(zeus::CColor::ReadRGBABig(in)) {
x70_[0] = in.readUint32Big();
x70_[1] = in.readUint32Big();
}
static CPatternedInfo LoadPatternedInfo(CInputStream& in) {
std::pair<bool, u32> pcount = CPatternedInfo::HasCorrectParameterCount(in);
@ -195,14 +226,49 @@ CMetroidPrimeExo::CMetroidPrimeExo(
, xfa4_(g_SimplePool->GetObj("Effect_Electric"sv))
, xfb0_(std::make_unique<CParticleElectric>(xfa4_))
, x1014_(g_SimplePool->GetObj({FOURCC('PART'), particle3}))
, x101c_(g_SimplePool->GetObj({FOURCC('PART'), particle4}))
, 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)) {}
, x143c_(std::make_unique<CProjectedShadow>(128, 128, true)) {
for (const auto& struct4 : struct4s) {
x96c_.emplace_back(struct4.x0_beamInfo);
xb30_.emplace_back(struct4.x64_struct5);
xbc4_.emplace_back(struct4.x8c_dInfo2);
xa80_.emplace_back(struct4.x44_, struct4.x48_dInfo1);
}
void CMetroidPrimeExo::PreThink(float dt, CStateManager& mgr) { CPatterned::PreThink(dt, mgr); }
x460_knockBackController.SetAutoResetImpulse(false);
x460_knockBackController.SetEnableBurn(false);
x460_knockBackController.SetEnableFreeze(false);
xc78_.Token().Lock();
xd74_.Token().Lock();
xfc4_.emplace_back(g_SimplePool->GetObj({FOURCC('PART'), particle2}));
xfc4_.emplace_back(g_SimplePool->GetObj({FOURCC('PART'), particle2}));
xfd8_.emplace_back(g_SimplePool->GetObj({FOURCC('SWSH'), swoosh}));
xfd8_.emplace_back(g_SimplePool->GetObj({FOURCC('SWSH'), swoosh}));
xfec_.emplace_back(std::make_unique<CElementGen>(xfc4_[0]));
xfec_.emplace_back(std::make_unique<CElementGen>(xfc4_[1]));
x1000_.emplace_back(std::make_unique<CParticleSwoosh>(xfd8_[0], 0));
x1000_.emplace_back(std::make_unique<CParticleSwoosh>(xfd8_[1], 0));
x102c_.push_back(0.3f);
x102c_.push_back(0.3f);
x1038_.push_back(0.f);
x1038_.push_back(2.f);
}
void CMetroidPrimeExo::PreThink(float dt, CStateManager& mgr) {
CPatterned::PreThink(dt, mgr);
if (!GetActive()) {
return;
}
if (TCastToConstPtr<CCollisionActor> colAct = mgr.GetObjectById(x8cc_headColActor)) {
x8c8_ = colAct->GetHealthInfo(mgr)->GetHP();
}
}
void CMetroidPrimeExo::Think(float dt, CStateManager& mgr) {
CPatterned::Think(dt, mgr);
@ -213,15 +279,15 @@ void CMetroidPrimeExo::Think(float dt, CStateManager& mgr) {
UpdateBoneTracking(dt, mgr);
UpdateCollision(dt, mgr);
UpdateHealthInfo(mgr);
sub80278044(dt, mgr);
sub8027815c(dt);
UpdateColorChange(dt, mgr);
UpdateHeadAnimation(dt);
sub80277570(dt, mgr);
sub80274e6c(dt, mgr);
sub80273910(dt, mgr);
sub80273f10(mgr);
sub80277e30(mgr);
UpdateEnergyBalls(dt, mgr);
UpdatePhysicsDummy(mgr);
UpdateContactDamage(mgr);
UpdateTimers(dt);
sub80276164(dt, mgr);
UpdateSfxEmitter(dt, mgr);
sub80275e54(dt, mgr);
}
@ -243,14 +309,14 @@ void CMetroidPrimeExo::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId other
CreateShadow(false);
x450_bodyController->Activate(mgr);
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Internal11);
sub8027903c();
SetupBoneTracking();
SetupCollisionActorManager(mgr);
sub80278800(mgr, true);
SetEyesParticleEffectState(mgr, true);
SetBoneTrackingTarget(mgr, true);
sub80277c04(mgr);
sub802740fc(mgr);
CreatePhysicsDummy(mgr);
sub802755ac(mgr, true);
sub8027447c(mgr);
CreateHUDBillBoard(mgr);
mgr.GetPlayer().SetFrozenTimeoutBias(2.f);
break;
case EScriptObjectMessage::Deleted: {
@ -301,7 +367,16 @@ void CMetroidPrimeExo::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode&
CPatterned::DoUserAnimEvent(mgr, node, type, dt);
}
void CMetroidPrimeExo::SelectTarget(CStateManager& mgr, EStateMsg msg, float arg) { CAi::SelectTarget(mgr, msg, arg); }
void CMetroidPrimeExo::SelectTarget(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
x330_stateMachineState.SetDelay(zeus::clamp(0.2f, x924_ * 0.25f, 1.f));
} else if (msg == EStateMsg::Update) {
sub80275800(mgr);
} else if (msg == EStateMsg::Deactivate) {
sub802738d4(mgr);
x1054_27_ = false;
}
}
void CMetroidPrimeExo::Run(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Run(mgr, msg, arg); }
@ -309,7 +384,22 @@ void CMetroidPrimeExo::Attack(CStateManager& mgr, EStateMsg msg, float arg) { CA
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::Active(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
x107c_ = 0.4f;
x1084_ = x1088_;
x3b4_speed = 1.f;
} else if (msg == EStateMsg::Update) {
if ((x570_ != 0 || x1078_ != 1) && x107c_ < 0.f && x1084_ < 0.f) {
x107c_ = x1080_;
x1084_ = 0.9f;
x1078_ = mgr.GetActiveRandom()->Next() % 3;
GetBodyController()->SetLocomotionType(skLocomotions[x1078_]);
}
} else if (msg == EStateMsg::Deactivate) {
x1088_ = 0.2f;
}
}
void CMetroidPrimeExo::InActive(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
@ -317,7 +407,7 @@ void CMetroidPrimeExo::InActive(CStateManager& mgr, EStateMsg msg, float arg) {
x1084_ = 0.2f;
x400_24_hitByPlayerProjectile = false;
x914_24_ = true;
sub80278800(mgr, false);
SetEyesParticleEffectState(mgr, false);
x1078_ = 1;
GetBodyController()->SetLocomotionType(skLocomotions[x1078_]);
UpdateHeadHealthInfo(mgr);
@ -332,7 +422,7 @@ void CMetroidPrimeExo::InActive(CStateManager& mgr, EStateMsg msg, float arg) {
} else if (msg == EStateMsg::Deactivate) {
x914_24_ = false;
x1444_24_ = false;
sub80278800(mgr, true);
SetEyesParticleEffectState(mgr, true);
sub802738d4(mgr);
x1084_ = x1080_;
x1088_ = x1084_;
@ -340,11 +430,37 @@ void CMetroidPrimeExo::InActive(CStateManager& mgr, EStateMsg msg, float arg) {
}
}
void CMetroidPrimeExo::CoverAttack(CStateManager& mgr, EStateMsg msg, float arg) { CAi::CoverAttack(mgr, msg, arg); }
void CMetroidPrimeExo::CoverAttack(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready;
x92c_ = 1;
x1084_ = 1.9666666f;
} else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, sub80275e34(0));
zeus::CVector3f vec = (16.f * GetTransform().frontVector()) + GetTranslation();
zeus::CVector3f direction = (vec - GetTranslation()).normalized();
if (direction.dot(mgr.GetPlayer().GetTranslation() - GetTranslation()) < 15.f) {
sub802747b8(arg, mgr, vec - mgr.GetPlayer().GetTranslation());
}
} else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady;
x92c_ = 0;
x1078_ = 1;
GetBodyController()->SetLocomotionType(skLocomotions[x1078_]);
}
}
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::Taunt(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready;
} else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::Taunt, &CPatterned::TryTaunt, u32(skTaunts[x1078_]));
} else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady;
}
}
void CMetroidPrimeExo::Suck(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Suck(mgr, msg, arg); }
@ -360,7 +476,21 @@ void CMetroidPrimeExo::Retreat(CStateManager& mgr, EStateMsg msg, float arg) { C
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::Approach(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready;
} else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, 2);
if (x32c_animState == EAnimState::Repeat) {
x1078_ = 1;
GetBodyController()->SetLocomotionType(skLocomotions[x1078_]);
}
} else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady;
SetEyesParticleEffectState(mgr, true);
sub802738d4(mgr);
}
}
void CMetroidPrimeExo::Enraged(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Enraged(mgr, msg, arg); }
@ -370,7 +500,13 @@ void CMetroidPrimeExo::SpecialAttack(CStateManager& mgr, EStateMsg msg, float ar
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); }
void CMetroidPrimeExo::Land(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg != EStateMsg::Activate) {
return;
}
sub802786fc(mgr);
}
bool CMetroidPrimeExo::TooClose(CStateManager& mgr, float arg) { return CPatterned::TooClose(mgr, arg); }
@ -429,29 +565,79 @@ bool CMetroidPrimeExo::CodeTrigger(CStateManager& mgr, float arg) { return x1444
CProjectileInfo* CMetroidPrimeExo::GetProjectileInfo() { return CPatterned::GetProjectileInfo(); }
void CMetroidPrimeExo::sub802738d4(CStateManager& mgr) {}
void CMetroidPrimeExo::sub802738d4(CStateManager& mgr) { x920_ = mgr.GetActiveRandom()->Range(x924_, x928_); }
void CMetroidPrimeExo::sub80273910(float dt, CStateManager& mgr) {}
void CMetroidPrimeExo::UpdateEnergyBalls(float dt, CStateManager& mgr) {
if (x1074_ > 0.f) {
for (size_t i = 0; i < x106c_energyBallIds.size(); ++i) {
if (auto* ball = CPatterned::CastTo<CEnergyBall>(mgr.ObjectById(x106c_energyBallIds[i]))) {
ball->SetTransform(GetLctrTransform(skDrillerLocators[i]));
}
}
} else {
x106c_energyBallIds.clear();
}
}
void CMetroidPrimeExo::sub80273c78(CStateManager& mgr) {}
u32 CMetroidPrimeExo::CountEnergyBalls(CStateManager& mgr) {
u32 ret = 0;
for (auto* ent : mgr.GetPhysicsActorObjectList()) {
if (CPatterned::CastTo<CEnergyBall>(ent) != nullptr && ent->GetAreaIdAlways() == GetAreaIdAlways() &&
ent->GetActive()) {
++ret;
}
}
return ret;
}
void CMetroidPrimeExo::sub80273d38(CStateManager& mgr) {}
void CMetroidPrimeExo::sub80273f10(CStateManager& mgr) {}
void CMetroidPrimeExo::UpdatePhysicsDummy(CStateManager& mgr) {
if (TCastToPtr<CPhysicsActor> physAct = mgr.ObjectById(xeac_)) {
zeus::CVector3f diffVec = mgr.GetPlayer().GetTranslation() - GetTranslation();
if (!zeus::close_enough(diffVec, zeus::skZero3f)) {
zeus::CVector3f direction = diffVec.normalized();
physAct->SetVelocityWR((direction.dot(GetTransform().frontVector()) > 0.f ? 7.5f : 5.f) * direction);
} else {
physAct->SetVelocityWR(zeus::skZero3f);
}
}
}
void CMetroidPrimeExo::sub80274054(CStateManager& mgr) {}
void CMetroidPrimeExo::sub802740cc(CStateManager& mgr) {}
void CMetroidPrimeExo::sub802740fc(CStateManager& mgr) {}
void CMetroidPrimeExo::CreatePhysicsDummy(CStateManager& mgr) {
xeac_ = mgr.AllocateUniqueId();
mgr.AddObject(new CPhysicsDummy(xeac_, true, ""sv, CEntityInfo(GetAreaIdAlways(), NullConnectionList)));
}
void CMetroidPrimeExo::sub802743e0(CStateManager& mgr, u32) {}
void CMetroidPrimeExo::sub8027444c(CStateManager& mgr) {}
void CMetroidPrimeExo::sub8027447c(CStateManager& mgr) {}
void CMetroidPrimeExo::CreateHUDBillBoard(CStateManager& mgr) {
x1044_billboardId = mgr.AllocateUniqueId();
mgr.AddObject(new CHUDBillboardEffect(
{x101c_}, std::nullopt, x1044_billboardId, true, ""sv, CHUDBillboardEffect::GetNearClipDistance(mgr),
CHUDBillboardEffect::GetScaleForPOV(mgr), zeus::skWhite, zeus::skOne3f, zeus::skZero3f));
}
void CMetroidPrimeExo::sub802747b8(float f1, CStateManager& mgr, const zeus::CVector3f& vec) {}
void CMetroidPrimeExo::sub802747b8(float f1, CStateManager& mgr, const zeus::CVector3f& vec) {
if (mgr.RayCollideWorld(mgr.GetPlayer().GetTranslation(), mgr.GetPlayer().GetTranslation() + (0.2f * zeus::skDown),
CMaterialFilter::MakeInclude({EMaterialTypes::Floor, EMaterialTypes::Platform}), this)) {
mgr.GetPlayer().ApplyImpulseWR((10.f * mgr.GetPlayer().GetMass()) * zeus::skUp, {});
mgr.GetPlayer().SetMoveState(CPlayer::EPlayerMovementState::ApplyJump, mgr);
}
zeus::CVector3f vec2 = vec;
vec2.z() = 0.f;
if (!zeus::close_enough(vec2, zeus::skZero3f)) {
mgr.GetPlayer().ApplyImpulseWR(f1 * (mgr.GetPlayer().GetMass() * (120.f * vec2)), {});
mgr.GetPlayer().UseCollisionImpulses();
mgr.GetPlayer().SetAccelerationChangeTimer(2.f * f1);
}
}
void CMetroidPrimeExo::sub80274e6c(float f1, CStateManager& mgr) {}
@ -471,29 +657,160 @@ void CMetroidPrimeExo::UpdateTimers(float dt) {
x920_ -= dt;
}
void CMetroidPrimeExo::sub80275800(CStateManager& mgr) {}
void CMetroidPrimeExo::sub80275800(CStateManager& mgr) {
TUniqueId tmpId = sub802769e0(mgr, true);
void CMetroidPrimeExo::sub802759a8(CStateManager& mgr, int w1, int w2) {}
u32 flags = 0x13c1;
if (tmpId != kInvalidUniqueId) {
if (TCastToConstPtr<CScriptWaypoint> wp = mgr.GetObjectById(tmpId)) {
if ((wp->GetTranslation() - GetTranslation()).magSquared() > 16.f) {
flags = 0x13c3;
}
}
}
void CMetroidPrimeExo::sub80275b04(CStateManager& mgr, int w1, int w2) {}
if (!x1054_27_) {
flags |= 0x400;
}
if (GetTransform().frontVector().dot(mgr.GetPlayer().GetTranslation() - GetTranslation()) > 30.f) {
flags |= 0x3c;
}
if (CountEnergyBalls(mgr) == 0) {
flags |= 0x2000;
}
if (sub80277224(7.f, mgr)) {
flags |= 0x800;
}
sub802759a8(mgr, flags);
}
void CMetroidPrimeExo::sub802759a8(CStateManager& mgr, u32 w1) {
float dVar7 = 0.f;
const auto& parms = x1160_[x570_];
for (size_t i = 0; i < 14; ++i) {
if (((w1 & (1 << i)) != 0u) && sub80275d68(i)) {
dVar7 += sub80275b04(parms, i);
}
}
if (dVar7 > 30000.0f) {
sub80275b68();
}
dVar7 = mgr.GetActiveRandom()->Range(0.f, dVar7);
x1254_ = -1;
float dVar5 = 0.f;
for (size_t i = 0; i < 13; ++i) {
if (((w1 & (1 << i)) != 0u) && sub80275d68(i)) {
float dVar6 = sub80275b04(parms, i);
if ((dVar5 < dVar7) && (dVar7 < (dVar5 + dVar6))) {
x1254_ = i;
x1258_[i] += 3.f;
}
dVar5 += dVar6;
}
}
}
float CMetroidPrimeExo::sub80275b04(const SPrimeExoRoomParameters& roomParms, int w2) {
float dVar1 = 0.f;
if (zeus::close_enough(0.f, x1258_[w2])) {
const float tmpFloat = roomParms.GetFloatValue(w2);
dVar1 = (tmpFloat * tmpFloat) / x1258_[w2];
}
return dVar1;
}
void CMetroidPrimeExo::sub80275b68() {}
void CMetroidPrimeExo::sub80275c60(CStateManager& mgr, int w1, int w2) {}
void CMetroidPrimeExo::sub80275c60(CStateManager& mgr, int w1) {
if (x570_ == -1) {
return;
}
void CMetroidPrimeExo::sub80275d68(int w1) {}
x1258_.clear();
for (size_t i = 0; i < 14; ++i) {
x1258_.push_back(x1160_[x570_].GetFloatValue(i));
}
if (x1078_ == -1) {
return;
}
for (size_t i = 0; i < 40; ++i) {
sub802759a8(mgr, -1);
}
}
bool CMetroidPrimeExo::sub80275d68(int w1) { return false; }
void CMetroidPrimeExo::sub80275e14(int w1) {}
void CMetroidPrimeExo::sub80275e34(int w1) {}
u32 CMetroidPrimeExo::sub80275e34(int w1) const { return skSomeMeleeValues[w1][x1078_]; }
void CMetroidPrimeExo::sub80275e54(float f1, CStateManager& mgr) {}
void CMetroidPrimeExo::sub80276164(float f1, CStateManager& mgr) {}
void CMetroidPrimeExo::UpdateSfxEmitter(float f1, CStateManager& mgr) {
if (!xfc1_) {
return;
}
void CMetroidPrimeExo::sub80276204(CStateManager& mgr, bool b1) {}
xfb8_ -= f1;
if (xfb8_ <= 0.f) {
sub8027639c(mgr, false);
}
void CMetroidPrimeExo::sub8027639c(CStateManager& mgr, bool b1) {}
if (xfbc_) {
CSfxManager::UpdateEmitter(xfbc_, GetTranslation(), zeus::skZero3f, 1.f);
}
}
void CMetroidPrimeExo::sub80276204(CStateManager& mgr, bool b1) {
if (b1 && xfc1_) {
sub8027639c(mgr, false);
}
xfc0_ = b1;
if (!b1) {
CSfxManager::RemoveEmitter(xfbc_);
xfbc_.reset();
GetBodyController()->GetCommandMgr().DeliverCmd(CBodyStateCmd{EBodyStateCmd::StopReaction});
} else {
if (xfbc_) {
xfbc_.reset();
}
xfbc_ = CSfxManager::AddEmitter(SFXsfx0519, GetTranslation(), zeus::skZero3f, 1.f, true, true, 127, kInvalidAreaId);
GetBodyController()->GetCommandMgr().DeliverCmd(
CBCAdditiveReactionCmd(pas::EAdditiveReactionType::Electrocution, 1.f, true));
}
}
void CMetroidPrimeExo::sub8027639c(CStateManager& mgr, bool b1) {
if (b1 && xfc0_) {
sub80276204(mgr, false);
}
for (size_t i = 0; i < 4; ++i) {
GetModelData()->GetAnimationData()->SetParticleEffectState(skEffectNames[i], b1, mgr);
}
xfc1_ = b1;
if (!b1) {
CSfxManager::RemoveEmitter(xfbc_);
xfbc_.reset();
} else {
if (xfbc_) {
xfbc_.reset();
}
xfbc_ = CSfxManager::AddEmitter(SFXsfx051A, GetTranslation(), zeus::skZero3f, 1.f, true, true, 127, kInvalidAreaId);
}
}
void CMetroidPrimeExo::SetActorAreaId(CStateManager& mgr, TUniqueId uid, TAreaId aid) {
if (auto* act = static_cast<CActor*>(mgr.ObjectById(uid))) {
@ -521,7 +838,7 @@ void CMetroidPrimeExo::UpdateAreaId(CStateManager& mgr) {
SetActorAreaId(mgr, x56c_collisionManager->GetCollisionDescFromIndex(i).GetCollisionActorId(), curAreaId);
}
for (const auto& uid : xb24_) {
for (const auto& uid : xb24_plasmaProjectileIds) {
SetActorAreaId(mgr, uid, curAreaId);
}
@ -537,7 +854,23 @@ void CMetroidPrimeExo::SendStateToRelay(EScriptObjectState state, CStateManager&
}
}
void CMetroidPrimeExo::sub80276754(CStateManager& mgr) {}
void CMetroidPrimeExo::sub80276754(CStateManager& mgr) {
x1160_.clear();
if (TCastToConstPtr<CMetroidPrimeRelay> relay = mgr.GetObjectById(x568_relayId)) {
x1160_ = relay->GetRoomParameters();
x8c0_ = relay->GetHealthInfo1();
x924_ = relay->Get_xc84();
x928_ = relay->Get_xc88();
x1080_ = relay->Get_xc8c();
x1440_ = relay->Get_xc90();
x918_ = relay->Get_xcac();
x584_ = relay->Get_xc94();
x574_ = relay->Get_xc98();
x8d4_ = relay->Get_xcb0();
x57c_ = relay->Get_xcb4();
sub80275c60(mgr, relay->Get_xcb4());
}
}
TUniqueId CMetroidPrimeExo::sub802769e0(CStateManager& mgr, bool b1) {
TUniqueId uid = sub80276b3c(mgr, EScriptObjectState::Attack, EScriptObjectMessage::Follow);
@ -642,17 +975,76 @@ bool CMetroidPrimeExo::sub80277224(float f1, CStateManager& mgr) {
void CMetroidPrimeExo::sub80277380(CStateManager& mgr, bool b1) {}
void CMetroidPrimeExo::sub80277570(float f1, CStateManager& mgr) {}
void CMetroidPrimeExo::sub80277570(float f1, CStateManager& mgr) {
zeus::CTransform jawXf = GetLctrTransform("Jaw_1"sv);
xc54_->SetTranslation(jawXf.origin);
xc54_->SetOrientation(jawXf.getRotation());
xc54_->Update(f1);
if (xc58_ >= 0 && xc58_ < 4) {
if (auto* ent = mgr.ObjectById(xb24_plasmaProjectileIds[xc58_])) {
if (ent->GetActive()) {
if (GetBodyController()->GetPercentageFrozen() > 0.f) {
sub80277380(mgr, false);
}
// TODO: Finish
}
}
}
}
zeus::CVector3f CMetroidPrimeExo::sub80778c4(CStateManager& mgr) { return zeus::CVector3f(); }
void CMetroidPrimeExo::sub80277b74(CStateManager& mgr) {}
void CMetroidPrimeExo::sub80277c04(CStateManager& mgr) {}
void CMetroidPrimeExo::sub80277c04(CStateManager& mgr) {
xc54_->SetParticleEmission(false);
xc54_->SetGlobalScale(GetModelData()->GetScale());
void CMetroidPrimeExo::sub80277e30(CStateManager& mgr) {}
for (size_t i = 0; i < x96c_.size(); ++i) {
xb24_plasmaProjectileIds[i] = mgr.AllocateUniqueId();
CDamageInfo dInfo = xa80_[i].GetDamage();
dInfo.SetWeaponMode(CWeaponMode(EWeaponType::PoisonWater));
EProjectileAttrib flags = EProjectileAttrib::PlayerUnFreeze;
if (xa80_[i].GetDamage().GetWeaponMode().GetType() == EWeaponType::Ice) {
flags = EProjectileAttrib::None;
}
mgr.AddObject(new CPlasmaProjectile(xa80_[i].Token(), ""sv, xa80_[i].GetDamage().GetWeaponMode().GetType(),
x96c_[i], {}, EMaterialTypes::Character, dInfo, xb24_plasmaProjectileIds[i],
GetAreaIdAlways(), GetUniqueId(), xb30_[i], true, flags));
}
}
void CMetroidPrimeExo::sub80278044(float f1, CStateManager& mgr) {}
void CMetroidPrimeExo::UpdateContactDamage(CStateManager& mgr) {
const auto* mData = GetModelData();
zeus::CVector3f max = GetTranslation() + zeus::CVector3f{(0.57735026f * mData->GetScale().magnitude()) * 6.f,
(0.57735026f * mData->GetScale().magnitude()) * 6.f,
(0.57735026f * mData->GetScale().magnitude()) * 5.5f};
zeus::CVector3f min = GetTranslation() + zeus::CVector3f{(0.57735026f * mData->GetScale().magnitude()) * -6.f,
(0.57735026f * mData->GetScale().magnitude()) * -6.f,
(0.57735026f * mData->GetScale().magnitude()) * 2.f};
x8f8_ = zeus::CAABox{min, max};
if (mgr.GetPlayer().GetTouchBounds()->intersects(x8f8_)) {
mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), GetContactDamage(),
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::skZero3f);
x420_curDamageRemTime = x424_damageWaitTime;
}
}
void CMetroidPrimeExo::UpdateColorChange(float f1, CStateManager& mgr) {
if (!x8f4_24_) {
return;
}
if (x8e4_ >= 1.f) {
x8d8_ = x8e0_;
x8f4_24_ = false;
GetModelData()->GetAnimationData()->SetParticleEffectState("ColorChange"sv, false, mgr);
} else {
x8e4_ = std::max(1.f, x8e4_ + f1 / 0.3f);
x8d8_ = zeus::CColor::lerp(x8dc_, x8e0_, x8e4_);
}
}
void CMetroidPrimeExo::sub80278130(const zeus::CColor& col) {
x8e4_ = 0.f;
@ -663,15 +1055,59 @@ void CMetroidPrimeExo::sub80278130(const zeus::CColor& col) {
void CMetroidPrimeExo::sub802781e0(const zeus::CColor& col) {}
void CMetroidPrimeExo::sub8027815c(float f1) {}
void CMetroidPrimeExo::UpdateHeadAnimation(float f1) {
if (x8e8_headUpAdditiveBodyAnimIndex == -1) {
return;
}
if (x8f4_25_ && x8ec_ > 0.f) {
x8ec_ -= f1 / 0.1f;
if (x8ec_ <= 0.f) {
x8ec_ = 0.f;
}
} else {
if (x8ec_ < 1.f) {
x8ec_ += f1 / 0.5f;
}
if (x8ec_ > 0.f || x8f4_26_) {
if (x8ec_ <= FLT_EPSILON) {
GetModelData()->GetAnimationData()->DelAdditiveAnimation(x8e8_headUpAdditiveBodyAnimIndex);
x8f4_26_ = false;
} else {
GetModelData()->GetAnimationData()->AddAdditiveAnimation(x8e8_headUpAdditiveBodyAnimIndex, x8ec_, true, false);
x8f4_26_ = true;
}
}
}
}
void CMetroidPrimeExo::sub8027827c(TUniqueId uid, CStateManager& mgr) {}
void CMetroidPrimeExo::sub80278508(CStateManager& mgr, int w1, bool b1) {}
void CMetroidPrimeExo::sub802786fc(CStateManager& mgr) {}
void CMetroidPrimeExo::sub802786fc(CStateManager& mgr) {
int w1 = 0;
if (!x584_) {
w1 = x570_;
u32 iVar2 = 0;
do {
++iVar2;
if (iVar2 < 10) {
w1 = x588_[w1].x70_[mgr.GetActiveRandom()->Next() & 1];
} else if (iVar2 > 19) {
w1 = x588_[w1].x70_[1];
}
} while (((x57c_ & (1 << w1)) != 0u) || ((x580_ & (1 << w1)) != 0));
x580_ |= 1 << w1;
} else {
w1 = x588_[x570_].x70_[mgr.GetActiveRandom()->Next() & 1];
}
void CMetroidPrimeExo::sub80278800(CStateManager& mgr, bool b) {
sub80278508(mgr, w1, x8f4_25_);
sub80275c60(mgr, w1);
}
void CMetroidPrimeExo::SetEyesParticleEffectState(CStateManager& mgr, bool b) {
x8f4_25_ = b;
sub80278508(mgr, x570_, b);
GetModelData()->GetAnimationData()->SetParticleEffectState("Eyes"sv, b, mgr);
@ -744,9 +1180,12 @@ void CMetroidPrimeExo::UpdateCollision(float dt, CStateManager& mgr) {
MoveCollisionPrimitive(GetTransform().rotate(GetModelData()->GetScale() * xf.origin));
}
void CMetroidPrimeExo::sub8027903c() {}
void CMetroidPrimeExo::sub8027c22c(int w1, int w2) {}
void CMetroidPrimeExo::SetupBoneTracking() {
for (size_t i = 0; i < 6; ++i) {
x76c_.emplace_back(*GetModelData()->GetAnimationData(), skBoneTrackingNames[i], zeus::degToRad(80.f),
zeus::degToRad(180.f), EBoneTrackingFlags::NoParentOrigin);
}
}
void CMetroidPrimeExo::SetupCollisionActorManager(CStateManager& mgr) {
std::vector<CJointCollisionDescription> joints;
@ -788,4 +1227,5 @@ void CMetroidPrimeExo::SetupCollisionActorManager(CStateManager& mgr) {
UpdateHeadHealthInfo(mgr);
}
void CMetroidPrimeExo::CPhysicsDummy::Accept(IVisitor& visitor) { visitor.Visit(this); }
} // namespace urde::MP1

View File

@ -4,6 +4,7 @@
#include "Runtime/Character/CBoneTracking.hpp"
#include "Runtime/MP1/World/CMetroidPrimeProjectile.hpp"
#include "Runtime/Weapon/CBeamInfo.hpp"
#include "Runtime/Weapon/CPlasmaProjectile.hpp"
#include "Runtime/Weapon/CProjectileInfo.hpp"
#include "Runtime/World/CActorParameters.hpp"
#include "Runtime/World/CPatterned.hpp"
@ -35,24 +36,11 @@ struct SPrimeStruct2B {
explicit SPrimeStruct2B(CInputStream& in);
};
struct SPrimeStruct5 {
u32 x0_propertyCount;
CAssetId x4_;
u32 x8_;
CAssetId xc_;
CAssetId x10_;
u32 x14_;
u32 x18_;
u32 x1c_;
u32 x20_;
explicit SPrimeStruct5(CInputStream& in);
};
struct SPrimeStruct4 {
CBeamInfo x0_beamInfo;
u32 x44_;
CDamageInfo x48_dInfo1;
SPrimeStruct5 x64_struct5;
CPlasmaProjectile::PlayerEffectResources x64_struct5;
float x88_;
CDamageInfo x8c_dInfo2;
explicit SPrimeStruct4(CInputStream& in);
@ -62,8 +50,7 @@ struct SPrimeStruct6 {
u32 x0_propertyCount;
CDamageVulnerability x4_damageVulnerability;
zeus::CColor x6c_color;
u32 x70_;
u32 x74_;
std::array<u32, 2> x70_;
explicit SPrimeStruct6(CInputStream& in);
};
@ -98,12 +85,22 @@ struct SPrimeExoParameters {
struct SPrimeExoRoomParameters {
rstl::reserved_vector<float, 14> x0_;
explicit SPrimeExoRoomParameters(CInputStream& in);
float GetFloatValue(size_t idx) const { return x0_[idx]; }
};
class CMetroidPrimeExo : public CPatterned {
class CPhysicsDummy : public CPhysicsActor {
public:
CPhysicsDummy(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& info)
: CPhysicsActor(uid, active, name, info, {}, CModelData::CModelDataNull(),
CMaterialList(EMaterialTypes::Target, EMaterialTypes::ExcludeFromRadar), zeus::CAABox{-1.f, 1.f},
SMoverData(1.f), CActorParameters::None(), 0.3f, 0.1f) {}
void Accept(IVisitor& visitor) override;
};
TUniqueId x568_relayId = kInvalidUniqueId;
std::unique_ptr<CCollisionActorManager> x56c_collisionManager;
u32 x570_ = 1;
s32 x570_ = 1;
u32 x574_ = 1;
u32 x578_ = 0;
u32 x57c_ = 0;
@ -128,8 +125,7 @@ class CMetroidPrimeExo : public CPatterned {
bool x8f4_26_ : 1 = false;
bool x8f4_27_ : 1 = false;
bool x8f4_28_ : 1 = false;
zeus::CVector3f x8f8_;
zeus::CVector3f x904_;
zeus::CAABox x8f8_;
float x910_ = 5.f;
bool x914_24_ : 1 = false;
s32 x918_ = -1;
@ -139,11 +135,12 @@ class CMetroidPrimeExo : public CPatterned {
float x928_ = 5.f;
u32 x92c_ = 0;
SPrimeStruct2B x930_;
// x96c_;
rstl::reserved_vector<CBeamInfo, 4> x96c_;
rstl::reserved_vector<CProjectileInfo, 4> xa80_;
rstl::reserved_vector<TUniqueId, 4> xb24_;
rstl::reserved_vector<SPrimeStruct5, 4> xb30_;
// xbc4_;
rstl::reserved_vector<TUniqueId, 4> xb24_plasmaProjectileIds = {{kInvalidUniqueId, kInvalidUniqueId, kInvalidUniqueId,
kInvalidUniqueId}};
rstl::reserved_vector<CPlasmaProjectile::PlayerEffectResources, 4> xb30_;
rstl::reserved_vector<CDamageInfo, 4> xbc4_;
TLockedToken<CGenDescription> xc48_;
std::unique_ptr<CElementGen> xc54_;
s32 xc58_ = -1;
@ -166,16 +163,16 @@ class CMetroidPrimeExo : public CPatterned {
CSfxHandle xfbc_;
bool xfc0_ = false;
bool xfc1_ = false;
u32 xfc4_ = 0;
u32 xfd8_ = 0;
u32 xfec_ = 0;
u32 x1000_ = 0;
rstl::reserved_vector<TToken<CGenDescription>, 2> xfc4_;
rstl::reserved_vector<TToken<CSwooshDescription>, 2> xfd8_;
rstl::reserved_vector<std::unique_ptr<CElementGen>, 2> xfec_;
rstl::reserved_vector<std::unique_ptr<CParticleSwoosh>, 2> x1000_;
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 x1044_billboardId = kInvalidUniqueId;
TUniqueId x1046_ = kInvalidUniqueId;
float x1048_ = 0.f;
float x104c_ = 75.f;
@ -184,8 +181,7 @@ class CMetroidPrimeExo : public CPatterned {
bool x1054_25_ : 1 = false;
bool x1054_26_ : 1 = false;
bool x1054_27_ : 1 = false;
u32 x1058_ = 0;
u32 x106c_ = 0;
rstl::reserved_vector<TUniqueId, 2> x106c_energyBallIds;
float x1074_ = 0.f;
s32 x1078_ = -1;
float x107c_ = 0.f;
@ -193,9 +189,9 @@ class CMetroidPrimeExo : public CPatterned {
float x1084_ = 0.f;
float x1088_ = 0.f;
CCameraShakeData x108c_;
u32 x1160_ = 0;
u32 x1254_ = -1;
u32 x1258_ = 0;
rstl::reserved_vector<SPrimeExoRoomParameters, 4> x1160_;
s32 x1254_ = -1;
rstl::reserved_vector<float, 14> x1258_;
CCameraShakeData x1294_;
CCameraShakeData x1368_;
std::unique_ptr<CProjectedShadow> x143c_;
@ -203,18 +199,17 @@ class CMetroidPrimeExo : public CPatterned {
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 UpdateEnergyBalls(float dt, CStateManager& mgr);
u32 CountEnergyBalls(CStateManager& mgr);
void sub80273d38(CStateManager& mgr);
void sub80273f10(CStateManager& mgr);
void UpdatePhysicsDummy(CStateManager& mgr);
void sub80274054(CStateManager& mgr);
void sub802740cc(CStateManager& mgr);
void sub802740fc(CStateManager& mgr);
void CreatePhysicsDummy(CStateManager& mgr);
void sub802743e0(CStateManager& mgr, u32);
void sub8027444c(CStateManager& mgr);
void sub8027447c(CStateManager& mgr);
void CreateHUDBillBoard(CStateManager& mgr);
void sub802747b8(float f1, CStateManager& mgr, const zeus::CVector3f& vec);
void sub80274e6c(float f1, CStateManager& mgr);
void sub802755ac(CStateManager& mgr, bool b1);
@ -222,15 +217,15 @@ class CMetroidPrimeExo : public CPatterned {
void sub8027571c(CStateManager& mgr);
void UpdateTimers(float mgr);
void sub80275800(CStateManager& mgr);
void sub802759a8(CStateManager& mgr, int w1, int w2);
void sub80275b04(CStateManager& mgr, int w1, int w2);
void sub802759a8(CStateManager& mgr, u32 w1);
float sub80275b04(const SPrimeExoRoomParameters& roomParms, int w2);
void sub80275b68();
void sub80275c60(CStateManager& mgr, int w1, int w2);
void sub80275d68(int w1);
void sub80275c60(CStateManager& mgr, int w1);
bool sub80275d68(int w1);
void sub80275e14(int w1);
void sub80275e34(int w1);
u32 sub80275e34(int w1) const;
void sub80275e54(float f1, CStateManager& mgr);
void sub80276164(float f1, CStateManager& mgr);
void UpdateSfxEmitter(float f1, CStateManager& mgr);
void sub80276204(CStateManager& mgr, bool b1);
void sub8027639c(CStateManager& mgr, bool b1);
void SetActorAreaId(CStateManager& mgr, TUniqueId uid, TAreaId aid);
@ -247,24 +242,25 @@ class CMetroidPrimeExo : public CPatterned {
zeus::CVector3f sub80778c4(CStateManager& mgr);
void sub80277b74(CStateManager& mgr);
void sub80277c04(CStateManager& mgr);
void sub80277e30(CStateManager& mgr);
void sub80278044(float f1, CStateManager& mgr);
void UpdateContactDamage(CStateManager& mgr);
void UpdateColorChange(float f1, CStateManager& mgr);
void sub80278130(const zeus::CColor& col);
void sub802781e0(const zeus::CColor& col);
void sub8027815c(float f1);
void UpdateHeadAnimation(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 SetEyesParticleEffectState(CStateManager& mgr, bool b);
void UpdateHeadHealthInfo(CStateManager& mgr);
void UpdateHealthInfo(CStateManager& mgr);
void SetBoneTrackingTarget(CStateManager& mgr, bool active);
void UpdateBoneTracking(float f1, CStateManager& mgr);
void sub80278cc8(TUniqueId uid, CStateManager& mgr);
void UpdateCollision(float dt, CStateManager& mgr);
void sub8027903c();
void SetupBoneTracking();
void sub8027c22c(int w1, int w2);
void SetupCollisionActorManager(CStateManager& mgr);
public:
DEFINE_PATTERNED(MetroidPrimeExo);
CMetroidPrimeExo(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
@ -282,10 +278,10 @@ public:
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 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;
@ -306,28 +302,28 @@ public:
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 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 ShouldJumpBack(CStateManager& mgr, float arg) override { return x1254_ == 11; }
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;
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;
};

View File

@ -39,6 +39,19 @@ public:
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr) override;
[[nodiscard]] TUniqueId GetMetroidPrimeExoId() const { return x34_mpUid; }
void SetMetroidPrimeExoId(TUniqueId uid) { x34_mpUid = uid; }
float Get_xc84() const { return xc84_f1; }
float Get_xc88() const { return xc88_f2; }
float Get_xc8c() const { return xc8c_f3; }
u32 Get_xc90() const { return xc90_w1; }
bool Get_xc94() const { return xc94_b1; }
u32 Get_xc98() const { return xc98_w2; }
CHealthInfo GetHealthInfo1() const { return xc9c_hInfo1; }
CHealthInfo GetHealthInfo2() const { return xca4_hInfo2; }
u32 Get_xcac() const { return xcac_w3; }
u32 Get_xcb0() const { return xcb0_w4; }
u32 Get_xcb4() const { return xcb4_w5; }
rstl::reserved_vector<SPrimeExoRoomParameters, 4> GetRoomParameters() const { return xcb8_roomParms; }
};
} // namespace urde::MP1

View File

@ -869,7 +869,7 @@ void CRidley::FirePlasma(urde::CStateManager& mgr) {
xb64_plasmaProjectile = mgr.AllocateUniqueId();
mgr.AddObject(new CPlasmaProjectile(xb68_.Token(), ""sv, EWeaponType::AI, x568_data.x64_, {},
EMaterialTypes::Character, xb68_.GetDamage(), xb64_plasmaProjectile,
GetAreaIdAlways(), GetUniqueId(), CPlasmaProjectile::PlayerEffectResoures(),
GetAreaIdAlways(), GetUniqueId(), CPlasmaProjectile::PlayerEffectResources(),
false, EProjectileAttrib::KeepInCinematic));
}

View File

@ -28,7 +28,7 @@ CPlasmaProjectile::RenderObjects::RenderObjects(boo::IGraphicsDataFactory::Conte
CPlasmaProjectile::CPlasmaProjectile(const TToken<CWeaponDescription>& wDesc, std::string_view name, EWeaponType wType,
const CBeamInfo& bInfo, const zeus::CTransform& xf, EMaterialTypes matType,
const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid, TUniqueId owner,
const PlayerEffectResoures& res, bool growingBeam, EProjectileAttrib attribs)
const PlayerEffectResources& res, bool growingBeam, EProjectileAttrib attribs)
: CBeamProjectile(wDesc, name, wType, xf, bInfo.GetLength(), bInfo.GetRadius(), bInfo.GetTravelSpeed(), matType, dInfo,
uid, aid, owner, attribs, growingBeam)
, x478_beamAttributes(bInfo.GetBeamAttributes())

View File

@ -18,11 +18,23 @@
namespace urde {
class CPlasmaProjectile : public CBeamProjectile {
public:
struct PlayerEffectResoures : rstl::reserved_vector<CAssetId, 8> {
PlayerEffectResoures(CAssetId a = {}, CAssetId b = {}, CAssetId c = {}, CAssetId d = {},
struct PlayerEffectResources : rstl::reserved_vector<CAssetId, 8> {
PlayerEffectResources(CAssetId a = {}, CAssetId b = {}, CAssetId c = {}, CAssetId d = {},
CAssetId e = {}, CAssetId f = {}, CAssetId g = {}, CAssetId h = {})
: rstl::reserved_vector<CAssetId, 8>({a, b, c, d, e, f, g, h}) {}
};
static PlayerEffectResources LoadPlayerEffectResources(CInputStream& in) {
u32 propCount = in.readUint32();
CAssetId a{in};
CAssetId b{in};
CAssetId c{in};
CAssetId d{in};
CAssetId e{in};
CAssetId f{in};
CAssetId g{in};
CAssetId h{in};
return {a, b, c, d, e, f, g, h};
}
private:
std::vector<TUniqueId> x468_lights;
s32 x478_beamAttributes;
@ -107,7 +119,7 @@ public:
CPlasmaProjectile(const TToken<CWeaponDescription>& wDesc, std::string_view name, EWeaponType wType,
const CBeamInfo& bInfo, const zeus::CTransform& xf, EMaterialTypes matType,
const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid, TUniqueId owner,
const PlayerEffectResoures& res, bool growingBeam, EProjectileAttrib attribs);
const PlayerEffectResources& res, bool growingBeam, EProjectileAttrib attribs);
void Accept(IVisitor& visitor) override;
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) override;

View File

@ -621,5 +621,6 @@ public:
float GetAverageSpeed() const;
bool IsInWaterMovement() const { return x9c4_31_inWaterMovement; }
void SetNoDamageLoopSfx(bool val) { x9c7_24_noDamageLoopSfx = val; }
void SetAccelerationChangeTimer(float time) { x2d4_accelerationChangeTimer = time; }
};
} // namespace urde