This commit is contained in:
Jack Andersen 2016-06-20 21:10:30 -10:00
commit 5cb420a703
5 changed files with 29 additions and 1 deletions

View File

@ -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)

View File

@ -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; }
};
}

View File

@ -19,8 +19,10 @@ class CPatterned : public CAi
public:
enum class EUnknown
{
Zero = 0,
Three = 3,
TwentyThree = 23,
ThirtyFour = 34,
ThirtyNine
};
enum class EFlavorType

View File

@ -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;}
};

View File

@ -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", head.x0_name.c_str());
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,