mirror of https://github.com/AxioDL/metaforce.git
Merge branch 'master' of https://github.com/AxioDL/urde
This commit is contained in:
commit
b8598fec8a
|
@ -0,0 +1,20 @@
|
|||
#include "CBeetle.hpp"
|
||||
#include "World/CDamageInfo.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
namespace MP1
|
||||
{
|
||||
|
||||
CBeetle::CBeetle(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf, CModelData&& mData,
|
||||
const CPatternedInfo& pInfo, CPatterned::EFlavorType flavor, CBeetle::EEntranceType, const CDamageInfo&,
|
||||
const CDamageVulnerability&, const zeus::CVector3f&, float, float, float, const CDamageVulnerability&,
|
||||
const CActorParameters& aParams, const rstl::optional_object<CStaticRes>)
|
||||
: CPatterned(EUnknown::Three, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Ground,
|
||||
EColliderType::One, EBodyType::One, aParams, bool(flavor))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef CBEETLE_HPP
|
||||
#define CBEETLE_HPP
|
||||
|
||||
#include "World/CPatterned.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CDamageInfo;
|
||||
|
||||
namespace MP1
|
||||
{
|
||||
class CBeetle : public CPatterned
|
||||
{
|
||||
public:
|
||||
enum EEntranceType
|
||||
{
|
||||
};
|
||||
private:
|
||||
public:
|
||||
CBeetle(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
|
||||
const CPatternedInfo&, CPatterned::EFlavorType,EEntranceType, const CDamageInfo &, const CDamageVulnerability&,
|
||||
const zeus::CVector3f&, float, float, float, const CDamageVulnerability&, const CActorParameters&,
|
||||
const rstl::optional_object<CStaticRes>);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CBEETLE_HPP
|
|
@ -7,6 +7,7 @@ set(MP1_SOURCES
|
|||
CPlayMovie.hpp CPlayMovie.cpp
|
||||
CFrontEndUI.hpp CFrontEndUI.cpp
|
||||
CNewIntroBoss.hpp CNewIntroBoss.cpp
|
||||
CBeetle.hpp CBeetle.cpp
|
||||
CWarWasp.hpp CWarWasp.cpp
|
||||
MP1.hpp MP1.cpp)
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ CNewIntroBoss::CNewIntroBoss(TUniqueId uid, const std::string& name, const CEnti
|
|||
const CActorParameters& actParms, float, u32, const CDamageInfo& dInfo,
|
||||
u32, u32, u32, u32)
|
||||
: CPatterned(EUnknown::TwentyThree, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
|
||||
EMovementType::Flyer, EColliderType::One, EBodyType::Two, actParms, 1)
|
||||
EMovementType::Flyer, EColliderType::One, EBodyType::Two, actParms, true)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ CWarWasp::CWarWasp(TUniqueId uid, const std::string& name, const CEntityInfo& in
|
|||
CPatterned::EColliderType collider, const CDamageInfo& dInfo1, const CActorParameters& actorParms,
|
||||
ResId weapon, const CDamageInfo& dInfo2, ResId particle, u32 w3)
|
||||
: CPatterned(EUnknown::ThirtyNine, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Flyer, collider, EBodyType::Three,
|
||||
actorParms, 0)
|
||||
actorParms, false)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ typedef void (CAi::*CAiStateFunc)(CStateManager&, EStateMsg, float);
|
|||
typedef bool (CAi::*CAiTriggerFunc)(CStateManager&, float);
|
||||
class CAiFuncMap
|
||||
{
|
||||
std::map<const char*, CAiStateFunc> x0_stateFuncs;
|
||||
std::map<const char*, CAiTriggerFunc> x10_triggerFuncs;
|
||||
std::unordered_map<std::string, CAiStateFunc> x0_stateFuncs;
|
||||
std::unordered_map<std::string, CAiTriggerFunc> x10_triggerFuncs;
|
||||
public:
|
||||
CAiFuncMap();
|
||||
CAiStateFunc GetStateFunc(const char*);
|
||||
|
|
|
@ -37,6 +37,9 @@ set(WORLD_SOURCES
|
|||
CScriptSpawnPoint.hpp CScriptSpawnPoint.cpp
|
||||
CScriptCameraHint.hpp CScriptCameraHint.cpp
|
||||
CScriptPickup.hpp CScriptPickup.cpp
|
||||
CScriptMemoryRelay.hpp CScriptMemoryRelay.cpp
|
||||
CScriptRandomRelay.hpp CScriptRandomRelay.cpp
|
||||
CScriptRelay.hpp CScriptRelay.cpp
|
||||
CScriptDamageableTrigger.hpp CScriptDamageableTrigger.cpp
|
||||
CScriptActorRotate.hpp CScriptActorRotate.cpp
|
||||
CScriptSpecialFunction.hpp CScriptSpecialFunction.cpp
|
||||
|
|
|
@ -17,7 +17,7 @@ CMaterialList gkPatternedFlyerMaterialList(EMaterialTypes::ThirtyThree,
|
|||
CPatterned::CPatterned(EUnknown, TUniqueId uid, const std::string& name, CPatterned::EFlavorType flavor,
|
||||
const CEntityInfo& info, const zeus::CTransform& xf, CModelData&& mData,
|
||||
const CPatternedInfo& pInfo, CPatterned::EMovementType moveType, CPatterned::EColliderType,
|
||||
EBodyType, const CActorParameters& actorParms, u32)
|
||||
EBodyType, const CActorParameters& actorParms, bool)
|
||||
: CAi(uid, pInfo.xf8_active, name, info, xf, std::move(mData),
|
||||
zeus::CAABox(pInfo.xcc_bodyOrigin - zeus::CVector3f{pInfo.xc4_halfExtent, pInfo.xc4_halfExtent, 0.f},
|
||||
pInfo.xcc_bodyOrigin + zeus::CVector3f{pInfo.xc4_halfExtent, pInfo.xc4_halfExtent, pInfo.xc8_height}),
|
||||
|
|
|
@ -9,6 +9,7 @@ class CPatternedInfo;
|
|||
|
||||
enum class EBodyType
|
||||
{
|
||||
One,
|
||||
Two = 2,
|
||||
Three
|
||||
};
|
||||
|
@ -18,12 +19,14 @@ class CPatterned : public CAi
|
|||
public:
|
||||
enum class EUnknown
|
||||
{
|
||||
Three = 3,
|
||||
TwentyThree = 23,
|
||||
ThirtyNine
|
||||
};
|
||||
enum class EFlavorType
|
||||
{
|
||||
Zero = 0
|
||||
Zero = 0,
|
||||
One = 1
|
||||
};
|
||||
enum class EMovementType
|
||||
{
|
||||
|
@ -40,7 +43,7 @@ public:
|
|||
CPatterned(EUnknown unk, TUniqueId uid, const std::string& name, EFlavorType flavor,
|
||||
const CEntityInfo& info, const zeus::CTransform& xf, CModelData&& mData,
|
||||
const CPatternedInfo& pinfo, CPatterned::EMovementType movement, EColliderType collider,
|
||||
EBodyType body, const CActorParameters& params, u32 w1);
|
||||
EBodyType body, const CActorParameters& params, bool b1);
|
||||
|
||||
virtual void Death(const zeus::CVector3f& , CStateManager& ) {}
|
||||
virtual void KnockBack(const zeus::CVector3f &, CStateManager &) {}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#include "CScriptMemoryRelay.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CScriptMemoryRelay::CScriptMemoryRelay(TUniqueId uid, const std::string& name, const CEntityInfo& info, bool b1, bool b2, bool b3)
|
||||
: CEntity(uid, info, true, name),
|
||||
x34_24_(b1),
|
||||
x34_25_(b2),
|
||||
x34_26_(b3)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef CSCRIPTMEMORYRELAY_HPP
|
||||
#define CSCRIPTMEMORYRELAY_HPP
|
||||
|
||||
#include "CEntity.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CScriptMemoryRelay : public CEntity
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool x34_24_;
|
||||
bool x34_25_;
|
||||
bool x34_26_;
|
||||
};
|
||||
u8 dummy = 0;
|
||||
};
|
||||
public:
|
||||
CScriptMemoryRelay(TUniqueId, const std::string& name, const CEntityInfo&, bool, bool, bool);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // CSCRIPTMEMORYRELAY_HPP
|
|
@ -0,0 +1,13 @@
|
|||
#include "CScriptRandomRelay.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
CScriptRandomRelay::CScriptRandomRelay(TUniqueId uid, const std::string& name, const CEntityInfo& info, s32 connCount, s32 variance,
|
||||
bool clamp, bool active)
|
||||
: CEntity(uid, info, active, name),
|
||||
x34_connectionCount((clamp && connCount > 100) ? 100 : connCount),
|
||||
x38_variance(variance),
|
||||
x3c_clamp(clamp)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef CSCRIPTRANDOMRELAY_HPP
|
||||
#define CSCRIPTRANDOMRELAY_HPP
|
||||
|
||||
#include "CEntity.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CScriptRandomRelay : public CEntity
|
||||
{
|
||||
u32 x34_connectionCount;
|
||||
u32 x38_variance;
|
||||
bool x3c_clamp;
|
||||
public:
|
||||
CScriptRandomRelay(TUniqueId, const std::string&, const CEntityInfo&, s32, s32, bool, bool);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // CSCRIPTRANDOMRELAY_HPP
|
|
@ -0,0 +1,11 @@
|
|||
#include "CScriptRelay.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CScriptRelay::CScriptRelay(TUniqueId uid, const std::string& name, const CEntityInfo& info, bool active)
|
||||
: CEntity(uid, info, active, name)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef CSCRIPTRELAY_HPP
|
||||
#define CSCRIPTRELAY_HPP
|
||||
|
||||
#include "CEntity.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CScriptRelay : public CEntity
|
||||
{
|
||||
TUniqueId x34_ = kInvalidUniqueId;
|
||||
u32 x38_ = 0;
|
||||
public:
|
||||
CScriptRelay(TUniqueId, const std::string&, const CEntityInfo&, bool);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // CSCRIPTRELAY_HPP
|
|
@ -31,11 +31,15 @@
|
|||
#include "CScriptSpawnPoint.hpp"
|
||||
#include "CScriptCameraHint.hpp"
|
||||
#include "CScriptPickup.hpp"
|
||||
#include "CScriptMemoryRelay.hpp"
|
||||
#include "CScriptRandomRelay.hpp"
|
||||
#include "CScriptRelay.hpp"
|
||||
#include "CScriptDamageableTrigger.hpp"
|
||||
#include "CScriptActorRotate.hpp"
|
||||
#include "CScriptSpecialFunction.hpp"
|
||||
#include "Camera/CCinematicCamera.hpp"
|
||||
#include "MP1/CNewIntroBoss.hpp"
|
||||
#include "MP1/CBeetle.hpp"
|
||||
#include "MP1/CWarWasp.hpp"
|
||||
#include "CPatternedInfo.hpp"
|
||||
#include "CSimplePool.hpp"
|
||||
|
@ -924,21 +928,85 @@ CEntity* ScriptLoader::LoadPickup(CStateManager& mgr, CInputStream& in,
|
|||
CEntity* ScriptLoader::LoadMemoryRelay(CStateManager& mgr, CInputStream& in,
|
||||
int propCount, const CEntityInfo& info)
|
||||
{
|
||||
if (!EnsurePropertyCount(propCount, 3, "MemoryRelay") || propCount > 4)
|
||||
return nullptr;
|
||||
|
||||
const std::string* name = mgr.HashInstanceName(in);
|
||||
bool b1 = in.readBool();
|
||||
bool b2 = in.readBool();
|
||||
bool b3 = false;
|
||||
if (propCount > 3)
|
||||
b3 = in.readBool();
|
||||
|
||||
return new CScriptMemoryRelay(mgr.AllocateUniqueId(), *name, info, b1, b2, b3);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadRandomRelay(CStateManager& mgr, CInputStream& in,
|
||||
int propCount, const CEntityInfo& info)
|
||||
{
|
||||
if (!EnsurePropertyCount(propCount, 5, "RandomRelay"))
|
||||
return nullptr;
|
||||
const std::string* name = mgr.HashInstanceName(in);
|
||||
u32 w1 = in.readUint32Big();
|
||||
u32 w2 = in.readUint32Big();
|
||||
bool b1 = in.readBool();
|
||||
bool b2 = in.readBool();
|
||||
|
||||
return new CScriptRandomRelay(mgr.AllocateUniqueId(), *name, info, w1, w2, b1, b2);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadRelay(CStateManager& mgr, CInputStream& in,
|
||||
int propCount, const CEntityInfo& info)
|
||||
{
|
||||
if (!EnsurePropertyCount(propCount, 2, "Relay") || propCount > 3)
|
||||
return nullptr;
|
||||
|
||||
const std::string* name = mgr.HashInstanceName(in);
|
||||
if (propCount >= 3)
|
||||
in.readUint32Big();
|
||||
bool b1 = in.readBool();
|
||||
|
||||
return new CScriptRelay(mgr.AllocateUniqueId(), *name, info, b1);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadBeetle(CStateManager& mgr, CInputStream& in,
|
||||
int propCount, const CEntityInfo& info)
|
||||
{
|
||||
if (!EnsurePropertyCount(propCount, 16, "Beetle"))
|
||||
return nullptr;
|
||||
const std::string* name = mgr.HashInstanceName(in);
|
||||
CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big());
|
||||
zeus::CTransform xfrm = LoadEditorTransform(in);
|
||||
zeus::CVector3f scale = zeus::CVector3f::ReadBig(in);
|
||||
std::pair<bool, u32> pcount = CPatternedInfo::HasCorrectParameterCount(in);
|
||||
if (!pcount.first)
|
||||
return nullptr;
|
||||
|
||||
CPatternedInfo pInfo(in, pcount.second);
|
||||
CActorParameters aParams = LoadActorParameters(in);
|
||||
CDamageInfo dInfo(in);
|
||||
zeus::CVector3f v1 = zeus::CVector3f::ReadBig(in);
|
||||
float f1 = in.readFloatBig();
|
||||
CDamageVulnerability dVuln1(in);
|
||||
CDamageVulnerability dVuln2(in);
|
||||
ResId abdomen = in.readUint32Big();
|
||||
MP1::CBeetle::EEntranceType entrance = MP1::CBeetle::EEntranceType(in.readUint32Big());
|
||||
float f2 = in.readFloatBig();
|
||||
float f3 = in.readFloatBig();
|
||||
|
||||
FourCC animType = g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().GetACSFile());
|
||||
if (animType != SBIG('ANCS'))
|
||||
return nullptr;
|
||||
|
||||
rstl::optional_object<CStaticRes> abdomenRes;
|
||||
if (flavor == CPatterned::EFlavorType::One)
|
||||
abdomenRes.emplace(CStaticRes(abdomen, scale));
|
||||
|
||||
const CAnimationParameters& animParams = pInfo.GetAnimationParameters();
|
||||
CAnimRes animRes(animParams.GetACSFile(), animParams.GetCharacter(), scale, animParams.GetInitialAnimation(), true);
|
||||
|
||||
return new MP1::CBeetle(mgr.AllocateUniqueId(), *name, info, xfrm, animRes, pInfo, flavor, entrance, dInfo, dVuln2, v1, f2,
|
||||
f3, f1, dVuln1, aParams, abdomenRes);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadHUDMemo(CStateManager& mgr, CInputStream& in,
|
||||
|
|
Loading…
Reference in New Issue