mirror of https://github.com/AxioDL/metaforce.git
SpacePirate loader imp
This commit is contained in:
parent
82595aa322
commit
ebd1fb5944
|
@ -9,6 +9,7 @@ set(MP1_SOURCES
|
|||
CNewIntroBoss.hpp CNewIntroBoss.cpp
|
||||
CBeetle.hpp CBeetle.cpp
|
||||
CWarWasp.hpp CWarWasp.cpp
|
||||
CSpacePirate.hpp CSpacePirate.cpp
|
||||
MP1.hpp MP1.cpp)
|
||||
|
||||
runtime_add_list(MP1 MP1_SOURCES)
|
||||
|
|
|
@ -23,6 +23,7 @@ public:
|
|||
u32 GetACSFile() const { return x0_ancs; }
|
||||
u32 GetCharacter() const { return x4_charIdx; }
|
||||
u32 GetInitialAnimation() const { return x8_defaultAnim; }
|
||||
void SetCharacter(u32 charIdx) { x4_charIdx = charIdx; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -19,8 +19,10 @@ class CPatterned : public CAi
|
|||
public:
|
||||
enum class EUnknown
|
||||
{
|
||||
Zero = 0,
|
||||
Three = 3,
|
||||
TwentyThree = 23,
|
||||
ThirtyFour = 34,
|
||||
ThirtyNine
|
||||
};
|
||||
enum class EFlavorType
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
CPatternedInfo(CInputStream& in, u32 pcount);
|
||||
static std::pair<bool, u32> HasCorrectParameterCount(CInputStream& in);
|
||||
|
||||
CAnimationParameters& GetAnimationParameters() { return xec_animParams; }
|
||||
const CAnimationParameters& GetAnimationParameters() const {return xec_animParams;}
|
||||
};
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "MP1/CNewIntroBoss.hpp"
|
||||
#include "MP1/CBeetle.hpp"
|
||||
#include "MP1/CWarWasp.hpp"
|
||||
#include "MP1/CSpacePirate.hpp"
|
||||
#include "CPatternedInfo.hpp"
|
||||
#include "CSimplePool.hpp"
|
||||
#include "Collision/CCollidableOBBTreeGroup.hpp"
|
||||
|
@ -1321,7 +1322,29 @@ CEntity* ScriptLoader::LoadWarWasp(CStateManager& mgr, CInputStream& in,
|
|||
CEntity* ScriptLoader::LoadSpacePirate(CStateManager& mgr, CInputStream& in,
|
||||
int propCount, const CEntityInfo& info)
|
||||
{
|
||||
return nullptr;
|
||||
if (!EnsurePropertyCount(propCount, 34, "SpacePirate"))
|
||||
return nullptr;
|
||||
SScaledActorHead head = LoadScaledActorHead(in, mgr);
|
||||
std::pair<bool, u32> verifyPair = CPatternedInfo::HasCorrectParameterCount(in);
|
||||
if (!verifyPair.first)
|
||||
return nullptr;
|
||||
|
||||
CPatternedInfo pInfo(in, verifyPair.second);
|
||||
CActorParameters aParams = LoadActorParameters(in);
|
||||
CAnimationParameters& animParms = pInfo.GetAnimationParameters();
|
||||
|
||||
if (g_ResFactory->GetResourceTypeById(animParms.GetACSFile()) != SBIG('ANCS'))
|
||||
return nullptr;
|
||||
|
||||
if (animParms.GetCharacter() == 0)
|
||||
{
|
||||
Log.report(logvisor::Warning, "SpacePirate <%s> has AnimationInformation property with invalid character selected");
|
||||
animParms.SetCharacter(2);
|
||||
}
|
||||
|
||||
CModelData mData(CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), head.x40_scale, animParms.GetInitialAnimation(), true));
|
||||
|
||||
return new MP1::CSpacePirate(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(mData), aParams, pInfo, in, propCount);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadFlyingPirate(CStateManager& mgr, CInputStream& in,
|
||||
|
|
Loading…
Reference in New Issue