Finish CAi imps

This commit is contained in:
Phillip Stephens 2018-09-06 22:24:55 -07:00
parent 80bd235283
commit 95fbcf914c
2 changed files with 43 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include "CStateMachine.hpp"
#include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp"
#include "CScriptWater.hpp"
namespace urde
{
@ -51,6 +52,42 @@ void CAi::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager
CActor::AcceptScriptMsg(msg, uid, mgr);
}
EWeaponCollisionResponseTypes CAi::GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&,
const urde::CWeaponMode&, urde::EProjectileAttrib) const
{
return EWeaponCollisionResponseTypes::EnemyNormal;
}
void CAi::FluidFXThink(EFluidState state, CScriptWater& water, urde::CStateManager& mgr)
{
if (state == EFluidState::EnteredFluid || state == EFluidState::LeftFluid)
{
float dt = mgr.GetFluidPlaneManager()->GetLastSplashDeltaTime(GetUniqueId());
if (dt >= 0.02f)
{
float vel = (0.5f * GetMass()) * GetVelocity().magSquared();
if (vel > 500.f)
{
zeus::CVector3f pos = x34_transform.origin;
pos.z = water.GetTriggerBoundsWR().max.z;
mgr.GetFluidPlaneManager()->CreateSplash(GetUniqueId(), mgr, water, pos,
0.1f + ((0.4f * zeus::min(vel, 30000.f) - 500.f) / 29500.f),
true);
}
}
}
if (mgr.GetFluidPlaneManager()->GetLastRippleDeltaTime(GetUniqueId()) < (GetHealthInfo(mgr)->GetHP() > 0.f ? 0.2f : 0.7f))
return;
zeus::CVector3f pos = x34_transform.origin;
zeus::CVector3f center = pos;
center.z = water.GetTriggerBoundsWR().max.z;
pos.normalize();
water.GetFluidPlane().AddRipple(GetMass(), GetUniqueId(), center, GetVelocity(), water, mgr, pos);
}
CAiStateFunc CAi::GetStateFunc(const char* func) { return m_FuncMap->GetStateFunc(func); }
CAiTriggerFunc CAi::GetTrigerFunc(const char* func) { return m_FuncMap->GetTriggerFunc(func); }

View File

@ -30,6 +30,7 @@ enum class EKnockBackType
class CAiFuncMap;
class CStateManager;
class CScriptWater;
class CAi : public CPhysicsActor
{
static CAiFuncMap* m_FuncMap;
@ -53,11 +54,16 @@ public:
virtual void Death(CStateManager&, const zeus::CVector3f&, EStateMsg)=0;
virtual void KnockBack(const zeus::CVector3f&, CStateManager&, const CDamageInfo& info, EKnockBackType, bool, float)=0;
virtual const CDamageVulnerability* GetDamageVulnerability() const { return &x260_damageVulnerability; }
virtual const CDamageVulnerability* GetDamageVulnerability() { return &x260_damageVulnerability; }
virtual void TakeDamage(const zeus::CVector3f&, float) {}
virtual bool CanBeShot(const CStateManager&, int) { return true; }
virtual bool IsListening() const { return false; }
virtual int Listen(const zeus::CVector3f&, EListenNoiseType) { return 0; }
virtual EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&,
const CWeaponMode&, EProjectileAttrib) const;
void FluidFXThink(EFluidState, CScriptWater&, CStateManager&);
virtual zeus::CVector3f GetOrigin() const { return x34_transform.origin; }
virtual void Patrol(CStateManager&, EStateMsg, float) {}
virtual void FollowPattern(CStateManager&, EStateMsg, float) {}
virtual void Dead(CStateManager&, EStateMsg, float) {}