mirror of https://github.com/AxioDL/metaforce.git
Initial CBabygoth imps
This commit is contained in:
parent
147a9396c4
commit
4f3c8daf27
|
@ -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" />
|
||||||
|
|
|
@ -91,7 +91,7 @@ private:
|
||||||
TLockedToken<CCharacterFactory> x0_charFactory;
|
TLockedToken<CCharacterFactory> x0_charFactory;
|
||||||
CCharacterInfo xc_charInfo;
|
CCharacterInfo xc_charInfo;
|
||||||
TLockedToken<CCharLayoutInfo> xcc_layoutData;
|
TLockedToken<CCharLayoutInfo> xcc_layoutData;
|
||||||
TCachedToken<CSkinnedModel> xd8_modelData;
|
TLockedToken<CSkinnedModel> xd8_modelData;
|
||||||
TLockedToken<CMorphableSkinnedModel> xe4_iceModelData;
|
TLockedToken<CMorphableSkinnedModel> xe4_iceModelData;
|
||||||
std::shared_ptr<CSkinnedModel> xf4_xrayModel;
|
std::shared_ptr<CSkinnedModel> xf4_xrayModel;
|
||||||
std::shared_ptr<CSkinnedModel> xf8_infraModel;
|
std::shared_ptr<CSkinnedModel> xf8_infraModel;
|
||||||
|
@ -214,7 +214,7 @@ public:
|
||||||
std::shared_ptr<CSkinnedModel> GetXRayModel() const { return xf4_xrayModel; }
|
std::shared_ptr<CSkinnedModel> GetXRayModel() const { return xf4_xrayModel; }
|
||||||
void SetInfraModel(const TLockedToken<CModel>& model, const TLockedToken<CSkinRules>& skinRules);
|
void SetInfraModel(const TLockedToken<CModel>& model, const TLockedToken<CSkinRules>& skinRules);
|
||||||
std::shared_ptr<CSkinnedModel> GetInfraModel() const { return xf8_infraModel; }
|
std::shared_ptr<CSkinnedModel> GetInfraModel() const { return xf8_infraModel; }
|
||||||
const TCachedToken<CSkinnedModel>& GetModelData() const { return xd8_modelData; }
|
const TLockedToken<CSkinnedModel>& GetModelData() const { return xd8_modelData; }
|
||||||
|
|
||||||
static void PoseSkinnedModel(CSkinnedModel& model, const CPoseAsTransforms& pose, const CModelFlags& drawFlags,
|
static void PoseSkinnedModel(CSkinnedModel& model, const CPoseAsTransforms& pose, const CModelFlags& drawFlags,
|
||||||
const std::experimental::optional<CVertexMorphEffect>& morphEffect,
|
const std::experimental::optional<CVertexMorphEffect>& morphEffect,
|
||||||
|
|
|
@ -557,7 +557,7 @@ void CGroundMovement::MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor&
|
||||||
if (usePrim->GetPrimType() == FOURCC('AABX')) {
|
if (usePrim->GetPrimType() == FOURCC('AABX')) {
|
||||||
const CCollidableAABox& existingAABB = static_cast<const CCollidableAABox&>(*usePrim);
|
const CCollidableAABox& existingAABB = static_cast<const CCollidableAABox&>(*usePrim);
|
||||||
prim.reset(
|
prim.reset(
|
||||||
new CCollidableAABox(zeus::CAABox(existingAABB.GetAABB().min + 0.0001f, existingAABB.GetAABB().max - 0.0001f),
|
new CCollidableAABox(zeus::CAABox(existingAABB.GetBox().min + 0.0001f, existingAABB.GetBox().max - 0.0001f),
|
||||||
usePrim->GetMaterial()));
|
usePrim->GetMaterial()));
|
||||||
usePrim = prim.get();
|
usePrim = prim.get();
|
||||||
} else if (usePrim->GetPrimType() == FOURCC('SPHR')) {
|
} else if (usePrim->GetPrimType() == FOURCC('SPHR')) {
|
||||||
|
|
|
@ -24,7 +24,8 @@ public:
|
||||||
virtual zeus::CAABox CalculateLocalAABox() const;
|
virtual zeus::CAABox CalculateLocalAABox() const;
|
||||||
virtual FourCC GetPrimType() const;
|
virtual FourCC GetPrimType() const;
|
||||||
virtual CRayCastResult CastRayInternal(const CInternalRayCastStructure&) const;
|
virtual CRayCastResult CastRayInternal(const CInternalRayCastStructure&) const;
|
||||||
const zeus::CAABox& GetAABB() const { return x10_aabox; }
|
const zeus::CAABox& GetBox() const { return x10_aabox; }
|
||||||
|
zeus::CAABox& Box() { return x10_aabox; }
|
||||||
|
|
||||||
static const CCollisionPrimitive::Type& GetType();
|
static const CCollisionPrimitive::Type& GetType();
|
||||||
static void SetStaticTableIndex(u32 index);
|
static void SetStaticTableIndex(u32 index);
|
||||||
|
|
|
@ -186,4 +186,23 @@ zeus::CTransform CCollisionActorManager::GetWRLocatorTransform(const CAnimData&
|
||||||
return locXf;
|
return locXf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<zeus::CVector3f> CCollisionActorManager::GetDeviation(const CStateManager& mgr, CSegId seg) {
|
||||||
|
for (const CJointCollisionDescription& desc : x0_jointDescriptions) {
|
||||||
|
if (desc.GetPivotId() != seg)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (TCastToConstPtr<CActor> act = mgr.GetObjectById(x10_ownerId)) {
|
||||||
|
if (TCastToConstPtr<CCollisionActor> colAct = mgr.GetObjectById(desc.GetCollisionActorId())) {
|
||||||
|
zeus::CTransform xf = GetWRLocatorTransform(*act->GetModelData()->GetAnimationData(), desc.GetPivotId(),
|
||||||
|
act->GetTransform(),
|
||||||
|
zeus::CTransform::Scale(act->GetModelData()->GetScale()));
|
||||||
|
|
||||||
|
return {colAct->GetTranslation() - xf.origin};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace urde
|
} // namespace urde
|
||||||
|
|
|
@ -31,6 +31,7 @@ public:
|
||||||
void SetMovable(CStateManager& mgr, bool movable);
|
void SetMovable(CStateManager& mgr, bool movable);
|
||||||
|
|
||||||
u32 GetNumCollisionActors() const { return x0_jointDescriptions.size(); }
|
u32 GetNumCollisionActors() const { return x0_jointDescriptions.size(); }
|
||||||
|
std::optional<zeus::CVector3f> GetDeviation(const CStateManager&, CSegId);
|
||||||
const CJointCollisionDescription& GetCollisionDescFromIndex(u32 i) const { return x0_jointDescriptions[i]; }
|
const CJointCollisionDescription& GetCollisionDescFromIndex(u32 i) const { return x0_jointDescriptions[i]; }
|
||||||
static zeus::CTransform GetWRLocatorTransform(const CAnimData& animData, CSegId id, const zeus::CTransform& worldXf,
|
static zeus::CTransform GetWRLocatorTransform(const CAnimData& animData, CSegId id, const zeus::CTransform& worldXf,
|
||||||
const zeus::CTransform& localXf);
|
const zeus::CTransform& localXf);
|
||||||
|
|
|
@ -369,7 +369,7 @@ float CGameCollision::GetMinExtentForCollisionPrimitive(const CCollisionPrimitiv
|
||||||
return 2.f * sphere.GetSphere().radius;
|
return 2.f * sphere.GetSphere().radius;
|
||||||
} else if (prim.GetPrimType() == FOURCC('AABX')) {
|
} else if (prim.GetPrimType() == FOURCC('AABX')) {
|
||||||
const CCollidableAABox& aabx = static_cast<const CCollidableAABox&>(prim);
|
const CCollidableAABox& aabx = static_cast<const CCollidableAABox&>(prim);
|
||||||
const zeus::CVector3f extent = aabx.GetAABB().max - aabx.GetAABB().min;
|
const zeus::CVector3f extent = aabx.GetBox().max - aabx.GetBox().min;
|
||||||
float minExtent = std::min(extent.x(), extent.y());
|
float minExtent = std::min(extent.x(), extent.y());
|
||||||
minExtent = std::min(minExtent, extent.z());
|
minExtent = std::min(minExtent, extent.z());
|
||||||
return minExtent;
|
return minExtent;
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
#include "zeus/CAABox.hpp"
|
#include "zeus/CAABox.hpp"
|
||||||
|
|
||||||
namespace urde {
|
namespace urde {
|
||||||
struct SOBBJointDescription {
|
struct SOBBJointInfo {
|
||||||
const char* from;
|
const char* from;
|
||||||
const char* to;
|
const char* to;
|
||||||
zeus::CVector3f bounds;
|
zeus::CVector3f bounds;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SSphereJointDescription {
|
struct SSphereJointInfo {
|
||||||
const char* name;
|
const char* name;
|
||||||
float radius;
|
float radius;
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,6 +31,7 @@ public:
|
||||||
const TLockedToken<CModel>& GetModel() const { return x4_model; }
|
const TLockedToken<CModel>& GetModel() const { return x4_model; }
|
||||||
const std::unique_ptr<CBooModel>& GetModelInst() const { return m_modelInst; }
|
const std::unique_ptr<CBooModel>& GetModelInst() const { return m_modelInst; }
|
||||||
const TLockedToken<CSkinRules>& GetSkinRules() const { return x10_skinRules; }
|
const TLockedToken<CSkinRules>& GetSkinRules() const { return x10_skinRules; }
|
||||||
|
void SetLayoutInfo(const TLockedToken<CCharLayoutInfo>& inf) { x1c_layoutInfo = inf; }
|
||||||
const TLockedToken<CCharLayoutInfo>& GetLayoutInfo() const { return x1c_layoutInfo; }
|
const TLockedToken<CCharLayoutInfo>& GetLayoutInfo() const { return x1c_layoutInfo; }
|
||||||
|
|
||||||
void Calculate(const CPoseAsTransforms& pose, const CModelFlags& drawFlags,
|
void Calculate(const CPoseAsTransforms& pose, const CModelFlags& drawFlags,
|
||||||
|
|
|
@ -44,7 +44,7 @@ void MP1::CActorContraption::Think(float dt, CStateManager& mgr) {
|
||||||
CFlameThrower* act = static_cast<CFlameThrower*>(mgr.ObjectById(uid.first));
|
CFlameThrower* act = static_cast<CFlameThrower*>(mgr.ObjectById(uid.first));
|
||||||
|
|
||||||
if (act && act->GetActive())
|
if (act && act->GetActive())
|
||||||
act->SetTransform(x34_transform * act->GetScaledLocatorTransform(uid.second));
|
act->SetTransform(x34_transform * act->GetScaledLocatorTransform(uid.second), dt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,44 +1,428 @@
|
||||||
#include "CBabygoth.hpp"
|
#include "CBabygoth.hpp"
|
||||||
|
#include "Character/CPASAnimParmData.hpp"
|
||||||
|
#include "Collision/CCollisionActorManager.hpp"
|
||||||
|
#include "Collision/CCollisionActor.hpp"
|
||||||
|
#include "World/CWorld.hpp"
|
||||||
|
#include "World/CGameArea.hpp"
|
||||||
|
#include "World/CPatternedInfo.hpp"
|
||||||
|
#include "World/CPlayer.hpp"
|
||||||
|
#include "World/CTeamAiMgr.hpp"
|
||||||
|
#include "Weapon/CWeapon.hpp"
|
||||||
|
#include "Weapon/CFlameThrower.hpp"
|
||||||
|
#include "Weapon/CFlameInfo.hpp"
|
||||||
|
#include "Particle/CWeaponDescription.hpp"
|
||||||
|
#include "CStateManager.hpp"
|
||||||
|
#include "CSimplePool.hpp"
|
||||||
|
#include "GameGlobalObjects.hpp"
|
||||||
|
#include "Graphics/CSkinnedModel.hpp"
|
||||||
|
#include "TCastTo.hpp"
|
||||||
|
|
||||||
namespace urde::MP1 {
|
namespace urde::MP1 {
|
||||||
|
const std::string_view CBabygoth::skpMouthDamageJoint = "LCTR_SHEMOUTH"sv;
|
||||||
CBabygothData::CBabygothData(CInputStream& in)
|
CBabygothData::CBabygothData(CInputStream& in)
|
||||||
: x0_(in.readFloatBig())
|
: x0_(in.readFloatBig())
|
||||||
, x4_(in.readFloatBig())
|
, x4_(in.readFloatBig())
|
||||||
, x8_(in)
|
, x8_(in)
|
||||||
, xc_(in)
|
, xc_(in)
|
||||||
, x28_(in)
|
, x28_(in)
|
||||||
, x44_(in)
|
, x44_(in)
|
||||||
, x48_(in)
|
, x48_fireBreathRes(in)
|
||||||
, x4c_(in)
|
, x4c_fireBreathDamage(in)
|
||||||
, x68_(in)
|
, x68_(in)
|
||||||
, xd0_(in)
|
, xd0_shellVulnerabilities(in)
|
||||||
, x138_(in)
|
, x138_(in)
|
||||||
, x13c_(in)
|
, x13c_(in)
|
||||||
, x140_(in.readFloatBig())
|
, x140_shellHitPoints(in.readFloatBig())
|
||||||
, x144_(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
, x144_shellCrackSfx(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
||||||
, x148_(in)
|
, x148_(in)
|
||||||
, x14c_(in)
|
, x14c_(in)
|
||||||
, x150_(in)
|
, x150_(in)
|
||||||
, x154_(in)
|
, x154_(in)
|
||||||
, x158_(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
, x158_(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
||||||
, x15c_(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
, x15a_(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
||||||
, x160_(in.readFloatBig())
|
, x15c_(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
||||||
, x164_(in.readFloatBig())
|
, x160_(in.readFloatBig())
|
||||||
, x168_(in.readFloatBig())
|
, x164_(in.readFloatBig())
|
||||||
, x16c_(in)
|
, x168_(in.readFloatBig())
|
||||||
, x170_(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
, x16c_(in)
|
||||||
, x174_(in) {}
|
, x170_(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
||||||
|
, x174_(in) {}
|
||||||
|
|
||||||
CBabygoth::CBabygoth(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
CBabygoth::CBabygoth(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||||
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms,
|
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms,
|
||||||
const CBabygothData& babyData)
|
const CBabygothData& babyData)
|
||||||
: CPatterned(ECharacter::Babygoth, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
|
: CPatterned(ECharacter::Babygoth, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
|
||||||
EMovementType::Ground, EColliderType::One, EBodyType::BiPedal, actParms, EKnockBackVariant::Medium) {}
|
EMovementType::Ground, EColliderType::One, EBodyType::BiPedal, actParms, EKnockBackVariant::Medium)
|
||||||
|
, x570_babyData(babyData)
|
||||||
|
, x6ec_(nullptr, 1, pInfo.GetPathfindingIndex(), 1.f, 1.f)
|
||||||
|
, x7d0_(nullptr, 1, pInfo.GetPathfindingIndex(), 1.f, 1.f)
|
||||||
|
, x8d0_(x3b4_speed)
|
||||||
|
, x8f0_boneTracking(*ModelData()->AnimationData(), "Head_1"sv, zeus::degToRad(80.f), zeus::degToRad(180.f), false)
|
||||||
|
, x930_aabox(GetBoundingBox(), GetMaterialList())
|
||||||
|
, x958_(babyData.x8_, babyData.xc_)
|
||||||
|
, x984_flameThrowerDesc(babyData.x44_.IsValid() ? g_SimplePool->GetObj({SBIG('WPSC'), babyData.x44_})
|
||||||
|
: g_SimplePool->GetObj("FlameThrower"sv))
|
||||||
|
, x98c_(pInfo.GetDamageVulnerability())
|
||||||
|
, xa00_shellHitPoints(babyData.GetShellHitPoints()) {
|
||||||
|
TLockedToken<CModel> model = g_SimplePool->GetObj({SBIG('CMDL'), babyData.x138_});
|
||||||
|
TLockedToken<CSkinRules> skin = g_SimplePool->GetObj({SBIG('CSKR'), babyData.x13c_});
|
||||||
|
xa08_noShellModel = CToken(
|
||||||
|
TObjOwnerDerivedFromIObj<CSkinnedModel>::GetNewDerivedObject(std::make_unique<CSkinnedModel>(
|
||||||
|
model, skin, x64_modelData->AnimationData()->GetModelData()->GetLayoutInfo(), 1, 1)));
|
||||||
|
xa14_ = g_SimplePool->GetObj({SBIG('PART'), babyData.x14c_});
|
||||||
|
xa20_ = g_SimplePool->GetObj({SBIG('PART'), babyData.x150_});
|
||||||
|
xa2c_ = g_SimplePool->GetObj({SBIG('PART'), babyData.x154_});
|
||||||
|
if (x570_babyData.x148_.IsValid())
|
||||||
|
xa38_ = g_SimplePool->GetObj({SBIG('PART'), babyData.x148_});
|
||||||
|
xa48_31_ = true;
|
||||||
|
const_cast<TToken<CWeaponDescription>*>(&x958_.Token())->Lock();
|
||||||
|
UpdateTouchBounds();
|
||||||
|
x460_knockBackController.SetEnableFreeze(false);
|
||||||
|
x460_knockBackController.SetAutoResetImpulse(true);
|
||||||
|
x460_knockBackController.SetEnableShock(true);
|
||||||
|
x460_knockBackController.SetEnableExplodeDeath(true);
|
||||||
|
x8d4_stepBackwardDist =
|
||||||
|
GetAnimationDistance(CPASAnimParmData(3, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(0))) *
|
||||||
|
GetModelData()->GetScale().y(); // B_backward_sheegoth
|
||||||
|
xa08_noShellModel->SetLayoutInfo(GetModelData()->GetAnimationData()->GetModelData()->GetLayoutInfo());
|
||||||
|
MakeThermalColdAndHot();
|
||||||
|
}
|
||||||
|
|
||||||
void CBabygoth::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
|
void CBabygoth::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
|
||||||
CPatterned::AcceptScriptMsg(msg, uid, mgr);
|
switch (msg) {
|
||||||
if (msg == EScriptObjectMessage::Registered) {
|
case EScriptObjectMessage::Registered: {
|
||||||
|
if (!HasPatrolPath(mgr, 0.f))
|
||||||
|
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Crouch);
|
||||||
x450_bodyController->Activate(mgr);
|
x450_bodyController->Activate(mgr);
|
||||||
|
SetupCollisionManager(mgr);
|
||||||
|
CreateFlameThrower(mgr);
|
||||||
|
const CBodyStateInfo& bStateInfo = x450_bodyController->GetBodyStateInfo();
|
||||||
|
float maxSpeed = bStateInfo.GetMaxSpeed();
|
||||||
|
x450_bodyController->GetCommandMgr().SetSteeringSpeedRange(
|
||||||
|
0.f, maxSpeed <= 0.f ? 1.f : bStateInfo.GetLocomotionSpeed(pas::ELocomotionAnim::Walk) / maxSpeed);
|
||||||
|
x9f4_mouthLocator = GetModelData()->GetAnimationData()->GetLocatorSegId(skpMouthDamageJoint);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EScriptObjectMessage::Activate:
|
||||||
|
x928_colActMgr->SetActive(mgr, true);
|
||||||
|
break;
|
||||||
|
case EScriptObjectMessage::Deactivate: {
|
||||||
|
x928_colActMgr->SetActive(mgr, false);
|
||||||
|
xa49_29_ = false;
|
||||||
|
RemoveFromTeam(mgr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EScriptObjectMessage::Deleted: {
|
||||||
|
x928_colActMgr->Destroy(mgr);
|
||||||
|
if (x980_flameThrower != kInvalidUniqueId) {
|
||||||
|
mgr.FreeScriptObject(x980_flameThrower);
|
||||||
|
x980_flameThrower = kInvalidUniqueId;
|
||||||
|
}
|
||||||
|
RemoveFromTeam(mgr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EScriptObjectMessage::Falling: {
|
||||||
|
if (!x450_bodyController->IsFrozen()) {
|
||||||
|
x150_momentum = {0.f, 0.f, -(GetGravityConstant() * GetMass())};
|
||||||
|
x328_27_onGround = false;
|
||||||
|
RemoveMaterial(EMaterialTypes::GroundCollider, mgr);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case EScriptObjectMessage::OnFloor: {
|
||||||
|
x328_27_onGround = true;
|
||||||
|
x150_momentum.zeroOut();
|
||||||
|
AddMaterial(EMaterialTypes::GroundCollider, mgr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case EScriptObjectMessage::Alert: {
|
||||||
|
xa48_24_isAlert = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EScriptObjectMessage::InitializedInArea: {
|
||||||
|
x6ec_.SetArea(mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways())->GetPostConstructed()->x10bc_pathArea);
|
||||||
|
x7d0_.SetArea(mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways())->GetPostConstructed()->x10bc_pathArea);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EScriptObjectMessage::Touched: {
|
||||||
|
ApplyContactDamage(uid, mgr);
|
||||||
|
if (TCastToPtr<CCollisionActor> colAct = mgr.ObjectById(uid))
|
||||||
|
if (TCastToConstPtr<CWeapon> wp = mgr.GetObjectById(colAct->GetLastTouchedObject()))
|
||||||
|
if (wp->GetOwnerId() == mgr.GetPlayer().GetUniqueId())
|
||||||
|
xa48_24_isAlert = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EScriptObjectMessage::Damage: {
|
||||||
|
if (TCastToPtr<CCollisionActor> colAct = mgr.ObjectById(uid)) {
|
||||||
|
if (TCastToConstPtr<CWeapon> wp = mgr.GetObjectById(colAct->GetLastTouchedObject())) {
|
||||||
|
if (wp->GetOwnerId() == mgr.GetPlayer().GetUniqueId()) {
|
||||||
|
if (IsMouthCollisionActor(uid)) {
|
||||||
|
TakeDamage({}, 0.f);
|
||||||
|
} else if (IsShell(uid)) {
|
||||||
|
TakeDamage({}, 0.f);
|
||||||
|
if (x56c_ != 3 && x56c_ != 0) {
|
||||||
|
zeus::CTransform xf = wp->GetTransform();
|
||||||
|
xf.rotateLocalZ(zeus::degToRad(180.f));
|
||||||
|
CrackShell(mgr, xa38_, xf, x570_babyData.GetShellCrackSfx(), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
KnockBack(GetTransform().frontVector(), mgr, wp->GetDamageInfo(), EKnockBackType::Radius, false,
|
||||||
|
wp->GetDamageInfo().GetKnockBackPower());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xa48_24_isAlert = true;
|
||||||
|
x8e8_ = 0.f;
|
||||||
|
mgr.InformListeners(GetTranslation(), EListenNoiseType::PlayerFire);
|
||||||
|
} else
|
||||||
|
sub8021d478(mgr, uid);
|
||||||
|
x400_24_hitByPlayerProjectile = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EScriptObjectMessage::SuspendedMove: {
|
||||||
|
if (x928_colActMgr)
|
||||||
|
x928_colActMgr->SetMovable(mgr, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
CPatterned::AcceptScriptMsg(msg, uid, mgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBabygoth::Think(float dt, CStateManager& mgr) {
|
||||||
|
if (!GetActive())
|
||||||
|
return;
|
||||||
|
|
||||||
|
sub8021ec58(dt, mgr);
|
||||||
|
if (xa49_26_) {
|
||||||
|
if (sub8023a180(x6e8_teamMgr, mgr) == 0)
|
||||||
|
sub8021d6e8(mgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
CPatterned::Think(dt, mgr);
|
||||||
|
if (x450_bodyController->IsElectrocuting())
|
||||||
|
x8f0_boneTracking.SetActive(false);
|
||||||
|
sub8021e2c4(dt);
|
||||||
|
ModelData()->AnimationData()->PreRender();
|
||||||
|
x8f0_boneTracking.Update(dt);
|
||||||
|
x8f0_boneTracking.PreRender(mgr, *ModelData()->AnimationData(), GetTransform(), GetModelData()->GetScale(),
|
||||||
|
*x450_bodyController);
|
||||||
|
x928_colActMgr->Update(dt, mgr, CCollisionActorManager::EUpdateOptions(xa49_29_));
|
||||||
|
xa49_29_ = true;
|
||||||
|
sub8021e708(mgr);
|
||||||
|
UpdateParticleEffects(dt, mgr);
|
||||||
|
TryToGetUp(mgr);
|
||||||
|
CheckShouldWakeUp(mgr, dt);
|
||||||
|
if (!x400_25_alive && x450_bodyController->GetBodyStateInfo().GetCurrentState()->IsDying())
|
||||||
|
ResetProjectileCollision(mgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
const SSphereJointInfo CBabygoth::skSphereJointList[skSphereJointCount] = {
|
||||||
|
{"L_knee", 1.2f},
|
||||||
|
{"R_knee", 1.2f},
|
||||||
|
{"LCTR_SHEMOUTH", 1.7f},
|
||||||
|
{"Pelvis", 1.2f},
|
||||||
|
{"butt_LCTR", 0.9f}
|
||||||
|
};
|
||||||
|
|
||||||
|
void CBabygoth::AddSphereCollisionList(const SSphereJointInfo* sphereJointInfo, s32 jointCount,
|
||||||
|
std::vector<CJointCollisionDescription>& jointList) {
|
||||||
|
for (s32 i = 0; i < jointCount; ++i) {
|
||||||
|
CSegId seg = GetModelData()->GetAnimationData()->GetLocatorSegId(sphereJointInfo[i].name);
|
||||||
|
jointList.push_back(CJointCollisionDescription::SphereCollision(seg, sphereJointInfo[i].radius,
|
||||||
|
sphereJointInfo[i].name, 1000.f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBabygoth::SetupCollisionManager(CStateManager& mgr) {
|
||||||
|
std::vector<CJointCollisionDescription> joints;
|
||||||
|
AddSphereCollisionList(skSphereJointList, skSphereJointCount, joints);
|
||||||
|
x928_colActMgr.reset(new CCollisionActorManager(mgr, GetUniqueId(), GetAreaIdAlways(), joints, false));
|
||||||
|
x928_colActMgr->SetActive(mgr, GetActive());
|
||||||
|
|
||||||
|
for (u32 i = 0; i < x928_colActMgr->GetNumCollisionActors(); ++i) {
|
||||||
|
TUniqueId id = x928_colActMgr->GetCollisionDescFromIndex(i).GetCollisionActorId();
|
||||||
|
if (TCastToPtr<CCollisionActor> colAct = mgr.ObjectById(id)) {
|
||||||
|
colAct->SetDamageVulnerability(x570_babyData.x68_);
|
||||||
|
if (colAct->GetName().find(skpMouthDamageJoint))
|
||||||
|
x9f6_ = id;
|
||||||
|
else if (colAct->GetName().find("Pelvis"sv)) {
|
||||||
|
x9f8_shellIds.push_back(id);
|
||||||
|
x300_maxAttackRange = 66;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SetupHealthInfo(mgr);
|
||||||
|
}
|
||||||
|
void CBabygoth::SetupHealthInfo(CStateManager& mgr) {
|
||||||
|
CHealthInfo* thisHealth = HealthInfo(mgr);
|
||||||
|
x8ec_ = thisHealth->GetHP();
|
||||||
|
for (const TUniqueId& uid : x9f8_shellIds) {
|
||||||
|
if (TCastToPtr<CCollisionActor> colAct = mgr.ObjectById(uid)) {
|
||||||
|
CHealthInfo* colHealth = colAct->HealthInfo(mgr);
|
||||||
|
colHealth->SetHP(x570_babyData.GetShellHitPoints());
|
||||||
|
colHealth->SetKnockbackResistance(thisHealth->GetKnockbackResistance());
|
||||||
|
colAct->SetDamageVulnerability(x570_babyData.GetShellDamageVulnerability());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
xa00_shellHitPoints = x570_babyData.GetShellHitPoints();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBabygoth::CreateFlameThrower(CStateManager& mgr) {
|
||||||
|
if (x980_flameThrower != kInvalidUniqueId)
|
||||||
|
return;
|
||||||
|
|
||||||
|
x980_flameThrower = mgr.AllocateUniqueId();
|
||||||
|
mgr.AddObject(new CFlameThrower(x984_flameThrowerDesc, "IceSheegoth_Flame"sv, EWeaponType::Plasma,
|
||||||
|
CFlameInfo(6, 4, x570_babyData.GetFireBreathResId(), 15, 0.0625f, 20.f, 1.f), {},
|
||||||
|
EMaterialTypes::CollisionActor, x570_babyData.GetFireBreathDamage(), x980_flameThrower,
|
||||||
|
GetAreaIdAlways(), GetUniqueId(), EProjectileAttrib::None, x570_babyData.x16c_,
|
||||||
|
x570_babyData.x170_, x570_babyData.x174_));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBabygoth::ApplyContactDamage(TUniqueId uid, CStateManager& mgr) {
|
||||||
|
if (TCastToConstPtr<CCollisionActor> colAct = mgr.GetObjectById(uid)) {
|
||||||
|
if (colAct->GetHealthInfo(mgr)->GetHP() > 0.f && colAct->GetLastTouchedObject() == mgr.GetPlayer().GetUniqueId()) {
|
||||||
|
if (xa48_28_) {
|
||||||
|
mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), x570_babyData.x28_,
|
||||||
|
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), {});
|
||||||
|
xa48_28_ = false;
|
||||||
|
x420_curDamageRemTime = x424_damageWaitTime;
|
||||||
|
} else if (x420_curDamageRemTime <= 0.f) {
|
||||||
|
mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), GetContactDamage(),
|
||||||
|
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), {});
|
||||||
|
x420_curDamageRemTime = x424_damageWaitTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBabygoth::RemoveFromTeam(urde::CStateManager& mgr) {
|
||||||
|
if (x6e8_teamMgr == kInvalidUniqueId)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (TCastToPtr<CTeamAiMgr> teamMgr = mgr.ObjectById(x6e8_teamMgr)) {
|
||||||
|
if (teamMgr->IsPartOfTeam(GetUniqueId()))
|
||||||
|
teamMgr->RemoveTeamAiRole(GetUniqueId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBabygoth::CrackShell(CStateManager&, const TLockedToken<CGenDescription>&, const zeus::CTransform&, s16, bool) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBabygoth::sub8021d478(CStateManager&, TUniqueId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBabygoth::Shock(CStateManager& mgr, float duration, float damage) {
|
||||||
|
if (x9f8_shellIds.empty())
|
||||||
|
return;
|
||||||
|
if (TCastToPtr<CCollisionActor> colAct = mgr.ObjectById(x9f8_shellIds[0])) {
|
||||||
|
EVulnerability vuln = colAct->GetDamageVulnerability()->GetVulnerability(CWeaponMode::Wave(), false);
|
||||||
|
if (vuln == EVulnerability::Weak) {
|
||||||
|
x450_bodyController->SetElectrocuting(1.5f * duration);
|
||||||
|
x3f0_pendingShockDamage = 1.5f * damage;
|
||||||
|
} else if (vuln == EVulnerability::Normal) {
|
||||||
|
x450_bodyController->SetElectrocuting(duration);
|
||||||
|
x3f0_pendingShockDamage = damage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBabygoth::UpdateTouchBounds() {
|
||||||
|
zeus::CAABox bounds({-1.5f, -1.5f, 0.f}, {1.5f, 1.5f, 2.f});
|
||||||
|
SetBoundingBox(bounds);
|
||||||
|
x930_aabox.Box() = bounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBabygoth::sub8021ec58(float dt, CStateManager& mgr) {
|
||||||
|
if (x450_bodyController->GetLocomotionType() == pas::ELocomotionType::Crouch ||
|
||||||
|
x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Step)
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto dev = x928_colActMgr->GetDeviation(mgr, x9f4_mouthLocator);
|
||||||
|
|
||||||
|
if (dev) {
|
||||||
|
const CPlayer& pl = mgr.GetPlayer();
|
||||||
|
if (GetModelData()->GetBounds().intersects(pl.GetBoundingBox())) {
|
||||||
|
if (dev->magnitude() > 0.9f * GetModelData()->GetScale().y()) {
|
||||||
|
zeus::CVector3f posDiff = GetTranslation() - pl.GetTranslation();
|
||||||
|
zeus::CVector3f xpos = GetTransform().transposeRotate(
|
||||||
|
(posDiff.dot(dev->magnitude() - 0.9f * GetModelData()->GetScale().y() * (*dev).normalized()) /
|
||||||
|
posDiff.magSquared()) * posDiff);
|
||||||
|
|
||||||
|
ApplyImpulseWR(GetMoveToORImpulseWR(xpos, dt), zeus::CAxisAngle::sIdentity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 CBabygoth::sub8023a180(TUniqueId, CStateManager&) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBabygoth::sub8021d6e8(CStateManager& mgr) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBabygoth::sub8021e2c4(float dt) {
|
||||||
|
if (x8d8_ > 0.f)
|
||||||
|
x8d8_ -= dt * (xa49_28_ ? 2.f : 1.f);
|
||||||
|
if (x8e4_ > 0.f)
|
||||||
|
x8e4_ -= dt * (xa49_28_ ? 2.f : 1.f);
|
||||||
|
if (x8e0_ > 0.f)
|
||||||
|
x8e0_ -= dt;
|
||||||
|
if (x8e8_ < x570_babyData.x168_)
|
||||||
|
x8e8_ += dt;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBabygoth::sub8021e708(CStateManager&) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBabygoth::UpdateParticleEffects(float dt, CStateManager& mgr) {
|
||||||
|
if (CFlameThrower* flame = static_cast<CFlameThrower*>(mgr.ObjectById(x980_flameThrower))) {
|
||||||
|
if (!flame->GetActive())
|
||||||
|
return;
|
||||||
|
flame->SetTransform(GetLctrTransform(skpMouthDamageJoint), dt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBabygoth::TryToGetUp(CStateManager& mgr) {
|
||||||
|
if (!x400_25_alive || x450_bodyController->GetFallState() == pas::EFallState::Zero || xa49_24_)
|
||||||
|
return;
|
||||||
|
|
||||||
|
x330_stateMachineState.SetState(mgr, *this, GetStateMachine(), "GetUp"sv);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CBabygoth::CheckShouldWakeUp(CStateManager& mgr, float dt) {
|
||||||
|
if (!xa48_30_)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
xa48_24_isAlert = x400_24_hitByPlayerProjectile && mgr.GetActiveRandom()->Float() < (0.5f * dt);
|
||||||
|
return xa48_24_isAlert;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBabygoth::ResetProjectileCollision(CStateManager& mgr) {
|
||||||
|
for (u32 i = 0; i < x928_colActMgr->GetNumCollisionActors(); ++i) {
|
||||||
|
const auto& desc = x928_colActMgr->GetCollisionDescFromIndex(i);
|
||||||
|
if (TCastToPtr<CCollisionActor> act = mgr.ObjectById(desc.GetCollisionActorId())) {
|
||||||
|
act->AddMaterial(EMaterialTypes::ProjectilePassthrough, mgr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBabygoth::Crouch(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||||
|
if (msg == EStateMsg::Activate) {
|
||||||
|
RemoveMaterial(EMaterialTypes::Orbit, EMaterialTypes::Target, mgr);
|
||||||
|
mgr.GetPlayer().SetOrbitRequestForTarget(GetUniqueId(), CPlayer::EPlayerOrbitRequest::ActivateOrbitSource, mgr);
|
||||||
|
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Crouch);
|
||||||
|
xa48_30_ = xa48_24_isAlert = false;
|
||||||
|
x400_24_hitByPlayerProjectile = false;
|
||||||
|
x8e8_ = 0.f;
|
||||||
|
} else if (msg == EStateMsg::Deactivate) {
|
||||||
|
AddMaterial(EMaterialTypes::Orbit, EMaterialTypes::Target, mgr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace urde::MP1
|
} // namespace urde::MP1
|
||||||
|
|
|
@ -1,23 +1,31 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <Runtime/Collision/CJointCollisionDescription.hpp>
|
||||||
#include "World/CPatterned.hpp"
|
#include "World/CPatterned.hpp"
|
||||||
|
#include "World/CPathFindSearch.hpp"
|
||||||
|
#include "Weapon/CProjectileInfo.hpp"
|
||||||
|
#include "Character/CBoneTracking.hpp"
|
||||||
|
namespace urde {
|
||||||
|
class CCollisionActorManager;
|
||||||
|
class CWeaponDescription;
|
||||||
|
}
|
||||||
|
|
||||||
namespace urde::MP1 {
|
namespace urde::MP1 {
|
||||||
class CBabygothData {
|
struct CBabygothData {
|
||||||
float x0_;
|
float x0_;
|
||||||
float x4_;
|
float x4_;
|
||||||
CAssetId x8_;
|
CAssetId x8_;
|
||||||
CDamageInfo xc_;
|
CDamageInfo xc_;
|
||||||
CDamageInfo x28_;
|
CDamageInfo x28_;
|
||||||
CAssetId x44_;
|
CAssetId x44_;
|
||||||
CAssetId x48_;
|
CAssetId x48_fireBreathRes;
|
||||||
CDamageInfo x4c_;
|
CDamageInfo x4c_fireBreathDamage;
|
||||||
CDamageVulnerability x68_;
|
CDamageVulnerability x68_;
|
||||||
CDamageVulnerability xd0_;
|
CDamageVulnerability xd0_shellVulnerabilities;
|
||||||
CAssetId x138_;
|
CAssetId x138_;
|
||||||
CAssetId x13c_;
|
CAssetId x13c_;
|
||||||
float x140_;
|
float x140_shellHitPoints;
|
||||||
s16 x144_;
|
s16 x144_shellCrackSfx;
|
||||||
CAssetId x148_;
|
CAssetId x148_;
|
||||||
CAssetId x14c_;
|
CAssetId x14c_;
|
||||||
CAssetId x150_;
|
CAssetId x150_;
|
||||||
|
@ -37,20 +45,142 @@ public:
|
||||||
CAssetId GetShellModelResId() const;
|
CAssetId GetShellModelResId() const;
|
||||||
void GetFireballDamage() const;
|
void GetFireballDamage() const;
|
||||||
CAssetId GetFireballResID() const;
|
CAssetId GetFireballResID() const;
|
||||||
const CDamageVulnerability& GetShellDamageVulnerability() const;
|
|
||||||
void GetSHellHitPoints() const;
|
|
||||||
void GetFireballAttackVariance() const;
|
void GetFireballAttackVariance() const;
|
||||||
void GetFireballAttackTime() const;
|
void GetFireballAttackTime() const;
|
||||||
void GetFireBreathDamage() const;
|
CAssetId GetFireBreathResId() const { return x48_fireBreathRes; }
|
||||||
CAssetId GetFireBreathResId() const;
|
CDamageInfo GetFireBreathDamage() const { return x4c_fireBreathDamage; }
|
||||||
|
const CDamageVulnerability& GetShellDamageVulnerability() const { return xd0_shellVulnerabilities; }
|
||||||
|
float GetShellHitPoints() const { return x140_shellHitPoints; }
|
||||||
|
s16 GetShellCrackSfx() { return x144_shellCrackSfx; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class CBabygoth : public CPatterned {
|
class CBabygoth final : public CPatterned {
|
||||||
|
public:
|
||||||
|
enum class EPathFindMode {
|
||||||
|
Zero,
|
||||||
|
One
|
||||||
|
};
|
||||||
|
private:
|
||||||
|
static constexpr s32 skSphereJointCount = 5;
|
||||||
|
static const SSphereJointInfo skSphereJointList[skSphereJointCount];
|
||||||
|
static const std::string_view skpMouthDamageJoint;
|
||||||
|
u32 x568_ = -1;
|
||||||
|
u32 x56c_ = 0;
|
||||||
|
CBabygothData x570_babyData;
|
||||||
|
TUniqueId x6e8_teamMgr = kInvalidUniqueId;
|
||||||
|
CPathFindSearch x6ec_;
|
||||||
|
CPathFindSearch x7d0_;
|
||||||
|
EPathFindMode x8b4_pathFindMode;
|
||||||
|
zeus::CVector3f x8b8_;
|
||||||
|
zeus::CVector3f x8c4_;
|
||||||
|
float x8d0_;
|
||||||
|
float x8d4_stepBackwardDist = 0.f;
|
||||||
|
float x8d8_ = 0.f;
|
||||||
|
float x8dc_ = 0.f;
|
||||||
|
float x8e0_ = 0.f;
|
||||||
|
float x8e4_ = 0.f;
|
||||||
|
float x8e8_ = 0.f;
|
||||||
|
float x8ec_ = 0.f;
|
||||||
|
CBoneTracking x8f0_boneTracking;
|
||||||
|
std::unique_ptr<CCollisionActorManager> x928_colActMgr;
|
||||||
|
CCollidableAABox x930_aabox;
|
||||||
|
CProjectileInfo x958_;
|
||||||
|
TUniqueId x980_flameThrower = kInvalidUniqueId;
|
||||||
|
TToken<CWeaponDescription> x984_flameThrowerDesc;
|
||||||
|
CDamageVulnerability x98c_;
|
||||||
|
CSegId x9f4_mouthLocator;
|
||||||
|
TUniqueId x9f6_ = kInvalidUniqueId;
|
||||||
|
rstl::reserved_vector<TUniqueId, 1> x9f8_shellIds;
|
||||||
|
float xa00_shellHitPoints;
|
||||||
|
u32 xa04_ = 1;
|
||||||
|
TLockedToken<CSkinnedModel> xa08_noShellModel;
|
||||||
|
TToken<CGenDescription> xa14_;
|
||||||
|
TToken<CGenDescription> xa20_;
|
||||||
|
TToken<CGenDescription> xa2c_;
|
||||||
|
TLockedToken<CGenDescription> xa38_; // Used to be an optional, not necessary in URDE
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
bool xa48_24_isAlert : 1;
|
||||||
|
bool xa48_25_ : 1;
|
||||||
|
bool xa48_26_ : 1;
|
||||||
|
bool xa48_27_ : 1;
|
||||||
|
bool xa48_28_ : 1;
|
||||||
|
bool xa48_29_ : 1;
|
||||||
|
bool xa48_30_ : 1;
|
||||||
|
bool xa48_31_ : 1;
|
||||||
|
bool xa49_24_ : 1;
|
||||||
|
bool xa49_25_ : 1;
|
||||||
|
bool xa49_26_ : 1;
|
||||||
|
bool xa49_27_ : 1;
|
||||||
|
bool xa49_28_ : 1;
|
||||||
|
bool xa49_29_ : 1;
|
||||||
|
};
|
||||||
|
u32 _dummy = 0;
|
||||||
|
};
|
||||||
|
void AddSphereCollisionList(const SSphereJointInfo*, s32, std::vector<CJointCollisionDescription>&);
|
||||||
|
void SetupCollisionManager(CStateManager&);
|
||||||
|
void SetupHealthInfo(CStateManager&);
|
||||||
|
void CreateFlameThrower(CStateManager&);
|
||||||
|
void ApplyContactDamage(TUniqueId, CStateManager&);
|
||||||
|
void RemoveFromTeam(CStateManager&);
|
||||||
|
bool IsMouthCollisionActor(TUniqueId uid) { return x9f6_ == uid; }
|
||||||
|
bool IsShell(TUniqueId uid) {
|
||||||
|
for (TUniqueId shellId : x9f8_shellIds) {
|
||||||
|
if (shellId == uid)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
void CrackShell(CStateManager&, const TLockedToken<CGenDescription>&, const zeus::CTransform&, s16, bool);
|
||||||
|
void sub8021d478(CStateManager&, TUniqueId);
|
||||||
|
void sub8021ec58(float, CStateManager&);
|
||||||
|
s32 sub8023a180(TUniqueId, CStateManager&);
|
||||||
|
void sub8021d6e8(CStateManager&);
|
||||||
|
void sub8021e2c4(float);
|
||||||
|
void sub8021e708(CStateManager&);
|
||||||
|
void UpdateParticleEffects(float, CStateManager&);
|
||||||
|
void TryToGetUp(CStateManager& mgr);
|
||||||
|
bool CheckShouldWakeUp(CStateManager&, float);
|
||||||
|
void ResetProjectileCollision(CStateManager&);
|
||||||
|
void UpdateTouchBounds();
|
||||||
public:
|
public:
|
||||||
DEFINE_PATTERNED(Babygoth)
|
DEFINE_PATTERNED(Babygoth)
|
||||||
CBabygoth(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
|
CBabygoth(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
|
||||||
const CPatternedInfo&, const CActorParameters&, const CBabygothData&);
|
const CPatternedInfo&, const CActorParameters&, const CBabygothData&);
|
||||||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr);
|
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr);
|
||||||
|
void PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) {
|
||||||
|
CPatterned::PreRender(mgr, frustum);
|
||||||
|
xb4_drawFlags.x1_matSetIdx = u8(xa04_);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Think(float, CStateManager&);
|
||||||
|
float GetGravityConstant() const { return 10.f * 24.525f; }
|
||||||
|
void SetPathFindMode(EPathFindMode mode) { x8b4_pathFindMode = mode; }
|
||||||
|
const CCollisionPrimitive* GetCollisionPrimitive() const { return &x930_aabox; }
|
||||||
|
EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f& v1, const zeus::CVector3f& v2,
|
||||||
|
const CWeaponMode& wMode, EProjectileAttrib attrib) const {
|
||||||
|
if (wMode.GetType() == EWeaponType::Ice)
|
||||||
|
return EWeaponCollisionResponseTypes::None;
|
||||||
|
if (x56c_ != 3)
|
||||||
|
return EWeaponCollisionResponseTypes::Unknown66;
|
||||||
|
return CPatterned::GetCollisionResponseType(v1, v2, wMode, attrib);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TakeDamage(const zeus::CVector3f&, float) {
|
||||||
|
if (x400_25_alive)
|
||||||
|
x428_damageCooldownTimer = 0.33f;
|
||||||
|
}
|
||||||
|
void Shock(CStateManager&, float, float);
|
||||||
|
|
||||||
|
void Crouch(CStateManager&, EStateMsg, float);
|
||||||
|
bool SpotPlayer(CStateManager& mgr, float arg) {
|
||||||
|
if (xa48_24_isAlert)
|
||||||
|
return true;
|
||||||
|
return CPatterned::SpotPlayer(mgr, arg);
|
||||||
|
}
|
||||||
|
bool InPosition(CStateManager&, float) {
|
||||||
|
return (x8b8_ - GetTranslation()).magSquared() < 9.f;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace urde::MP1
|
} // namespace urde::MP1
|
||||||
|
|
|
@ -31,9 +31,9 @@ CNewIntroBoss::CNewIntroBoss(TUniqueId uid, std::string_view name, const CEntity
|
||||||
|
|
||||||
void CNewIntroBoss::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
void CNewIntroBoss::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
||||||
|
|
||||||
static const SSphereJointDescription skSphereJoints[] = {{"Head_1", 1.5f}, {"Tail_1", 1.5f}};
|
static const SSphereJointInfo skSphereJoints[] = {{"Head_1", 1.5f}, {"Tail_1", 1.5f}};
|
||||||
|
|
||||||
static const SOBBJointDescription skOBBJoints[] = {
|
static const SOBBJointInfo 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}},
|
||||||
{"Tail_1", "Tail_2", {1.f, 1.f, 1.f}},
|
{"Tail_1", "Tail_2", {1.f, 1.f, 1.f}},
|
||||||
|
@ -88,12 +88,12 @@ void CNewIntroBoss::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt
|
||||||
jointCollisions.reserve(15);
|
jointCollisions.reserve(15);
|
||||||
|
|
||||||
const CAnimData* animData = GetModelData()->GetAnimationData();
|
const CAnimData* animData = GetModelData()->GetAnimationData();
|
||||||
for (const SSphereJointDescription& joint : skSphereJoints) {
|
for (const SSphereJointInfo& joint : skSphereJoints) {
|
||||||
CSegId seg = animData->GetLocatorSegId(joint.name);
|
CSegId seg = animData->GetLocatorSegId(joint.name);
|
||||||
jointCollisions.push_back(CJointCollisionDescription::SphereCollision(seg, joint.radius, joint.name, 0.001f));
|
jointCollisions.push_back(CJointCollisionDescription::SphereCollision(seg, joint.radius, joint.name, 0.001f));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const SOBBJointDescription& joint : skOBBJoints) {
|
for (const SOBBJointInfo& joint : skOBBJoints) {
|
||||||
CSegId from = animData->GetLocatorSegId(joint.from);
|
CSegId from = animData->GetLocatorSegId(joint.from);
|
||||||
CSegId to = animData->GetLocatorSegId(joint.to);
|
CSegId to = animData->GetLocatorSegId(joint.to);
|
||||||
jointCollisions.push_back(CJointCollisionDescription::OBBAutoSizeCollision(
|
jointCollisions.push_back(CJointCollisionDescription::OBBAutoSizeCollision(
|
||||||
|
|
|
@ -7,8 +7,7 @@
|
||||||
#include "TCastTo.hpp"
|
#include "TCastTo.hpp"
|
||||||
#include "CSeedling.hpp"
|
#include "CSeedling.hpp"
|
||||||
|
|
||||||
namespace urde {
|
namespace urde::MP1 {
|
||||||
namespace MP1 {
|
|
||||||
|
|
||||||
CSeedling::CSeedling(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
CSeedling::CSeedling(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||||
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms,
|
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms,
|
||||||
|
@ -25,7 +24,7 @@ CSeedling::CSeedling(TUniqueId uid, std::string_view name, const CEntityInfo& in
|
||||||
, x722_25_curNeedleCluster(false) {
|
, x722_25_curNeedleCluster(false) {
|
||||||
const_cast<TToken<CWeaponDescription>*>(&x6c0_projectileInfo.Token())->Lock();
|
const_cast<TToken<CWeaponDescription>*>(&x6c0_projectileInfo.Token())->Lock();
|
||||||
CreateShadow(false);
|
CreateShadow(false);
|
||||||
SetKeepInThermalVisor();
|
MakeThermalColdAndHot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSeedling::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
void CSeedling::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
||||||
|
@ -220,5 +219,4 @@ void CSeedling::MassiveDeath(CStateManager& mgr) {
|
||||||
CPatterned::MassiveDeath(mgr);
|
CPatterned::MassiveDeath(mgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace MP1
|
}
|
||||||
} // namespace urde
|
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
#include "World/CPathFindSearch.hpp"
|
#include "World/CPathFindSearch.hpp"
|
||||||
#include "Weapon/CProjectileInfo.hpp"
|
#include "Weapon/CProjectileInfo.hpp"
|
||||||
|
|
||||||
namespace urde {
|
namespace urde::MP1 {
|
||||||
namespace MP1 {
|
|
||||||
class CSeedling : public CWallWalker {
|
class CSeedling : public CWallWalker {
|
||||||
static const std::string skNeedleLocators[2][6];
|
static const std::string skNeedleLocators[2][6];
|
||||||
CPathFindSearch x5d8_searchPath;
|
CPathFindSearch x5d8_searchPath;
|
||||||
|
@ -42,5 +41,4 @@ public:
|
||||||
bool ShouldAttack(CStateManager&, float);
|
bool ShouldAttack(CStateManager&, float);
|
||||||
void MassiveDeath(CStateManager&);
|
void MassiveDeath(CStateManager&);
|
||||||
};
|
};
|
||||||
} // namespace MP1
|
|
||||||
} // namespace urde
|
} // namespace urde
|
||||||
|
|
|
@ -47,7 +47,7 @@ CSpankWeed::CSpankWeed(TUniqueId uid, std::string_view name, const CEntityInfo&
|
||||||
x460_knockBackController.SetAutoResetImpulse(false);
|
x460_knockBackController.SetAutoResetImpulse(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const SSphereJointDescription kArmCollision[] = {{"Arm_4", 1.5f}, {"Arm_6", 1.f}, {"Arm_7", 1.f},
|
static const SSphereJointInfo 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},
|
{"Arm_8", 1.f}, {"Arm_9", 1.f}, {"Arm_11", 1.f},
|
||||||
{"Swoosh_LCTR", 1.5f}};
|
{"Swoosh_LCTR", 1.5f}};
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ void CSpankWeed::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CState
|
||||||
std::vector<CJointCollisionDescription> joints;
|
std::vector<CJointCollisionDescription> joints;
|
||||||
joints.reserve(12);
|
joints.reserve(12);
|
||||||
|
|
||||||
for (const SSphereJointDescription& joint : kArmCollision) {
|
for (const SSphereJointInfo& joint : kArmCollision) {
|
||||||
CSegId id = GetModelData()->GetAnimationData()->GetLocatorSegId(joint.name);
|
CSegId id = GetModelData()->GetAnimationData()->GetLocatorSegId(joint.name);
|
||||||
if (id != 0xFF)
|
if (id != 0xFF)
|
||||||
joints.push_back(CJointCollisionDescription::SphereCollision(id, joint.radius, joint.name, 0.001f));
|
joints.push_back(CJointCollisionDescription::SphereCollision(id, joint.radius, joint.name, 0.001f));
|
||||||
|
|
|
@ -10,7 +10,7 @@ const zeus::CVector3f CFlameThrower::kLightOffset(0, 3.f, 2.f);
|
||||||
CFlameThrower::CFlameThrower(const TToken<CWeaponDescription>& wDesc, std::string_view name, EWeaponType wType,
|
CFlameThrower::CFlameThrower(const TToken<CWeaponDescription>& wDesc, std::string_view name, EWeaponType wType,
|
||||||
const CFlameInfo& flameInfo, const zeus::CTransform& xf, EMaterialTypes matType,
|
const CFlameInfo& flameInfo, const zeus::CTransform& xf, EMaterialTypes matType,
|
||||||
const CDamageInfo& dInfo, TUniqueId uid, TAreaId aId, TUniqueId owner,
|
const CDamageInfo& dInfo, TUniqueId uid, TAreaId aId, TUniqueId owner,
|
||||||
EProjectileAttrib attribs, u32 w2, s16 sId, u32 w3)
|
EProjectileAttrib attribs, CAssetId w2, s16 sId, CAssetId w3)
|
||||||
: CGameProjectile(false, wDesc, name, wType, xf, matType, dInfo, uid, aId, owner, kInvalidUniqueId, attribs, false,
|
: CGameProjectile(false, wDesc, name, wType, xf, matType, dInfo, uid, aId, owner, kInvalidUniqueId, attribs, false,
|
||||||
zeus::CVector3f(1.f), {}, -1, false)
|
zeus::CVector3f(1.f), {}, -1, false)
|
||||||
, x2e8_(xf)
|
, x2e8_(xf)
|
||||||
|
@ -19,7 +19,7 @@ CFlameThrower::CFlameThrower(const TToken<CWeaponDescription>& wDesc, std::strin
|
||||||
|
|
||||||
void CFlameThrower::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
void CFlameThrower::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
||||||
|
|
||||||
void CFlameThrower::SetTransform(const zeus::CTransform& xf) { x2e8_ = xf; }
|
void CFlameThrower::SetTransform(const zeus::CTransform& xf, float) { x2e8_ = xf; }
|
||||||
|
|
||||||
void CFlameThrower::Reset(CStateManager&, bool) {}
|
void CFlameThrower::Reset(CStateManager&, bool) {}
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,10 @@ public:
|
||||||
CFlameThrower(const TToken<CWeaponDescription>& wDesc, std::string_view name, EWeaponType wType,
|
CFlameThrower(const TToken<CWeaponDescription>& wDesc, std::string_view name, EWeaponType wType,
|
||||||
const CFlameInfo& flameInfo, const zeus::CTransform& xf, EMaterialTypes matType,
|
const CFlameInfo& flameInfo, const zeus::CTransform& xf, EMaterialTypes matType,
|
||||||
const CDamageInfo& dInfo, TUniqueId uid, TAreaId aId, TUniqueId owner, EProjectileAttrib attribs,
|
const CDamageInfo& dInfo, TUniqueId uid, TAreaId aId, TUniqueId owner, EProjectileAttrib attribs,
|
||||||
u32 w2, s16 sId, u32 w3);
|
CAssetId w2, s16 sId, CAssetId w3);
|
||||||
|
|
||||||
void Accept(IVisitor& visitor);
|
void Accept(IVisitor& visitor);
|
||||||
void SetTransform(const zeus::CTransform& xf);
|
void SetTransform(const zeus::CTransform& xf, float);
|
||||||
void Reset(CStateManager&, bool);
|
void Reset(CStateManager&, bool);
|
||||||
void Fire(const zeus::CTransform&, CStateManager&, bool);
|
void Fire(const zeus::CTransform&, CStateManager&, bool);
|
||||||
bool GetX400_25() const { return x400_25; }
|
bool GetX400_25() const { return x400_25; }
|
||||||
|
|
|
@ -17,6 +17,7 @@ public:
|
||||||
void SetHP(float hp) { x0_health = hp; }
|
void SetHP(float hp) { x0_health = hp; }
|
||||||
float GetHP() const { return x0_health; }
|
float GetHP() const { return x0_health; }
|
||||||
float GetKnockbackResistance() const { return x4_knockbackResistance; }
|
float GetKnockbackResistance() const { return x4_knockbackResistance; }
|
||||||
|
void SetKnockbackResistance(float r) { x4_knockbackResistance = r; }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace urde
|
} // namespace urde
|
||||||
|
|
|
@ -376,11 +376,6 @@ public:
|
||||||
bool CanLongJump() const { return x328_26_longJump; }
|
bool CanLongJump() const { return x328_26_longJump; }
|
||||||
bool IsMakingBigStrike() const { return x402_28_isMakingBigStrike; }
|
bool IsMakingBigStrike() const { return x402_28_isMakingBigStrike; }
|
||||||
|
|
||||||
void SetKeepInThermalVisor() {
|
|
||||||
x403_24_keepThermalVisorState = true;
|
|
||||||
xe6_27_thermalVisorFlags = 1 | 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// region Casting Functions
|
// region Casting Functions
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|
|
@ -58,9 +58,10 @@ public:
|
||||||
static std::pair<bool, u32> HasCorrectParameterCount(CInputStream& in);
|
static std::pair<bool, u32> HasCorrectParameterCount(CInputStream& in);
|
||||||
|
|
||||||
float GetDetectionHeightRange() const { return x10_detectionHeightRange; }
|
float GetDetectionHeightRange() const { return x10_detectionHeightRange; }
|
||||||
|
const CHealthInfo& GetHealthInfo() const { return x54_healthInfo; }
|
||||||
|
const CDamageVulnerability& GetDamageVulnerability() const { return x5c_damageVulnerability; }
|
||||||
float GetHalfExtent() const { return xc4_halfExtent; }
|
float GetHalfExtent() const { return xc4_halfExtent; }
|
||||||
float GetHeight() const { return xc8_height; }
|
float GetHeight() const { return xc8_height; }
|
||||||
const CHealthInfo& GetHealthInfo() const { return x54_healthInfo; }
|
|
||||||
zeus::CVector3f GetBodyOrigin() const { return xcc_bodyOrigin; }
|
zeus::CVector3f GetBodyOrigin() const { return xcc_bodyOrigin; }
|
||||||
CAnimationParameters& GetAnimationParameters() { return xec_animParams; }
|
CAnimationParameters& GetAnimationParameters() { return xec_animParams; }
|
||||||
const CAnimationParameters& GetAnimationParameters() const { return xec_animParams; }
|
const CAnimationParameters& GetAnimationParameters() const { return xec_animParams; }
|
||||||
|
|
|
@ -1536,10 +1536,10 @@ void CPlayer::ProcessInput(const CFinalInput& input, CStateManager& mgr) {
|
||||||
|
|
||||||
if (x2f8_morphBallState == EPlayerMorphBallState::Unmorphed && x4a0_failsafeTest->Passes()) {
|
if (x2f8_morphBallState == EPlayerMorphBallState::Unmorphed && x4a0_failsafeTest->Passes()) {
|
||||||
auto* prim = static_cast<const CCollidableAABox*>(GetCollisionPrimitive());
|
auto* prim = static_cast<const CCollidableAABox*>(GetCollisionPrimitive());
|
||||||
zeus::CAABox tmpAABB(prim->GetAABB().min - 0.2f, prim->GetAABB().max + 0.2f);
|
zeus::CAABox tmpAABB(prim->GetBox().min - 0.2f, prim->GetBox().max + 0.2f);
|
||||||
CCollidableAABox tmpBox(tmpAABB, prim->GetMaterial());
|
CCollidableAABox tmpBox(tmpAABB, prim->GetMaterial());
|
||||||
CPhysicsActor::Stop();
|
CPhysicsActor::Stop();
|
||||||
zeus::CAABox testBounds = prim->GetAABB().getTransformedAABox(x34_transform);
|
zeus::CAABox testBounds = prim->GetBox().getTransformedAABox(x34_transform);
|
||||||
zeus::CAABox expandedBounds(testBounds.min - 3.f, testBounds.max + 3.f);
|
zeus::CAABox expandedBounds(testBounds.min - 3.f, testBounds.max + 3.f);
|
||||||
CAreaCollisionCache cache(expandedBounds);
|
CAreaCollisionCache cache(expandedBounds);
|
||||||
CGameCollision::BuildAreaCollisionCache(mgr, cache);
|
CGameCollision::BuildAreaCollisionCache(mgr, cache);
|
||||||
|
|
Loading…
Reference in New Issue