mirror of https://github.com/AxioDL/metaforce.git
Work on CStateManager
This commit is contained in:
parent
f016a251db
commit
a0549cd82b
|
@ -66,7 +66,7 @@ CPersistentOptions::CPersistentOptions(CBitStreamReader& stream)
|
|||
x68_[b] = stream.ReadEncoded(1);
|
||||
|
||||
xc0_ = stream.ReadEncoded(2);
|
||||
xc4_ = stream.ReadEncoded(2);
|
||||
xc4_freezeBreakCount = stream.ReadEncoded(2);
|
||||
xc8_ = stream.ReadEncoded(1);
|
||||
xcc_logScanCount = stream.ReadEncoded(7);
|
||||
xd0_24_fusionLinked = stream.ReadEncoded(1);
|
||||
|
@ -112,7 +112,7 @@ void CPersistentOptions::PutTo(CBitStreamWriter& w) const
|
|||
w.WriteEncoded(x68_[b], 1);
|
||||
|
||||
w.WriteEncoded(xc0_, 2);
|
||||
w.WriteEncoded(xc4_, 2);
|
||||
w.WriteEncoded(xc4_freezeBreakCount, 2);
|
||||
w.WriteEncoded(xc8_, 1);
|
||||
w.WriteEncoded(xcc_logScanCount, 7);
|
||||
w.WriteEncoded(xd0_24_fusionLinked, 1);
|
||||
|
|
|
@ -59,7 +59,7 @@ class CPersistentOptions
|
|||
std::vector<std::pair<ResId, TEditorId>> xac_cinematicStates; /* (MLVL, Cinematic) */
|
||||
u32 xbc_ = 0;
|
||||
u32 xc0_ = 0;
|
||||
u32 xc4_ = 0;
|
||||
u32 xc4_freezeBreakCount = 0;
|
||||
u32 xc8_ = 0;
|
||||
u32 xcc_logScanCount = 0;
|
||||
|
||||
|
@ -97,6 +97,8 @@ public:
|
|||
void SetAllItemsCollected(bool v) { xd0_29_allItemsCollected = v; }
|
||||
u32 GetLogScanCount() const { return xcc_logScanCount; }
|
||||
void SetLogScanCount(u32 v) { xcc_logScanCount = v; }
|
||||
void IncrFreezeBreakCount() { xc4_freezeBreakCount = std::min(int(xc4_freezeBreakCount + 1), 3); }
|
||||
bool GetShowFrozenMessage() const { return xc4_freezeBreakCount != 3; }
|
||||
void PutTo(CBitStreamWriter& w) const;
|
||||
|
||||
u8* GetNESState() { return x0_; }
|
||||
|
|
|
@ -39,6 +39,12 @@
|
|||
#include "Collision/CGameCollision.hpp"
|
||||
#include "World/CScriptPlatform.hpp"
|
||||
#include "World/CScriptRoomAcoustics.hpp"
|
||||
#include "Weapon/CWeapon.hpp"
|
||||
#include "World/CWallCrawlerSwarm.hpp"
|
||||
#include "World/CSnakeWeedSwarm.hpp"
|
||||
#include "Collision/CCollidableSphere.hpp"
|
||||
#include "zeus/CMRay.hpp"
|
||||
#include "Collision/CollisionUtil.hpp"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
@ -46,7 +52,8 @@ namespace urde
|
|||
{
|
||||
logvisor::Module LogModule("urde::CStateManager");
|
||||
CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>& relayTracker,
|
||||
const std::weak_ptr<CMapWorldInfo>& mwInfo, const std::weak_ptr<CPlayerState>& playerState,
|
||||
const std::weak_ptr<CMapWorldInfo>& mwInfo,
|
||||
const std::weak_ptr<CPlayerState>& playerState,
|
||||
const std::weak_ptr<CWorldTransManager>& wtMgr,
|
||||
const std::weak_ptr<CWorldLayerState>& layerState)
|
||||
: x8b8_playerState(playerState)
|
||||
|
@ -1268,26 +1275,300 @@ void CStateManager::InformListeners(const zeus::CVector3f& pos, EListenNoiseType
|
|||
}
|
||||
}
|
||||
|
||||
bool CStateManager::ApplyKnockBack(CActor& actor, const CDamageInfo& info, const CDamageVulnerability&,
|
||||
const zeus::CVector3f&, float)
|
||||
void CStateManager::ApplyKnockBack(CActor& actor, const CDamageInfo& info, const CDamageVulnerability& vuln,
|
||||
const zeus::CVector3f& pos, float dampen)
|
||||
{
|
||||
if (vuln.GetVulnerability(info.GetWeaponMode(), false) == EVulnerability::Reflect)
|
||||
return;
|
||||
CHealthInfo* hInfo = actor.HealthInfo();
|
||||
if (!hInfo)
|
||||
return;
|
||||
|
||||
float dampedPower = (1.f - dampen) * info.GetKnockBackPower();
|
||||
if (TCastToPtr<CPlayer> player = actor)
|
||||
{
|
||||
KnockBackPlayer(*player, pos, dampedPower, hInfo->GetKnockbackResistance());
|
||||
return;
|
||||
}
|
||||
|
||||
TCastToPtr<CAi> ai = actor;
|
||||
if (!ai && hInfo->GetHP() <= 0.f)
|
||||
{
|
||||
if (dampedPower > hInfo->GetKnockbackResistance())
|
||||
{
|
||||
if (TCastToPtr<CPhysicsActor> physActor = actor)
|
||||
{
|
||||
zeus::CVector3f kbVec = pos * (dampedPower - hInfo->GetKnockbackResistance()) * physActor->GetMass() * 1.5f;
|
||||
if (physActor->GetMaterialList().HasMaterial(EMaterialTypes::Immovable) ||
|
||||
!physActor->GetMaterialList().HasMaterial(EMaterialTypes::Grass))
|
||||
return;
|
||||
physActor->ApplyImpulseWR(kbVec, zeus::CAxisAngle::sIdentity);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ai)
|
||||
ai->KnockBack(pos, *this, info, dampen == 0.f ? EKnockBackType::Zero : EKnockBackType::One, false, dampedPower);
|
||||
}
|
||||
|
||||
void CStateManager::KnockBackPlayer(CPlayer& player, const zeus::CVector3f& pos, float power, float resistance)
|
||||
{
|
||||
if (player.GetMaterialList().HasMaterial(EMaterialTypes::Immovable))
|
||||
return;
|
||||
|
||||
float usePower;
|
||||
if (player.GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed)
|
||||
{
|
||||
usePower = power * 1000.f;
|
||||
u32 something = player.x2b0_ == 2 ? player.x2ac_ : 4;
|
||||
if (something != 0 && player.x304_ == 0)
|
||||
usePower /= 7.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
usePower = power * 500.f;
|
||||
}
|
||||
|
||||
float minVel = player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed ? 35.f : 70.f;
|
||||
float playerVel = player.x138_velocity.magnitude();
|
||||
float maxVel = std::max(playerVel, minVel);
|
||||
zeus::CVector3f negVel = -player.x138_velocity;
|
||||
usePower *= (1.f - 0.5f * zeus::CVector3f::getAngleDiff(pos, negVel) / M_PIF);
|
||||
player.ApplyImpulseWR(pos * usePower, zeus::CAxisAngle::sIdentity);
|
||||
player.UseCollisionImpulses();
|
||||
player.x2d4_ = 0.25f;
|
||||
|
||||
float newVel = player.x138_velocity.magnitude();
|
||||
if (newVel > maxVel)
|
||||
{
|
||||
zeus::CVector3f vel = (1.f / newVel) * player.x138_velocity * maxVel;
|
||||
player.SetVelocityWR(vel);
|
||||
}
|
||||
}
|
||||
|
||||
void CStateManager::ApplyDamageToWorld(TUniqueId damager, const CActor& actor, const zeus::CVector3f& pos,
|
||||
const CDamageInfo& info, const CMaterialFilter& filter)
|
||||
{
|
||||
zeus::CAABox aabb(pos - info.GetRadius(), pos + info.GetRadius());
|
||||
|
||||
bool bomb = false;
|
||||
TCastToPtr<CWeapon> weapon = const_cast<CActor&>(actor);
|
||||
if (weapon)
|
||||
bomb = (weapon->GetAttribField() & (CWeapon::EProjectileAttrib::Bombs |
|
||||
CWeapon::EProjectileAttrib::PowerBombs)) != CWeapon::EProjectileAttrib::None;
|
||||
|
||||
rstl::reserved_vector<TUniqueId, 1024> nearList;
|
||||
BuildNearList(nearList, aabb, filter, &actor);
|
||||
for (TUniqueId id : nearList)
|
||||
{
|
||||
CEntity* ent = ObjectById(id);
|
||||
if (!ent)
|
||||
continue;
|
||||
|
||||
TCastToPtr<CPlayer> player = ent;
|
||||
if (bomb && player)
|
||||
{
|
||||
if (player->GetFrozenState())
|
||||
{
|
||||
g_GameState->SystemOptions().IncrFreezeBreakCount();
|
||||
SHudMemoInfo info = {0.f, true, true, true};
|
||||
MP1::CSamusHud::DisplayHudMemo(u"", info);
|
||||
player->Stop(*this);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((weapon->GetAttribField() & CWeapon::EProjectileAttrib::Bombs) != CWeapon::EProjectileAttrib::None)
|
||||
player->BombJump(pos, *this);
|
||||
}
|
||||
}
|
||||
else if (ent->GetUniqueId() != damager)
|
||||
{
|
||||
TestBombHittingWater(actor, pos, static_cast<CActor&>(*ent));
|
||||
if (TestRadiusDamage(pos, static_cast<CActor&>(*ent), nearList))
|
||||
ApplyRadiusDamage(actor, pos, static_cast<CActor&>(*ent), info);
|
||||
}
|
||||
|
||||
if (TCastToPtr<CWallCrawlerSwarm> swarm = ent)
|
||||
swarm->ApplyRadiusDamage(pos, info, *this);
|
||||
|
||||
if (TCastToPtr<CSnakeWeedSwarm> swarm = ent)
|
||||
swarm->ApplyRadiusDamage(pos, info, *this);
|
||||
}
|
||||
}
|
||||
|
||||
void CStateManager::ProcessRadiusDamage(const CActor& a1, CActor& a2, TUniqueId senderId, const CDamageInfo& info,
|
||||
const CMaterialFilter& filter)
|
||||
{
|
||||
zeus::CAABox aabb(a1.GetTranslation() - info.GetRadius(), a1.GetTranslation() + info.GetRadius());
|
||||
rstl::reserved_vector<TUniqueId, 1024> nearList;
|
||||
BuildNearList(nearList, aabb, filter, nullptr);
|
||||
for (TUniqueId id : nearList)
|
||||
{
|
||||
CEntity* ent = ObjectById(id);
|
||||
if (!ent || ent->GetUniqueId() == a1.GetUniqueId() ||
|
||||
ent->GetUniqueId() == senderId ||
|
||||
ent->GetUniqueId() == a2.GetUniqueId())
|
||||
continue;
|
||||
|
||||
TestBombHittingWater(a1, a1.GetTranslation(), static_cast<CActor&>(*ent));
|
||||
if (TestRadiusDamage(a1.GetTranslation(), static_cast<CActor&>(*ent), nearList))
|
||||
ApplyRadiusDamage(a1, a1.GetTranslation(), static_cast<CActor&>(*ent), info);
|
||||
}
|
||||
}
|
||||
|
||||
void CStateManager::ApplyRadiusDamage(const CActor& a1, const zeus::CVector3f& pos,
|
||||
CActor& a2, const CDamageInfo& info)
|
||||
{
|
||||
zeus::CVector3f delta = a2.GetTranslation() - pos;
|
||||
if (delta.magSquared() >= info.GetRadius() * info.GetRadius())
|
||||
{
|
||||
rstl::optional_object<zeus::CAABox> bounds = a2.GetTouchBounds();
|
||||
if (!bounds)
|
||||
return;
|
||||
if (CCollidableSphere::Sphere_AABox_Bool(zeus::CSphere{pos, info.GetRadius()}, *bounds))
|
||||
{
|
||||
float rad = info.GetRadius();
|
||||
if (rad > FLT_EPSILON)
|
||||
rad = delta.magnitude() / rad;
|
||||
else
|
||||
rad = 0.f;
|
||||
if (rad > 0.f)
|
||||
delta.normalize();
|
||||
|
||||
bool alive = false;
|
||||
if (CHealthInfo* hInfo = a2.HealthInfo())
|
||||
if (hInfo->GetHP() > 0.f)
|
||||
alive = true;
|
||||
|
||||
const CDamageVulnerability* vuln;
|
||||
if (rad > 0.f)
|
||||
vuln = a2.GetDamageVulnerability(pos, delta, info);
|
||||
else
|
||||
vuln = a2.GetDamageVulnerability();
|
||||
|
||||
if (vuln->WeaponHurts(info.GetWeaponMode(), true))
|
||||
{
|
||||
float dam = info.GetRadiusDamage(*vuln);
|
||||
if (dam > 0.f)
|
||||
ApplyLocalDamage(pos, delta, a2, dam, info.GetWeaponMode());
|
||||
a2.SendScriptMsgs(EScriptObjectState::Damage, *this, EScriptObjectMessage::None);
|
||||
SendScriptMsg(&a2, a1.GetUniqueId(), EScriptObjectMessage::InternalMessage19);
|
||||
}
|
||||
else
|
||||
{
|
||||
a2.SendScriptMsgs(EScriptObjectState::UNKS6, *this, EScriptObjectMessage::None);
|
||||
SendScriptMsg(&a2, a1.GetUniqueId(), EScriptObjectMessage::InternalMessage20);
|
||||
}
|
||||
|
||||
if (alive && info.GetKnockBackPower() > 0.f)
|
||||
ApplyKnockBack(a2, info, *vuln, (a2.GetTranslation() - a1.GetTranslation()).normalized(), rad);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CStateManager::TestRadiusDamage(const zeus::CVector3f& pos, const CActor& damagee,
|
||||
const rstl::reserved_vector<TUniqueId, 1024>& nearList)
|
||||
{
|
||||
const CHealthInfo* hInfo = const_cast<CActor&>(damagee).HealthInfo();
|
||||
if (!hInfo)
|
||||
return false;
|
||||
|
||||
static const CMaterialList incList(EMaterialTypes::Solid);
|
||||
static const CMaterialList exList(EMaterialTypes::ProjectilePassthrough,
|
||||
EMaterialTypes::Player,
|
||||
EMaterialTypes::Occluder,
|
||||
EMaterialTypes::Character);
|
||||
static const CMaterialFilter filter(incList, exList, CMaterialFilter::EFilterType::IncludeExclude);
|
||||
|
||||
rstl::optional_object<zeus::CAABox> bounds = damagee.GetTouchBounds();
|
||||
if (!bounds)
|
||||
return false;
|
||||
|
||||
zeus::CVector3f center = bounds->center();
|
||||
zeus::CVector3f delta = center - pos;
|
||||
|
||||
if (!delta.canBeNormalized())
|
||||
return true;
|
||||
float origMag = delta.magnitude();
|
||||
delta = delta * (1.f / origMag);
|
||||
|
||||
if (TestRadiusDamage(pos, center, nearList, filter, damagee))
|
||||
return true;
|
||||
|
||||
zeus::CMRay ray(pos, delta, origMag);
|
||||
if (!TestRadiusDamage(ray, filter))
|
||||
return false;
|
||||
|
||||
float depth;
|
||||
u32 count = CollisionUtil::RayAABoxIntersection(ray, *bounds, zeus::CVector3f::skZero, depth);
|
||||
if (count == 0 || count == 1)
|
||||
return true;
|
||||
|
||||
return TestRadiusDamage(pos, delta, filter, nearList, damagee, depth * origMag);
|
||||
}
|
||||
|
||||
bool CStateManager::TestRadiusDamage(const zeus::CVector3f& pos, const zeus::CVector3f& damageeCenter,
|
||||
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
|
||||
const CMaterialFilter& filter, const CActor& damagee)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CStateManager::ApplyDamageToWorld(TUniqueId, const CActor&, const zeus::CVector3f&, const CDamageInfo& info,
|
||||
const CMaterialFilter&)
|
||||
bool CStateManager::TestRadiusDamage(const zeus::CMRay& ray, const CMaterialFilter& filter)
|
||||
{
|
||||
zeus::CVector3f crossed =
|
||||
{
|
||||
-ray.end.z * ray.end.z - ray.end.y * ray.end.x,
|
||||
ray.end.x * ray.end.x - ray.end.z * ray.end.y,
|
||||
ray.end.y * ray.end.y - ray.end.x * -ray.end.z
|
||||
};
|
||||
|
||||
crossed.normalize();
|
||||
zeus::CVector3f crossed2 = ray.end.cross(crossed) * 0.35355338f;
|
||||
zeus::CVector3f negCrossed2 = -crossed2;
|
||||
zeus::CVector3f rms = crossed * 0.35355338f;
|
||||
zeus::CVector3f negRms = -rms;
|
||||
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
{
|
||||
zeus::CVector3f& useCrossed = (i & 2) ? negCrossed2 : crossed2;
|
||||
zeus::CVector3f& useRms = (i & 1) ? rms : negRms;
|
||||
if (TestRayDamage(ray.start + useCrossed + useRms, ray.end, ray.d, filter))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CStateManager::TestRayDamage(const zeus::CVector3f& start, const zeus::CVector3f& end, float d,
|
||||
const CMaterialFilter& filter)
|
||||
{
|
||||
if (d <= 0.f)
|
||||
d = 100000.f;
|
||||
zeus::CLineSeg seg(start, end);
|
||||
for (CGameArea* area = x850_world->GetChainHead(EChain::Alive) ;
|
||||
area != CWorld::GetAliveAreasEnd() ; area = area->GetNext())
|
||||
{
|
||||
CAreaOctTree& collision = *area->GetPostConstructed()->x0_collision;
|
||||
CAreaOctTree::Node root = collision.GetRootNode();
|
||||
if (!root.LineTest(seg, filter, d))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CStateManager::TestRadiusDamage(const zeus::CVector3f& pos, const zeus::CVector3f& normToDamagee,
|
||||
const CMaterialFilter& filter, const rstl::reserved_vector<TUniqueId, 1024>& nearList,
|
||||
const CActor& damagee, float mag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void CStateManager::ProcessRadiusDamage(const CActor&, CActor&, const zeus::CVector3f&, const CDamageInfo& info,
|
||||
const CMaterialFilter&)
|
||||
void CStateManager::TestBombHittingWater(const CActor& damager, const zeus::CVector3f& pos, CActor& damagee)
|
||||
{
|
||||
}
|
||||
|
||||
bool CStateManager::ApplyRadiusDamage(const CActor&, const zeus::CVector3f&, CActor&, const CDamageInfo& info)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CStateManager::ApplyLocalDamage(const zeus::CVector3f& vec1, const zeus::CVector3f& vec2, CActor& actor, float dt,
|
||||
|
|
|
@ -310,14 +310,27 @@ public:
|
|||
std::pair<TEditorId, TUniqueId> GenerateObject(TEditorId);
|
||||
void InitScriptObjects(const std::vector<TEditorId>& ids);
|
||||
void InformListeners(const zeus::CVector3f&, EListenNoiseType);
|
||||
bool ApplyKnockBack(CActor& actor, const CDamageInfo& info,
|
||||
void ApplyKnockBack(CActor& actor, const CDamageInfo& info,
|
||||
const CDamageVulnerability&, const zeus::CVector3f&, float);
|
||||
bool ApplyDamageToWorld(TUniqueId, const CActor&, const zeus::CVector3f&,
|
||||
void KnockBackPlayer(CPlayer& player, const zeus::CVector3f& pos, float power, float resistance);
|
||||
void ApplyDamageToWorld(TUniqueId, const CActor&, const zeus::CVector3f&,
|
||||
const CDamageInfo& info, const CMaterialFilter&);
|
||||
void ProcessRadiusDamage(const CActor&, CActor&, const zeus::CVector3f&,
|
||||
void ProcessRadiusDamage(const CActor&, CActor&, TUniqueId senderId,
|
||||
const CDamageInfo& info, const CMaterialFilter&);
|
||||
bool ApplyRadiusDamage(const CActor&, const zeus::CVector3f&, CActor&,
|
||||
void ApplyRadiusDamage(const CActor&, const zeus::CVector3f&, CActor&,
|
||||
const CDamageInfo& info);
|
||||
bool TestRadiusDamage(const zeus::CVector3f& pos, const CActor& damagee,
|
||||
const rstl::reserved_vector<TUniqueId, 1024>& nearList);
|
||||
bool TestRadiusDamage(const zeus::CVector3f& pos, const zeus::CVector3f& damageeCenter,
|
||||
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
|
||||
const CMaterialFilter& filter, const CActor& damagee);
|
||||
bool TestRadiusDamage(const zeus::CMRay& ray, const CMaterialFilter& filter);
|
||||
bool TestRayDamage(const zeus::CVector3f& start, const zeus::CVector3f& end, float d,
|
||||
const CMaterialFilter& filter);
|
||||
bool TestRadiusDamage(const zeus::CVector3f& pos, const zeus::CVector3f& normToDamagee,
|
||||
const CMaterialFilter& filter, const rstl::reserved_vector<TUniqueId, 1024>& nearList,
|
||||
const CActor& damagee, float mag);
|
||||
void TestBombHittingWater(const CActor& damager, const zeus::CVector3f& pos, CActor& damagee);
|
||||
bool ApplyLocalDamage(const zeus::CVector3f&, const zeus::CVector3f&, CActor&, float,
|
||||
const CWeaponMode&);
|
||||
bool ApplyDamage(TUniqueId, TUniqueId, TUniqueId, const CDamageInfo& info,
|
||||
|
|
|
@ -3,6 +3,28 @@
|
|||
namespace urde
|
||||
{
|
||||
|
||||
bool CAreaOctTree::Node::LineTestInternal(const zeus::CLineSeg&, const CMaterialFilter&,
|
||||
float, float, float, const zeus::CVector3f&) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CAreaOctTree::Node::LineTestExInternal(const zeus::CLineSeg&, const CMaterialFilter&,
|
||||
SRayResult&, float, float, float, const zeus::CVector3f&) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CAreaOctTree::Node::LineTest(const zeus::CLineSeg&, const CMaterialFilter&, float) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CAreaOctTree::Node::LineTestEx(const zeus::CLineSeg&, const CMaterialFilter&, SRayResult&, float) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CAreaOctTree::Node CAreaOctTree::Node::GetChild(int idx) const
|
||||
{
|
||||
u16 flags = *reinterpret_cast<const u16*>(m_ptr);
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
#include "RetroTypes.hpp"
|
||||
#include "zeus/CAABox.hpp"
|
||||
#include "Collision/CCollisionEdge.hpp"
|
||||
#include "Collision/CCollisionSurface.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CCollisionEdge;
|
||||
class CMaterialFilter;
|
||||
class CAreaOctTree
|
||||
{
|
||||
|
@ -15,6 +15,9 @@ class CAreaOctTree
|
|||
public:
|
||||
struct SRayResult
|
||||
{
|
||||
zeus::CPlane x0_plane;
|
||||
rstl::optional_object<CCollisionSurface> x10_surface;
|
||||
float x3c_;
|
||||
};
|
||||
|
||||
class TriListReference
|
||||
|
@ -49,17 +52,20 @@ public:
|
|||
const CAreaOctTree& m_owner;
|
||||
ETreeType m_nodeType;
|
||||
|
||||
bool LineTestInternal(const zeus::CLineSeg&, const CMaterialFilter&, float, float, float,
|
||||
const zeus::CVector3f&) const;
|
||||
bool LineTestExInternal(const zeus::CLineSeg&, const CMaterialFilter&, SRayResult&, float, float, float,
|
||||
const zeus::CVector3f&) const;
|
||||
|
||||
public:
|
||||
Node(const void* ptr, const zeus::CAABox& aabb,
|
||||
const CAreaOctTree& owner, ETreeType type)
|
||||
: m_ptr(reinterpret_cast<const u8*>(ptr)), m_aabb(aabb), m_owner(owner), m_nodeType(type)
|
||||
{
|
||||
}
|
||||
#if 0
|
||||
void LineTestEx(const zeus::CLine&, const CMaterialFilter&, SRayResult&, float) const;
|
||||
void LineTestExInternal(const zeus::CLine&, const CMaterialFilter&, SRayResult&, float, float, float,
|
||||
const zeus::CVector3f&) const;
|
||||
#endif
|
||||
|
||||
bool LineTest(const zeus::CLineSeg&, const CMaterialFilter&, float) const;
|
||||
bool LineTestEx(const zeus::CLineSeg&, const CMaterialFilter&, SRayResult&, float) const;
|
||||
|
||||
const CAreaOctTree& GetOwner() const
|
||||
{
|
||||
|
|
|
@ -10,7 +10,10 @@ namespace Collide
|
|||
|
||||
bool Sphere_AABox(const CInternalCollisionStructure&, CCollisionInfoList&) { return false; }
|
||||
|
||||
bool Sphere_AABox_Bool(const CInternalCollisionStructure&) { return false; }
|
||||
bool Sphere_AABox_Bool(const CInternalCollisionStructure&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Sphere_Sphere(const CInternalCollisionStructure&, CCollisionInfoList&) { return false; }
|
||||
|
||||
|
@ -54,4 +57,25 @@ bool CCollidableSphere::CollideMovingSphere(const CInternalCollisionStructure&,
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CCollidableSphere::Sphere_AABox_Bool(const zeus::CSphere& sphere, const zeus::CAABox& aabb)
|
||||
{
|
||||
float mag = 0.f;
|
||||
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
{
|
||||
if (sphere.position[i] < aabb.min[i])
|
||||
{
|
||||
float tmp = sphere.position[i] - aabb.min[i];
|
||||
mag += tmp * tmp;
|
||||
}
|
||||
else if (sphere.position[i] > aabb.max[i])
|
||||
{
|
||||
float tmp = sphere.position[i] - aabb.max[i];
|
||||
mag += tmp * tmp;
|
||||
}
|
||||
}
|
||||
|
||||
return mag <= sphere.radius * sphere.radius;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
CCollisionInfo&);
|
||||
static bool CollideMovingSphere(const CInternalCollisionStructure&, const zeus::CVector3f&, double&,
|
||||
CCollisionInfo&);
|
||||
static bool Sphere_AABox_Bool(const zeus::CSphere& sphere, const zeus::CAABox& aabb);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace urde
|
|||
|
||||
class CInternalCollisionStructure
|
||||
{
|
||||
zeus::CVector3f x0_pos;
|
||||
float xc_radius;
|
||||
};
|
||||
|
||||
class CActor;
|
||||
|
|
|
@ -8,6 +8,7 @@ set(COLLISION_SOURCES
|
|||
CCollisionEdge.hpp CCollisionEdge.cpp
|
||||
CCollisionSurface.hpp CCollisionSurface.cpp
|
||||
InternalColliders.hpp InternalColliders.cpp
|
||||
CMetroidAreaCollider.hpp CMetroidAreaCollider.cpp
|
||||
COBBTree.hpp COBBTree.cpp
|
||||
CCollidableAABox.hpp CCollidableAABox.cpp
|
||||
CCollidableCollisionSurface.hpp CCollidableCollisionSurface.cpp
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef __URDE_CMETROIDAREACOLLIDER_HPP__
|
||||
#define __URDE_CMETROIDAREACOLLIDER_HPP__
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CMetroidAreaCollider
|
||||
{
|
||||
public:
|
||||
CMetroidAreaCollider();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CMETROIDAREACOLLIDER_HPP__
|
|
@ -19,6 +19,12 @@ enum class EListenNoiseType
|
|||
{
|
||||
};
|
||||
|
||||
enum class EKnockBackType
|
||||
{
|
||||
Zero,
|
||||
One
|
||||
};
|
||||
|
||||
class CAiFuncMap;
|
||||
class CStateManager;
|
||||
class CAi : public CPhysicsActor
|
||||
|
@ -42,7 +48,7 @@ public:
|
|||
virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {}
|
||||
virtual CHealthInfo* HealthInfo() { return &x258_healthInfo; }
|
||||
virtual void Death(const zeus::CVector3f&, CStateManager&)=0;
|
||||
virtual void KnockBack(const zeus::CVector3f&, CStateManager&)=0;
|
||||
virtual void KnockBack(const zeus::CVector3f&, CStateManager&, const CDamageInfo& info, EKnockBackType, bool, float)=0;
|
||||
virtual CDamageVulnerability GetDamageVulnerability() { return x260_damageVulnerability; }
|
||||
virtual void TakeDamage(const zeus::CVector3f&, float) {}
|
||||
virtual bool CanBeShot(const CStateManager&, int) { return true; }
|
||||
|
|
|
@ -25,7 +25,7 @@ CDamageInfo& CDamageInfo::operator=(const DataSpec::SShotParam& other)
|
|||
return *this;
|
||||
}
|
||||
|
||||
float CDamageInfo::GetDamage(const CDamageVulnerability& dVuln)
|
||||
float CDamageInfo::GetDamage(const CDamageVulnerability& dVuln) const
|
||||
{
|
||||
EVulnerability vuln = dVuln.GetVulnerability(x0_weaponMode, false);
|
||||
if (vuln == EVulnerability::Reflect)
|
||||
|
@ -36,7 +36,7 @@ float CDamageInfo::GetDamage(const CDamageVulnerability& dVuln)
|
|||
return x8_damage;
|
||||
}
|
||||
|
||||
float CDamageInfo::GetRadiusDamage(const CDamageVulnerability& dVuln)
|
||||
float CDamageInfo::GetRadiusDamage(const CDamageVulnerability& dVuln) const
|
||||
{
|
||||
EVulnerability vuln = dVuln.GetVulnerability(x0_weaponMode, false);
|
||||
if (vuln == EVulnerability::Reflect)
|
||||
|
|
|
@ -47,9 +47,9 @@ public:
|
|||
void SetRadius(float r) { x10_radius = r; }
|
||||
float GetKnockBackPower() const { return x14_knockback; }
|
||||
float GetDamage() const { return x8_damage; }
|
||||
float GetDamage(const CDamageVulnerability& dVuln);
|
||||
float GetDamage(const CDamageVulnerability& dVuln) const;
|
||||
float GetRadiusDamage() const { return xc_radiusDamage; }
|
||||
float GetRadiusDamage(const CDamageVulnerability& dVuln);
|
||||
float GetRadiusDamage(const CDamageVulnerability& dVuln) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
const CActorParameters& params, bool b1);
|
||||
|
||||
virtual void Death(const zeus::CVector3f&, CStateManager&) {}
|
||||
virtual void KnockBack(const zeus::CVector3f&, CStateManager&) {}
|
||||
virtual void KnockBack(const zeus::CVector3f&, CStateManager&, const CDamageInfo& info, EKnockBackType, bool, float) {}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -141,6 +141,11 @@ float CPlayer::GetMaximumPlayerPositiveVerticalVelocity(CStateManager&) const {
|
|||
|
||||
void CPlayer::ProcessInput(const CFinalInput&, CStateManager&) {}
|
||||
|
||||
void CPlayer::Stop(CStateManager& stateMgr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CPlayer::GetFrozenState() const { return false; }
|
||||
|
||||
void CPlayer::Think(float, CStateManager&) {}
|
||||
|
@ -308,6 +313,8 @@ float CPlayer::GetStepDownHeight() const { return 0.f; }
|
|||
|
||||
void CPlayer::Teleport(const zeus::CTransform& xf, CStateManager& mgr, bool) {}
|
||||
|
||||
void CPlayer::BombJump(const zeus::CVector3f& pos, CStateManager& mgr) {}
|
||||
|
||||
zeus::CTransform CPlayer::CreateTransformFromMovementDirection() const { return {}; }
|
||||
|
||||
const CCollisionPrimitive* CPlayer::GetCollisionPrimitive() const { return CPhysicsActor::GetCollisionPrimitive(); }
|
||||
|
|
|
@ -336,6 +336,7 @@ public:
|
|||
void UpdateFreeLook(float dt);
|
||||
float GetMaximumPlayerPositiveVerticalVelocity(CStateManager&) const;
|
||||
void ProcessInput(const CFinalInput&, CStateManager&);
|
||||
void Stop(CStateManager& stateMgr);
|
||||
bool GetFrozenState() const;
|
||||
void Think(float, CStateManager&);
|
||||
void PreThink(float, CStateManager&);
|
||||
|
@ -407,6 +408,7 @@ public:
|
|||
float GetStepUpHeight() const;
|
||||
float GetStepDownHeight() const;
|
||||
void Teleport(const zeus::CTransform& xf, CStateManager& mgr, bool);
|
||||
void BombJump(const zeus::CVector3f& pos, CStateManager& mgr);
|
||||
zeus::CTransform CreateTransformFromMovementDirection() const;
|
||||
const CCollisionPrimitive* GetCollisionPrimitive() const;
|
||||
zeus::CTransform GetPrimitiveTransform() const;
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef __URDE_CSNAKEWEEDSWARM_HPP__
|
||||
#define __URDE_CSNAKEWEEDSWARM_HPP__
|
||||
|
||||
#include "World/CActor.hpp"
|
||||
#include "Collision/CCollisionSurface.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CSnakeWeedSwarm : public CActor
|
||||
{
|
||||
public:
|
||||
void ApplyRadiusDamage(const zeus::CVector3f& pos, const CDamageInfo& info,
|
||||
CStateManager& stateMgr) {}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __URDE_CSNAKEWEEDSWARM_HPP__
|
|
@ -57,6 +57,8 @@ public:
|
|||
|
||||
void Accept(IVisitor &visitor);
|
||||
zeus::CVector3f GetLastKilledOffset() const { return x130_lastKilledOffset; }
|
||||
void ApplyRadiusDamage(const zeus::CVector3f& pos, const CDamageInfo& info,
|
||||
CStateManager& stateMgr) {}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
2
specter
2
specter
|
@ -1 +1 @@
|
|||
Subproject commit 614a06918ab4ab0b3937f3a7f88ad170138585d3
|
||||
Subproject commit 5c98a6ee00491839eb7357355614caecc6942f1f
|
Loading…
Reference in New Issue