2020-01-15 12:07:48 +00:00
|
|
|
#include "Runtime/MP1/World/CMetroidPrimeRelay.hpp"
|
|
|
|
|
2020-09-14 04:12:00 +00:00
|
|
|
#include "Runtime/MP1/World/CMetroidPrimeExo.hpp"
|
|
|
|
#include "Runtime/CStateManager.hpp"
|
2019-09-21 13:07:13 +00:00
|
|
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
2017-08-20 05:23:22 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde::MP1 {
|
2017-08-20 05:23:22 +00:00
|
|
|
|
2017-11-13 06:19:18 +00:00
|
|
|
CMetroidPrimeRelay::CMetroidPrimeRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info, bool active,
|
2017-08-20 05:23:22 +00:00
|
|
|
const zeus::CTransform& xf, const zeus::CVector3f& scale,
|
2018-12-08 05:30:43 +00:00
|
|
|
SPrimeExoParameters&& parms, float f1, 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)
|
|
|
|
: CEntity(uid, info, active, name)
|
|
|
|
, x38_xf(xf)
|
|
|
|
, x68_scale(scale)
|
|
|
|
, x74_parms(std::move(parms))
|
|
|
|
, xc84_f1(f1)
|
|
|
|
, xc88_f2(f2)
|
|
|
|
, xc8c_f3(f3)
|
|
|
|
, xc90_w1(w1)
|
|
|
|
, xc94_b1(b1)
|
|
|
|
, xc98_w2(w2)
|
|
|
|
, xc9c_hInfo1(hInfo1)
|
|
|
|
, xca4_hInfo2(hInfo2)
|
|
|
|
, xcac_w3(w3)
|
|
|
|
, xcb0_w4(w4)
|
|
|
|
, xcb4_w5(w5)
|
|
|
|
, xcb8_roomParms(std::move(roomParms)) {}
|
2017-08-20 05:23:22 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CMetroidPrimeRelay::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
2020-09-14 04:12:00 +00:00
|
|
|
void CMetroidPrimeRelay::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& mgr) {
|
2020-09-23 19:41:51 +00:00
|
|
|
if (x34_mpUid != objId) {
|
2020-09-14 04:12:00 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2020-12-21 07:09:54 +00:00
|
|
|
for (const auto act : mgr.GetPhysicsActorObjectList()) {
|
2020-09-14 04:12:00 +00:00
|
|
|
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);
|
|
|
|
}
|
2017-08-20 05:23:22 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde::MP1
|