Finish CSpankWeed

This commit is contained in:
Phillip Stephens 2018-12-03 18:31:15 -08:00
parent 9b2fd002c6
commit 0ec9f1f4eb
9 changed files with 448 additions and 57 deletions

View File

@ -12,25 +12,6 @@
<option name="SPACE_AFTER_REFERENCE_IN_DECLARATION" value="true" /> <option name="SPACE_AFTER_REFERENCE_IN_DECLARATION" value="true" />
</Objective-C> </Objective-C>
<Objective-C-extensions> <Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions> <extensions>
<pair source="cpp" header="hpp" fileNamingConvention="NONE" /> <pair source="cpp" header="hpp" fileNamingConvention="NONE" />
<pair source="c" header="h" fileNamingConvention="NONE" /> <pair source="c" header="h" fileNamingConvention="NONE" />

View File

@ -93,6 +93,8 @@ public:
s32 GetShadowLightIndex() const { return x2a0_shadowLightIdx; } s32 GetShadowLightIndex() const { return x2a0_shadowLightIdx; }
u32 GetAreaUpdateFramePeriod() const { return x2a8_areaUpdateFramePeriod; } u32 GetAreaUpdateFramePeriod() const { return x2a8_areaUpdateFramePeriod; }
void SetAreaUpdateFramePeriod(u32 p) { x2a8_areaUpdateFramePeriod = p; } void SetAreaUpdateFramePeriod(u32 p) { x2a8_areaUpdateFramePeriod = p; }
zeus::CVector3f GetActorPositionBias() const { return x2ac_actorPosBias; }
void SetActorPositionBias(const zeus::CVector3f& bias) { x2ac_actorPosBias = bias; }
}; };
} }

View File

@ -5,6 +5,19 @@
namespace urde namespace urde
{ {
struct SOBBJointDescription
{
const char* from;
const char* to;
zeus::CVector3f bounds;
};
struct SSphereJointDescription
{
const char* name;
float radius;
};
class CJointCollisionDescription class CJointCollisionDescription
{ {
public: public:

View File

@ -37,24 +37,11 @@ void CNewIntroBoss::Accept(IVisitor &visitor)
visitor.Visit(this); visitor.Visit(this);
} }
struct SSphereJointDescription
{
const char* name;
float radius;
};
static const SSphereJointDescription skSphereJoints[] ={ static const SSphereJointDescription skSphereJoints[] ={
{"Head_1", 1.5f}, {"Head_1", 1.5f},
{"Tail_1", 1.5f} {"Tail_1", 1.5f}
}; };
struct SOBBJointDescription
{
const char* from;
const char* to;
zeus::CVector3f bounds;
};
static const SOBBJointDescription skOBBJoints[] = { static const SOBBJointDescription skOBBJoints[] = {
{"Pelvis", "Spine_3", {4.f, 1.f, 4.f}}, {"Pelvis", "Spine_3", {4.f, 1.f, 4.f}},
{"Spine_3", "Tail_1", {2.f, 1.f, 2.f}}, {"Spine_3", "Tail_1", {2.f, 1.f, 2.f}},

View File

@ -1,21 +1,24 @@
#include "CSpankWeed.hpp" #include "CSpankWeed.hpp"
#include "World/CPatternedInfo.hpp" #include "World/CPatternedInfo.hpp"
#include "World/CPlayer.hpp"
#include "Collision/CCollisionActor.hpp"
#include "CStateManager.hpp"
#include <logvisor/logvisor.hpp> #include <logvisor/logvisor.hpp>
namespace urde::MP1 namespace urde::MP1
{ {
logvisor::Module SpankLog("urde::MP1::SpankWeed"); logvisor::Module SpankLog("urde::MP1::SpankWeed");
CSpankWeed::CSpankWeed(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, CSpankWeed::CSpankWeed(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CActorParameters& actParms, const CPatternedInfo& pInfo, float f1, CModelData&& mData, const CActorParameters& actParms, const CPatternedInfo& pInfo, float maxDetectionRange,
float f2, float f3, float f4) float maxHearingRange, float maxSightRange, float hideTime)
: CPatterned(ECharacter::SpankWeed, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo, : CPatterned(ECharacter::SpankWeed, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
EMovementType::Flyer, EColliderType::One, EBodyType::Restricted, actParms, EKnockBackVariant::Medium) EMovementType::Flyer, EColliderType::One, EBodyType::Restricted, actParms, EKnockBackVariant::Medium)
, x568_(f1) , x568_maxDetectionRange(maxDetectionRange)
, x56c_(pInfo.GetDetectionHeightRange()) , x56c_detectionHeightRange(pInfo.GetDetectionHeightRange())
, x570_(f2) , x570_maxHearingRange(maxHearingRange)
, x574_(f3) , x574_maxSightRange(maxSightRange)
, x578_(f4) , x578_hideTime(hideTime)
, x584_(xf.origin) , x584_retreatOrigin(xf.origin)
{ {
SetCallTouch(false); SetCallTouch(false);
CreateShadow(false); CreateShadow(false);
@ -41,9 +44,372 @@ CSpankWeed::CSpankWeed(TUniqueId uid, std::string_view name, const CEntityInfo&
{ {
zeus::CTransform locatorXf = GetTransform() * zeus::CTransform::Scale(GetModelData()->GetScale()) * zeus::CTransform locatorXf = GetTransform() * zeus::CTransform::Scale(GetModelData()->GetScale()) *
GetModelData()->GetAnimationData()->GetLocatorTransform(segId, nullptr); GetModelData()->GetAnimationData()->GetLocatorTransform(segId, nullptr);
x5a8_ = locatorXf.origin; x5a8_lockonTarget = locatorXf.origin;
x59c_ = locatorXf.origin - GetTranslation(); x59c_lockonOffset = locatorXf.origin - GetTranslation();
} }
x460_knockBackController.SetAutoResetImpulse(false); x460_knockBackController.SetAutoResetImpulse(false);
} }
static const SSphereJointDescription kArmCollision[]=
{
{"Arm_4", 1.5f},
{"Arm_6", 1.f},
{"Arm_7", 1.f},
{"Arm_8", 1.f},
{"Arm_9", 1.f},
{"Arm_11", 1.f},
{"Swoosh_LCTR", 1.5f}
};
void CSpankWeed::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
{
bool oldActive = GetActive();
if (msg == EScriptObjectMessage::Activate)
{
if (x90_actorLights)
x90_actorLights->SetDirty();
}
else if (msg == EScriptObjectMessage::Decrement)
{
if (x5b4_ != 0 && x5b4_ != 5 && x5b4_ != 6 && x5b4_ != 4)
{
x400_24_hitByPlayerProjectile = true;
x428_damageCooldownTimer = x424_damageWaitTime;
}
}
else if (msg == EScriptObjectMessage::Registered)
{
if (!x450_bodyController->GetActive())
{
x450_bodyController->Activate(mgr);
zeus::CVector3f extents = GetBoundingBox().extents();
SetBoundingBox({-extents, extents});
}
std::vector<CJointCollisionDescription> joints;
joints.reserve(12);
for (const SSphereJointDescription& joint : kArmCollision)
{
CSegId id = GetModelData()->GetAnimationData()->GetLocatorSegId(joint.name);
if (id != 0xFF)
joints.push_back(CJointCollisionDescription::SphereCollision(id, joint.radius, joint.name, 0.001f));
}
x594_collisionMgr.reset(new CCollisionActorManager(mgr, GetUniqueId(), GetAreaIdAlways(), joints, GetActive()));
CMaterialList list;
list.Add(EMaterialTypes::CameraPassthrough);
list.Add(EMaterialTypes::Immovable);
x594_collisionMgr->AddMaterial(mgr, list);
if (x90_actorLights)
{
x90_actorLights->SetDirty();
zeus::CVector3f swooshOrigin = GetScaledLocatorTransform("swoosh_LCTR"sv).origin;
x90_actorLights->SetActorPositionBias(GetTransform().buildMatrix3f() * swooshOrigin);
}
}
else if (msg == EScriptObjectMessage::Touched)
{
if (TCastToPtr<CCollisionActor> colAct = mgr.ObjectById(uid))
{
if (TCastToPtr<CPlayer> player = mgr.ObjectById(colAct->GetLastTouchedObject()))
{
if (x420_curDamageRemTime < 0.f && x5b4_ != 4 && x5b4_ != 6)
{
mgr.ApplyDamage(GetUniqueId(), player->GetUniqueId(), GetUniqueId(), GetContactDamage(),
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), {});
x420_curDamageRemTime = x424_damageWaitTime;
}
}
}
}
else if (msg == EScriptObjectMessage::Deleted)
{
mgr.FreeScriptObject(x590_);
x594_collisionMgr->Destroy(mgr);
}
else if (msg == EScriptObjectMessage::SuspendedMove)
{
x594_collisionMgr->SetMovable(mgr, false);
}
CPatterned::AcceptScriptMsg(msg, uid, mgr);
if (GetActive() != oldActive)
x594_collisionMgr.reset();
}
void CSpankWeed::Think(float dt, CStateManager& mgr)
{
if (!GetActive())
return;
HealthInfo(mgr)->SetHP(1000000.0f);
if (!x598_isHiding)
{
zeus::CVector3f eyeOrigin = GetLocatorTransform("Eye"sv).origin;
MoveCollisionPrimitive(GetModelData()->GetScale() * eyeOrigin);
x594_collisionMgr->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace);
xe4_27_notInSortedLists = true;
}
CPatterned::Think(dt, mgr);
}
zeus::CVector3f CSpankWeed::GetOrbitPosition(const CStateManager& mgr) const
{
zeus::CVector3f ret = CPatterned::GetOrbitPosition(mgr);
float delay = std::max(1.f, x330_stateMachineState.GetDelay());
if (x5b4_ == 3 && x5b8_ == 2)
{
return (ret * (1.f - delay) + ((GetTranslation() + x59c_lockonOffset) * delay));
}
else if (x5b4_ == 2 && x5b8_ == 3)
{
return (GetTranslation() + x59c_lockonOffset) * (1.f - delay) + (ret * delay);
}
return ret;
}
zeus::CVector3f CSpankWeed::GetAimPosition(const CStateManager&, float dt) const
{
zeus::CVector3f pos = (dt > 0.f ? PredictMotion(dt).x0_translation : zeus::CVector3f::skZero);
CSegId id = GetModelData()->GetAnimationData()->GetLocatorSegId("lockon_target_LCTR"sv);
if (id != 0xFF)
{
zeus::CVector3f lockonOff = GetModelData()->GetAnimationData()->GetLocatorTransform(id, nullptr).origin;
return pos + (GetTransform() * (GetModelData()->GetScale() * lockonOff));
}
return pos + GetBoundingBox().center();
}
void CSpankWeed::Flinch(CStateManager& mgr, EStateMsg msg, float)
{
if (msg == EStateMsg::Activate)
{
x5bc_ = 0;
x5b4_ = 0;
RemoveMaterial(EMaterialTypes::Orbit, EMaterialTypes::Target, mgr);
}
else if (msg == EStateMsg::Update)
{
if (x5bc_ == 0)
{
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::KnockBack)
x5bc_ = 2;
else
x450_bodyController->GetCommandMgr().DeliverCmd(CBCKnockBackCmd({}, pas::ESeverity::Zero));
}
else if (x5bc_ == 2 && x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::KnockBack)
x5bc_ = 3;
}
else if (msg == EStateMsg::Deactivate)
{
x5b8_ = 4;
}
}
bool CSpankWeed::Delay(CStateManager&, float)
{
if (x400_24_hitByPlayerProjectile)
{
if (x330_stateMachineState.GetTime() > x578_hideTime)
{
x400_24_hitByPlayerProjectile = false;
return true;
}
return false;
}
return true;
}
bool CSpankWeed::InRange(CStateManager& mgr, float)
{
float playerDist = GetPlayerDistance(mgr);
if (x56c_detectionHeightRange > 0.f)
{
return std::fabs(mgr.GetPlayer().GetTranslation().z - GetTranslation().z) < x56c_detectionHeightRange &&
playerDist < (x574_maxSightRange * x574_maxSightRange);
}
return playerDist < (x574_maxSightRange * x574_maxSightRange);
}
bool CSpankWeed::HearPlayer(CStateManager& mgr, float)
{
float playerDist = GetPlayerDistance(mgr);
if (x56c_detectionHeightRange > 0.f)
{
return std::fabs(mgr.GetPlayer().GetTranslation().z - GetTranslation().z) < x56c_detectionHeightRange &&
playerDist < (x570_maxHearingRange * x570_maxHearingRange);
}
return playerDist < (x570_maxHearingRange * x570_maxHearingRange);
}
bool CSpankWeed::InDetectionRange(CStateManager& mgr, float)
{
float playerDist = GetPlayerDistance(mgr);
if (x56c_detectionHeightRange > 0.f)
{
return std::fabs(mgr.GetPlayer().GetTranslation().z - GetTranslation().z) < x56c_detectionHeightRange &&
playerDist < (x568_maxDetectionRange * x568_maxDetectionRange);
}
return playerDist < (x568_maxDetectionRange * x568_maxDetectionRange);
}
void CSpankWeed::Attack(CStateManager&, EStateMsg msg, float)
{
if (msg == EStateMsg::Activate)
{
x450_bodyController->GetCommandMgr().DeliverCmd(CBCMeleeAttackCmd(pas::ESeverity::Zero));
}
else if (msg == EStateMsg::Update)
{
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::MeleeAttack)
return;
x450_bodyController->GetCommandMgr().DeliverCmd(CBCMeleeAttackCmd(pas::ESeverity::Zero));
}
else if (msg == EStateMsg::Deactivate)
{
x5b8_ = 3;
}
}
void CSpankWeed::TargetPatrol(CStateManager& mgr, EStateMsg msg, float)
{
if (msg == EStateMsg::Activate)
{
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Combat);
RemoveMaterial(EMaterialTypes::Solid, mgr);
x5b4_ = 2;
}
else if (msg == EStateMsg::Deactivate)
{
x5b8_ = 2;
}
}
void CSpankWeed::Lurk(CStateManager& mgr, EStateMsg msg, float)
{
if (msg == EStateMsg::Activate)
{
x460_knockBackController.SetEnableFreeze(true);
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Lurk);
RemoveMaterial(EMaterialTypes::Solid, mgr);
x5b4_ = 1;
}
else if (msg == EStateMsg::Deactivate)
{
x5b8_ = 1;
}
}
void CSpankWeed::FadeOut(CStateManager&, EStateMsg msg, float)
{
if (msg == EStateMsg::Activate)
{
x5bc_ = 0;
x57c_canKnockBack = false;
x5b4_ = 6;
}
else if (msg == EStateMsg::Update)
{
if (x5bc_ == 0)
{
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Step)
x5bc_ = 2;
else
x450_bodyController->GetCommandMgr().DeliverCmd(
CBCStepCmd(pas::EStepDirection::Backward, pas::EStepType::Normal));
}
else if (x5bc_ == 2)
{
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Step)
x5bc_ = 3;
}
}
else if (msg == EStateMsg::Deactivate)
{
x5b8_ = 6;
}
}
void CSpankWeed::FadeIn(CStateManager& mgr, EStateMsg msg, float)
{
if (msg == EStateMsg::Activate)
{
x5bc_ = 0;
x57c_canKnockBack = true;
x5b4_ = 5;
}
else if (msg == EStateMsg::Update)
{
if (x5bc_ == 0)
{
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Step)
x5bc_ = 2;
else
x450_bodyController->GetCommandMgr().DeliverCmd(
CBCStepCmd(pas::EStepDirection::Forward, pas::EStepType::Normal));
}
else if (x5bc_ == 2)
{
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Step)
x5bc_ = 3;
}
}
else if (msg == EStateMsg::Deactivate)
{
x5b8_ = 5;
}
xe7_28_worldLightingDirty = true;
}
void CSpankWeed::Patrol(CStateManager& mgr, EStateMsg msg, float)
{
if (msg == EStateMsg::Activate)
{
x460_knockBackController.SetEnableFreeze(false);
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Relaxed);
RemoveMaterial(EMaterialTypes::Solid, EMaterialTypes::Scannable, mgr);
RemoveMaterial(EMaterialTypes::Orbit, EMaterialTypes::Target, mgr);
x594_collisionMgr->SetActive(mgr, false);
x598_isHiding = true;
x5b4_ = 0;
}
else if (msg == EStateMsg::Deactivate)
{
AddMaterial(EMaterialTypes::Orbit, EMaterialTypes::Target, EMaterialTypes::Scannable, mgr);
SetTranslation(x584_retreatOrigin);
x594_collisionMgr->SetActive(mgr, true);
x598_isHiding = false;
x460_knockBackController.SetEnableFreeze(true);
x5b8_ = 0;
}
}
void CSpankWeed::KnockBack(const zeus::CVector3f& backVec, CStateManager& mgr, const CDamageInfo& info,
EKnockBackType type, bool inDeferred, float magnitude)
{
if (!x57c_canKnockBack)
return;
CPatterned::KnockBack(backVec, mgr, info, type, inDeferred, magnitude);
x57c_canKnockBack = false;
}
float CSpankWeed::GetPlayerDistance(CStateManager& mgr) const
{
return (mgr.GetPlayer().GetTranslation() - x5a8_lockonTarget).magSquared();
}
} }

View File

@ -7,25 +7,47 @@ namespace urde::MP1
{ {
class CSpankWeed : public CPatterned class CSpankWeed : public CPatterned
{ {
float x568_; float x568_maxDetectionRange;
float x56c_; float x56c_detectionHeightRange;
float x570_; float x570_maxHearingRange;
float x574_; float x574_maxSightRange;
float x578_; float x578_hideTime;
bool x57c_ = false; bool x57c_canKnockBack = false;
float x580_ = 0.f; /* float x580_ = 0.f; unused */
zeus::CVector3f x584_retreatOrigin;
TUniqueId x590_ = kInvalidUniqueId;
std::unique_ptr<CCollisionActorManager> x594_collisionMgr; std::unique_ptr<CCollisionActorManager> x594_collisionMgr;
zeus::CVector3f x584_; bool x598_isHiding = true;
zeus::CVector3f x59c_; zeus::CVector3f x59c_lockonOffset;
zeus::CVector3f x5a8_; zeus::CVector3f x5a8_lockonTarget;
s32 x5b4_ = -1; s32 x5b4_ = -1;
s32 x5b8_ = -1; s32 x5b8_ = -1;
s32 x5bc_ = -1; s32 x5bc_ = -1;
float GetPlayerDistance(CStateManager&) const;
public: public:
DEFINE_PATTERNED(SpankWeed) DEFINE_PATTERNED(SpankWeed)
CSpankWeed(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&, CSpankWeed(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const CActorParameters&, const CPatternedInfo&, float, float, float, float); const CActorParameters&, const CPatternedInfo&, float, float, float, float);
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
void Think(float, CStateManager&);
zeus::CVector3f GetOrbitPosition(const CStateManager&) const;
zeus::CVector3f GetAimPosition(const CStateManager&, float) const;
bool AnimOver(CStateManager&, float) { return x5bc_ == 3; }
void Flinch(CStateManager&, EStateMsg, float);
bool Delay(CStateManager&, float);
bool InRange(CStateManager&, float);
bool HearPlayer(CStateManager&, float);
bool InDetectionRange(CStateManager&, float);
void Attack(CStateManager&, EStateMsg, float);
void TargetPatrol(CStateManager&, EStateMsg, float);
void Lurk(CStateManager&, EStateMsg, float);
void FadeOut(CStateManager&, EStateMsg, float);
void FadeIn(CStateManager&, EStateMsg, float);
void Patrol(CStateManager&, EStateMsg, float);
void KnockBack(const zeus::CVector3f&, CStateManager&, const CDamageInfo& info,
EKnockBackType type, bool inDeferred, float magnitude);
}; };
} }

View File

@ -36,7 +36,7 @@ CAi::CAi(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& i
} }
if (x90_actorLights) if (x90_actorLights)
x260_damageVulnerability.SetX38_25(true); x90_actorLights->SetCastShadows(true);
} }
void CAi::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) void CAi::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)

View File

@ -34,9 +34,7 @@ class CDamageVulnerability
EVulnerability x2c_enemyWp3Lava; EVulnerability x2c_enemyWp3Lava;
EVulnerability x30_enemyWp4; EVulnerability x30_enemyWp4;
EVulnerability x34_unk1; EVulnerability x34_unk1;
/* FIXME: What's going on here? */
EVulnerability x38_unk2; EVulnerability x38_unk2;
bool x38_25 : 1;
EVulnerability x3c_chargedPower; EVulnerability x3c_chargedPower;
EVulnerability x40_chargedIce; EVulnerability x40_chargedIce;
@ -80,7 +78,6 @@ public:
static const CDamageVulnerability& ImmuneVulnerabilty() { return sImmuneVulnerability; } static const CDamageVulnerability& ImmuneVulnerabilty() { return sImmuneVulnerability; }
static const CDamageVulnerability& ReflectVulnerabilty() { return sReflectVulnerability; } static const CDamageVulnerability& ReflectVulnerabilty() { return sReflectVulnerability; }
static const CDamageVulnerability& PasshThroughVulnerabilty() { return sPassThroughVulnerability; } static const CDamageVulnerability& PasshThroughVulnerabilty() { return sPassThroughVulnerability; }
void SetX38_25(bool) { x38_25 = true; }
}; };
} }

View File

@ -69,6 +69,7 @@
#include "CScriptSound.hpp" #include "CScriptSound.hpp"
#include "CScriptSpawnPoint.hpp" #include "CScriptSpawnPoint.hpp"
#include "CScriptSpecialFunction.hpp" #include "CScriptSpecialFunction.hpp"
#include "MP1/World/CSpankWeed.hpp"
#include "MP1/World/CBabygoth.hpp" #include "MP1/World/CBabygoth.hpp"
#include "MP1/World/CEyeball.hpp" #include "MP1/World/CEyeball.hpp"
#include "CScriptSteam.hpp" #include "CScriptSteam.hpp"
@ -1906,7 +1907,29 @@ CEntity* ScriptLoader::LoadSpecialFunction(CStateManager& mgr, CInputStream& in,
CEntity* ScriptLoader::LoadSpankWeed(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) CEntity* ScriptLoader::LoadSpankWeed(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{ {
if (!EnsurePropertyCount(propCount, 11, "SpankWeed"))
return nullptr; return nullptr;
SScaledActorHead aHead = LoadScaledActorHead(in, mgr);
auto pair = CPatternedInfo::HasCorrectParameterCount(in);
if (!pair.first)
return nullptr;
CPatternedInfo pInfo(in, pair.second);
CActorParameters actParms = LoadActorParameters(in);
in.readBool();
float f1 = in.readFloatBig();
float f2 = in.readFloatBig();
float f3 = in.readFloatBig();
float f4 = in.readFloatBig();
const CAnimationParameters& animParms = pInfo.GetAnimationParameters();
if (!animParms.GetACSFile().IsValid())
return nullptr;
CModelData mData(CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), aHead.x40_scale,
animParms.GetInitialAnimation(), true));
return new MP1::CSpankWeed(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, std::move(mData),
actParms, pInfo, f1, f2, f3, f4);
} }
CEntity* ScriptLoader::LoadParasite(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) CEntity* ScriptLoader::LoadParasite(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)