CRipper: AddPlatform & KnockBack fixes

This commit is contained in:
Luke Street 2020-08-23 14:08:25 -04:00
parent 6a7b87bea1
commit 4568b2e3f6
2 changed files with 18 additions and 8 deletions

View File

@ -25,14 +25,14 @@ CRipper::CRipper(TUniqueId uid, std::string_view name, EFlavorType type, const C
} }
void CRipper::Think(float dt, CStateManager& mgr) { void CRipper::Think(float dt, CStateManager& mgr) {
if (!GetActive()) if (!GetActive())
return; return;
ProcessGrapplePoint(mgr); ProcessGrapplePoint(mgr);
const CPlayer& pl = mgr.GetPlayer(); const CPlayer& pl = mgr.GetPlayer();
CGrappleArm::EArmState armState = pl.GetPlayerGun()->GetGrappleArm().GetAnimState(); CGrappleArm::EArmState armState = pl.GetPlayerGun()->GetGrappleArm().GetAnimState();
if (x598_grapplePoint != kInvalidUniqueId && pl.GetOrbitTargetId() == x598_grapplePoint && pl.GetGrappleState() != CPlayer::EGrappleState::None) { if (x598_grapplePoint != kInvalidUniqueId && pl.GetOrbitTargetId() == x598_grapplePoint &&
pl.GetGrappleState() != CPlayer::EGrappleState::None) {
if (pl.GetGrappleState() != CPlayer::EGrappleState::Firing && (armState > CGrappleArm::EArmState::Three)) { if (pl.GetGrappleState() != CPlayer::EGrappleState::Firing && (armState > CGrappleArm::EArmState::Three)) {
Stop(); Stop();
if (!x59c_24_muted) { if (!x59c_24_muted) {
@ -82,10 +82,13 @@ void CRipper::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
break; break;
} }
} }
void CRipper::KnockBack(const zeus::CVector3f& dir, CStateManager& mgr, const CDamageInfo& dInfo, EKnockBackType kb, void CRipper::KnockBack(const zeus::CVector3f& dir, CStateManager& mgr, const CDamageInfo& dInfo, EKnockBackType kb,
bool inDeferred, float mag) { bool inDeferred, float mag) {
CPatterned::KnockBack(dir, mgr, dInfo, kb, inDeferred, mag); CPatterned::KnockBack(dir, mgr, dInfo, kb, inDeferred, mag);
x450_bodyController->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(-dir, pas::ESeverity::One));
} }
void CRipper::Patrol(CStateManager& mgr, EStateMsg msg, float arg) { void CRipper::Patrol(CStateManager& mgr, EStateMsg msg, float arg) {
x450_bodyController->GetCommandMgr().SetSteeringBlendMode(ESteeringBlendMode::FullSpeed); x450_bodyController->GetCommandMgr().SetSteeringBlendMode(ESteeringBlendMode::FullSpeed);
x450_bodyController->GetCommandMgr().SetSteeringSpeedRange(1.f, 1.f); x450_bodyController->GetCommandMgr().SetSteeringSpeedRange(1.f, 1.f);
@ -107,7 +110,8 @@ void CRipper::AddGrapplePoint(CStateManager& mgr) {
x598_grapplePoint = mgr.AllocateUniqueId(); x598_grapplePoint = mgr.AllocateUniqueId();
mgr.AddObject(new CScriptGrapplePoint(x598_grapplePoint, "RipperGrapplePoint"sv, mgr.AddObject(new CScriptGrapplePoint(x598_grapplePoint, "RipperGrapplePoint"sv,
CEntityInfo(GetAreaIdAlways(), NullConnectionList), GetTransform(), true, x568_grappleParams)); CEntityInfo(GetAreaIdAlways(), NullConnectionList), GetTransform(), true,
x568_grappleParams));
} }
void CRipper::RemoveGrapplePoint(CStateManager& mgr) { void CRipper::RemoveGrapplePoint(CStateManager& mgr) {
@ -123,8 +127,11 @@ void CRipper::AddPlatform(CStateManager& mgr) {
x59a_platformId = mgr.AllocateUniqueId(); x59a_platformId = mgr.AllocateUniqueId();
const zeus::CAABox bounds = GetModelData()->GetBounds(GetTransform().getRotation()); const zeus::CAABox bounds = GetModelData()->GetBounds(GetTransform().getRotation());
mgr.AddObject(new CRipperControlledPlatform(x59a_platformId, GetUniqueId(), "Ripper Controlled Platform"sv, const auto& platform = new CRipperControlledPlatform(x59a_platformId, GetUniqueId(), "Ripper Controlled Platform"sv,
CEntityInfo(GetAreaIdAlways(), NullConnectionList), GetTransform(), bounds, GetActive(), {})); CEntityInfo(GetAreaIdAlways(), NullConnectionList),
GetTransform(), bounds, GetActive(), {});
mgr.AddObject(platform);
platform->AddMaterial(EMaterialTypes::ProjectilePassthrough);
} }
void CRipper::RemovePlatform(CStateManager& mgr) { void CRipper::RemovePlatform(CStateManager& mgr) {
@ -133,11 +140,12 @@ void CRipper::RemovePlatform(CStateManager& mgr) {
mgr.FreeScriptObject(x59a_platformId); mgr.FreeScriptObject(x59a_platformId);
x59a_platformId = kInvalidUniqueId; x59a_platformId = kInvalidUniqueId;
} }
CRipperControlledPlatform::CRipperControlledPlatform( CRipperControlledPlatform::CRipperControlledPlatform(
TUniqueId uid, TUniqueId owner, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, TUniqueId uid, TUniqueId owner, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
const zeus::CAABox& bounds, bool active, const std::optional<TLockedToken<CCollidableOBBTreeGroup>>& colTree) const zeus::CAABox& bounds, bool active, const std::optional<TLockedToken<CCollidableOBBTreeGroup>>& colTree)
: CScriptPlatform(uid, name, info, xf, CModelData::CModelDataNull(), CActorParameters::None(), bounds, 0.f, false, 1.f, : CScriptPlatform(uid, name, info, xf, CModelData::CModelDataNull(), CActorParameters::None(), bounds, 0.f, false, 1.f,
active, CHealthInfo(FLT_MAX, 10.f), CDamageVulnerability::ImmuneVulnerabilty(), colTree, 0, 1, 1) active, CHealthInfo(FLT_MAX, 10.f), CDamageVulnerability::ImmuneVulnerabilty(), colTree, false, 1, 1)
, x358_owner(owner) , x358_owner(owner)
, x35c_yaw(GetYaw()) {} , x35c_yaw(GetYaw()) {}
} } // namespace urde::MP1

View File

@ -17,6 +17,7 @@ class CRipper : public CPatterned {
void RemoveGrapplePoint(CStateManager&); void RemoveGrapplePoint(CStateManager&);
void AddPlatform(CStateManager&); void AddPlatform(CStateManager&);
void RemovePlatform(CStateManager&); void RemovePlatform(CStateManager&);
public: public:
DEFINE_PATTERNED(Ripper) DEFINE_PATTERNED(Ripper)
CRipper(TUniqueId uid, std::string_view name, EFlavorType type, const CEntityInfo& info, const zeus::CTransform& xf, CRipper(TUniqueId uid, std::string_view name, EFlavorType type, const CEntityInfo& info, const zeus::CTransform& xf,
@ -41,8 +42,9 @@ public:
class CRipperControlledPlatform : public CScriptPlatform { class CRipperControlledPlatform : public CScriptPlatform {
TUniqueId x358_owner; TUniqueId x358_owner;
float x35c_yaw; float x35c_yaw;
public: public:
CRipperControlledPlatform(TUniqueId, TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CRipperControlledPlatform(TUniqueId, TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&,
const zeus::CAABox&, bool, const std::optional<TLockedToken<CCollidableOBBTreeGroup>>&); const zeus::CAABox&, bool, const std::optional<TLockedToken<CCollidableOBBTreeGroup>>&);
}; };
} } // namespace urde::MP1