mirror of https://github.com/AxioDL/metaforce.git
Initial CDrone imp
This commit is contained in:
parent
9dd77d6a10
commit
d033ddeb1d
|
@ -18,9 +18,9 @@ struct Drone : IScriptObject {
|
|||
DamageInfo damageInfo1;
|
||||
Value<atUint32> unknown3;
|
||||
DamageInfo damageInfo2;
|
||||
Value<atUint32> unknown4;
|
||||
Value<atUint32> unknown5;
|
||||
Value<atUint32> unknown6;
|
||||
UniqueID32 unknown4;
|
||||
UniqueID32 unknown5;
|
||||
UniqueID32 unknown6;
|
||||
FlareDefinition flareDefinition1;
|
||||
FlareDefinition flareDefinition2;
|
||||
FlareDefinition flareDefinition3;
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
#include "Runtime/MP1/World/CDrone.hpp"
|
||||
|
||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||
|
||||
namespace urde::MP1 {
|
||||
CDrone::CDrone(TUniqueId uid, std::string_view name, EFlavorType flavor, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, float f1, CModelData&& mData, const CPatternedInfo& pInfo,
|
||||
const CActorParameters& actParms, EMovementType movement, EColliderType colliderType, EBodyType bodyType,
|
||||
const CDamageInfo& dInfo1, CAssetId w1, const CDamageInfo& dInfo2, CAssetId w2,
|
||||
const std::vector<CVisorFlare::CFlareDef>& flares, float f2, float f3, float f4, float f5, float f6,
|
||||
float f7, float f8, float f9, float f10, float f11, float f12, float f13, float f14, float f15,
|
||||
float f16, float f17, float f18, float f19, float f20, float f21, float f22, float f23, float f24,
|
||||
CAssetId w3, bool b1)
|
||||
: CPatterned(ECharacter::Drone, uid, name, flavor, info, xf, std::move(mData), pInfo, movement, colliderType, bodyType,
|
||||
actParms, EKnockBackVariant(flavor == EFlavorType::Zero)) {}
|
||||
|
||||
void CDrone::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
||||
void CDrone::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) {
|
||||
CPatterned::AcceptScriptMsg(msg, sender, mgr);
|
||||
|
||||
switch (msg) {
|
||||
case EScriptObjectMessage::Registered:
|
||||
x450_bodyController->Activate(mgr);
|
||||
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Lurk);
|
||||
x450_bodyController->BodyStateInfo().SetMaximumPitch(0.f);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace urde::MP1
|
|
@ -0,0 +1,21 @@
|
|||
#pragma once
|
||||
|
||||
#include "Runtime/World/CPatterned.hpp"
|
||||
#include "Runtime/World/CVisorFlare.hpp"
|
||||
|
||||
namespace urde::MP1 {
|
||||
class CDrone : public CPatterned {
|
||||
public:
|
||||
DEFINE_PATTERNED(Drone);
|
||||
CDrone(TUniqueId uid, std::string_view name, EFlavorType flavor, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
float f1, CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms,
|
||||
EMovementType movement, EColliderType colliderType, EBodyType bodyType, const CDamageInfo& dInfo1, CAssetId w1,
|
||||
const CDamageInfo& dInfo2, CAssetId w2, const std::vector<CVisorFlare::CFlareDef>& flares, float f2, float f3,
|
||||
float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13,
|
||||
float f14, float f15, float f16, float f17, float f18, float f19, float f20, float f21, float f22, float f23,
|
||||
float f24, CAssetId w3, bool b1);
|
||||
|
||||
void Accept(IVisitor& visitor);
|
||||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr);
|
||||
};
|
||||
} // namespace urde::MP1
|
|
@ -9,6 +9,11 @@ set(MP1_WORLD_SOURCES
|
|||
CBurrower.hpp CBurrower.cpp
|
||||
CChozoGhost.hpp CChozoGhost.cpp
|
||||
CElitePirate.hpp CElitePirate.cpp
|
||||
CDrone.hpp CDrone.cpp
|
||||
CSpacePirate.hpp CSpacePirate.cpp
|
||||
CParasite.hpp CParasite.cpp
|
||||
CBabygoth.hpp CBabygoth.cpp
|
||||
CTryclops.hpp CTryclops.cpp
|
||||
CEnergyBall.hpp CEnergyBall.cpp
|
||||
CEyeball.hpp CEyeball.cpp
|
||||
CFireFlea.hpp CFireFlea.cpp
|
||||
|
|
|
@ -25,6 +25,8 @@ public:
|
|||
zeus::CColor x10_color;
|
||||
|
||||
public:
|
||||
CFlareDef()=default;
|
||||
CFlareDef(const CFlareDef&)=default;
|
||||
CFlareDef(const TToken<CTexture>& tex, float f1, float f2, const zeus::CColor& color)
|
||||
: x0_tex(tex), x8_f1(f1), xc_f2(f2), x10_color(color) {
|
||||
x0_tex.Lock();
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "Runtime/MP1/World/CJellyZap.hpp"
|
||||
#include "Runtime/MP1/World/CMagdolite.hpp"
|
||||
#include "Runtime/MP1/World/CMetaree.hpp"
|
||||
#include "Runtime/MP1/World/CDrone.hpp"
|
||||
#include "Runtime/MP1/World/CMetroid.hpp"
|
||||
#include "Runtime/MP1/World/CMetroidBeta.hpp"
|
||||
#include "Runtime/MP1/World/CMetroidPrimeRelay.hpp"
|
||||
|
@ -2001,8 +2002,92 @@ CEntity* ScriptLoader::LoadPointOfInterest(CStateManager& mgr, CInputStream& in,
|
|||
pointSize);
|
||||
}
|
||||
|
||||
std::optional<CVisorFlare::CFlareDef> LoadFlareDef(CInputStream& in) {
|
||||
if (in.readUint32Big() == 4) {
|
||||
CAssetId textureId(in);
|
||||
float f1 = in.readFloatBig();
|
||||
float f2 = in.readFloatBig();
|
||||
zeus::CColor color = zeus::CColor::ReadRGBABig(in);
|
||||
if (textureId.IsValid()) {
|
||||
return {CVisorFlare::CFlareDef(g_SimplePool->GetObj({SBIG('TXTR'), textureId}), f1, f2, color)};
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadDrone(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
if (propCount != 45 && EnsurePropertyCount(propCount, 45, "Drone"))
|
||||
return nullptr;
|
||||
|
||||
std::string name = mgr.HashInstanceName(in);
|
||||
CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big());
|
||||
zeus::CTransform xf = LoadEditorTransform(in);
|
||||
zeus::CVector3f scale = zeus::CVector3f::ReadBig(in);
|
||||
float f1 = in.readFloatBig();
|
||||
const auto [patternedValid, patternedPropCount] = CPatternedInfo::HasCorrectParameterCount(in);
|
||||
if (!patternedValid)
|
||||
return nullptr;
|
||||
CPatternedInfo pInfo(in, patternedPropCount);
|
||||
CActorParameters actParms = LoadActorParameters(in);
|
||||
CDamageInfo dInfo1(in);
|
||||
u32 w1 = in.readUint32Big();
|
||||
CDamageInfo dInfo2(in);
|
||||
CAssetId aId1(in);
|
||||
in.seek(4); // Unused
|
||||
CAssetId aId2(in);
|
||||
std::optional<CVisorFlare::CFlareDef> def1 = LoadFlareDef(in);
|
||||
std::optional<CVisorFlare::CFlareDef> def2 = LoadFlareDef(in);
|
||||
std::optional<CVisorFlare::CFlareDef> def3 = LoadFlareDef(in);
|
||||
std::optional<CVisorFlare::CFlareDef> def4 = LoadFlareDef(in);
|
||||
std::optional<CVisorFlare::CFlareDef> def5 = LoadFlareDef(in);
|
||||
std::vector<CVisorFlare::CFlareDef> flares(5);
|
||||
if (def1)
|
||||
flares.push_back(*def1);
|
||||
if (def2)
|
||||
flares.push_back(*def2);
|
||||
if (def3)
|
||||
flares.push_back(*def3);
|
||||
if (def4)
|
||||
flares.push_back(*def4);
|
||||
if (def4)
|
||||
flares.push_back(*def4);
|
||||
|
||||
const auto& animParms = pInfo.GetAnimationParameters();
|
||||
if (g_ResFactory->GetResourceTypeById(animParms.GetACSFile()) != SBIG('ANCS'))
|
||||
return nullptr;
|
||||
|
||||
float f2 = in.readFloatBig();
|
||||
float f3 = in.readFloatBig();
|
||||
float f4 = in.readFloatBig();
|
||||
float f5 = in.readFloatBig();
|
||||
float f6 = in.readFloatBig();
|
||||
float f7 = in.readFloatBig();
|
||||
float f8 = in.readFloatBig();
|
||||
float f9 = in.readFloatBig();
|
||||
float f10 = in.readFloatBig();
|
||||
float f11 = in.readFloatBig();
|
||||
float f12 = in.readFloatBig();
|
||||
float f13 = in.readFloatBig();
|
||||
float f14 = in.readFloatBig();
|
||||
float f15 = in.readFloatBig();
|
||||
float f16 = in.readFloatBig();
|
||||
float f17 = in.readFloatBig();
|
||||
float f18 = in.readFloatBig();
|
||||
float f19 = in.readFloatBig();
|
||||
float f20 = in.readFloatBig();
|
||||
float f21 = in.readFloatBig();
|
||||
float f22 = in.readFloatBig();
|
||||
float f23 = in.readFloatBig();
|
||||
float f24 = in.readFloatBig();
|
||||
CAssetId crscId(in);
|
||||
bool b1 = in.readBool();
|
||||
CModelData mData(
|
||||
CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), scale, animParms.GetInitialAnimation(), true));
|
||||
return new MP1::CDrone(mgr.AllocateUniqueId(), name, flavor, info, xf, f1, std::move(mData), pInfo, actParms,
|
||||
CPatterned::EMovementType::Flyer, CPatterned::EColliderType::One, EBodyType::Pitchable, dInfo1,
|
||||
aId2, dInfo2, aId2, flares, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16,
|
||||
f17, f18, f19, f20, f21, f22, f23, f24, crscId, b1);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadMetroid(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
|
|
Loading…
Reference in New Issue