This commit is contained in:
Jack Andersen 2017-02-28 20:04:09 -10:00
commit 39040b5ab3
16 changed files with 283 additions and 68 deletions

View File

@ -5,74 +5,53 @@ namespace urde
const CCollisionPrimitive::Type CCollidableSphere::sType(CCollidableSphere::SetStaticTableIndex, "CCollidableSphere");
u32 CCollidableSphere::sTableIndex = -1;
u32 CCollidableSphere::GetTableIndex() const
{
return sTableIndex;
}
zeus::CAABox CCollidableSphere::CalculateAABox(const zeus::CTransform &) const
{
return {};
}
zeus::CAABox CCollidableSphere::CalculateLocalAABox() const
{
return {};
}
FourCC CCollidableSphere::GetPrimType() const
{
return SBIG('SPHR');
}
CRayCastResult CCollidableSphere::CastRayInternal(const CInternalRayCastStructure &) const
{
return {};
}
const CCollisionPrimitive::Type& CCollidableSphere::GetType()
{
return sType;
}
void CCollidableSphere::SetStaticTableIndex(u32 index)
{
sTableIndex = index;
}
bool CCollidableSphere::CollideMovingAABox(const CInternalCollisionStructure &, const zeus::CVector3f &, double &, CCollisionInfo &)
{
return false;
}
bool CCollidableSphere::CollideMovingSphere(const CInternalCollisionStructure &, const zeus::CVector3f &, double &, CCollisionInfo &)
{
return false;
}
namespace Collide
{
bool Sphere_AABox(const CInternalCollisionStructure &, CCollisionInfoList &)
bool Sphere_AABox(const CInternalCollisionStructure&, CCollisionInfoList&) { return false; }
bool Sphere_AABox_Bool(const CInternalCollisionStructure&) { return false; }
bool Sphere_Sphere(const CInternalCollisionStructure&, CCollisionInfoList&) { return false; }
bool Sphere_Sphere_Bool(const CInternalCollisionStructure&) { return false; }
}
CCollidableSphere::CCollidableSphere(const zeus::CSphere& sphere, const CMaterialList& list)
: CCollisionPrimitive(list), x10_sphere(sphere)
{
}
const zeus::CSphere& CCollidableSphere::GetSphere() const { return x10_sphere; }
void CCollidableSphere::SetSphereCenter(const zeus::CVector3f&)
{
}
u32 CCollidableSphere::GetTableIndex() const { return sTableIndex; }
zeus::CAABox CCollidableSphere::CalculateAABox(const zeus::CTransform&) const { return {}; }
zeus::CAABox CCollidableSphere::CalculateLocalAABox() const { return {}; }
FourCC CCollidableSphere::GetPrimType() const { return SBIG('SPHR'); }
CRayCastResult CCollidableSphere::CastRayInternal(const CInternalRayCastStructure&) const { return {}; }
const CCollisionPrimitive::Type& CCollidableSphere::GetType() { return sType; }
void CCollidableSphere::SetStaticTableIndex(u32 index) { sTableIndex = index; }
bool CCollidableSphere::CollideMovingAABox(const CInternalCollisionStructure&, const zeus::CVector3f&, double&,
CCollisionInfo&)
{
return false;
}
bool Sphere_AABox_Bool(const CInternalCollisionStructure &)
bool CCollidableSphere::CollideMovingSphere(const CInternalCollisionStructure&, const zeus::CVector3f&, double&,
CCollisionInfo&)
{
return false;
}
bool Sphere_Sphere(const CInternalCollisionStructure &, CCollisionInfoList &)
{
return false;
}
bool Sphere_Sphere_Bool(const CInternalCollisionStructure &)
{
return false;
}
}
}

View File

@ -2,6 +2,7 @@
#define __URDE_CCOLLIDALBESPHERE_HPP
#include "CCollisionPrimitive.hpp"
#include "zeus/CSphere.hpp"
namespace urde
{
@ -17,7 +18,14 @@ class CCollidableSphere : public CCollisionPrimitive
static const Type sType;
static u32 sTableIndex;
zeus::CSphere x10_sphere;
public:
CCollidableSphere(const zeus::CSphere&, const CMaterialList&);
const zeus::CSphere& GetSphere() const;
void SetSphereCenter(const zeus::CVector3f&);
virtual u32 GetTableIndex() const;
virtual zeus::CAABox CalculateAABox(const zeus::CTransform&) const;
virtual zeus::CAABox CalculateLocalAABox() const;

View File

@ -29,4 +29,18 @@ CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, bo
zeus::CAABox::skNullBox, SMoverData(mass), CActorParameters::None(), 0.3f, 0.1f)
{
}
void CCollisionActor::AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {}
CHealthInfo* CCollisionActor::HealthInfo() { return &x28c_healthInfo; }
const CDamageVulnerability* CCollisionActor::GetDamageVulnerability() const { return &x294_damageVuln; }
const CDamageVulnerability* CCollisionActor::GetDamageVulnerability(const zeus::CVector3f&, const zeus::CVector3f&,
const CDamageInfo&) const
{
return GetDamageVulnerability();
}
void CCollisionActor::SetDamageVulnerability(const CDamageVulnerability& vuln) { x294_damageVuln = vuln; }
}

View File

@ -2,15 +2,37 @@
#define __URDE_CCOLLISIONACTOR_HPP__
#include "World/CPhysicsActor.hpp"
#include "World/CHealthInfo.hpp"
#include "World/CDamageVulnerability.hpp"
#include "Collision/CCollidableOBBTreeGroup.hpp"
#include "Collision/CCollidableSphere.hpp"
namespace urde
{
class CCollisionActor : public CPhysicsActor
{
u32 x258_;
TUniqueId x25c_;
zeus::CVector3f x260_boxSize;
std::unique_ptr<CCollidableOBBTreeGroup> x278_obbTG1;
std::unique_ptr<CCollidableOBBTreeGroup> x27c_obbTG2;
std::unique_ptr<CCollidableSphere> x284_;
float x288_sphereRadius;
CHealthInfo x28c_healthInfo = CHealthInfo(0.f);
CDamageVulnerability x294_damageVuln = CDamageVulnerability::NormalVulnerabilty();
TUniqueId x2fc_lastTouched;
EWeaponCollisionResponseTypes x300_responseType;
public:
CCollisionActor(TUniqueId, TAreaId, TUniqueId, const zeus::CVector3f&, const zeus::CVector3f&, bool, float);
CCollisionActor(TUniqueId, TAreaId, TUniqueId, const zeus::CVector3f&, bool, float);
CCollisionActor(TUniqueId, TAreaId, TUniqueId, bool, float, float);
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
CHealthInfo* HealthInfo();
const CDamageVulnerability* GetDamageVulnerability() const;
const CDamageVulnerability* GetDamageVulnerability(const zeus::CVector3f&, const zeus::CVector3f&,
const CDamageInfo&) const;
void SetDamageVulnerability(const CDamageVulnerability& vuln);
};
}

View File

@ -0,0 +1,10 @@
#include "CCollisionActorManager.hpp"
namespace urde
{
CCollisionActorManager::CCollisionActorManager(CStateManager&, TUniqueId, TAreaId,
const std::vector<CJointCollisionDescription>&, bool)
{
}
}

View File

@ -0,0 +1,36 @@
#ifndef __URDE_CCOLLISIONACTORMANAGER_HPP__
#define __URDE_CCOLLISIONACTORMANAGER_HPP__
#include "RetroTypes.hpp"
#include "zeus/CAABox.hpp"
#include "Collision/CJointCollisionDescription.hpp"
namespace urde
{
class CAnimData;
class CCollisionActor;
class CStateManager;
class CCollisionActorManager
{
public:
enum class EUpdateOptions
{
};
private:
std::vector<CJointCollisionDescription> x0_jointDescriptions;
TUniqueId x10_;
public:
CCollisionActorManager(CStateManager&, TUniqueId, TAreaId, const std::vector<CJointCollisionDescription>&, bool);
void Update(float, CStateManager&, EUpdateOptions) const;
void Destroy(CStateManager&) const;
void SetActive(CStateManager&, bool);
u32 GetNumCollisionActors() const;
CJointCollisionDescription GetCollisionDescFfromIndex(u32) const;
zeus::CTransform GetWRLocatorTransform(const CAnimData&, CSegId, const zeus::CTransform&, const zeus::CTransform&);
};
}
#endif // __URDE_CCOLLISIONACTORMANAGER_HPP__

View File

@ -0,0 +1,11 @@
#include "Collision/CJointCollisionDescription.hpp"
namespace urde
{
CJointCollisionDescription::CJointCollisionDescription(ECollisionType, CSegId, CSegId, const zeus::CVector3f&,
const zeus::CVector3f&, float, float, EOrientationType,
const std::string&, float)
{
}
}

View File

@ -0,0 +1,47 @@
#ifndef __URDE_CJOINTCOLLISIONDESCRIPTION_HPP__
#define __URDE_CJOINTCOLLISIONDESCRIPTION_HPP__
#include "Character/CSegId.hpp"
#include "zeus/CAABox.hpp"
namespace urde
{
class CJointCollisionDescription
{
public:
enum class ECollisionType
{
};
enum class EOrientationType
{
};
private:
public:
CJointCollisionDescription(ECollisionType, CSegId, CSegId, const zeus::CVector3f&, const zeus::CVector3f&, float,
float, EOrientationType, const std::string&, float);
const std::string& GetName() const;
void GetCollisionActorId() const;
void SphereSubdivideCollision(ECollisionType, CSegId, CSegId, float, float, EOrientationType, const std::string&,
float);
void SphereCollision(CSegId, float, const std::string&, float);
void AABoxCollision(CSegId, zeus::CVector3f const &, const std::string&, float);
void OBBAutoSizeCollision(CSegId, CSegId, const zeus::CVector3f&, EOrientationType, const std::string&, float);
void OBBCollision(CSegId, const zeus::CVector3f&, const zeus::CVector3f&, const std::string&, float);
zeus::CVector3f GetPivotPoint() const;
float GetRadius() const;
void SetCollisionActorId(TUniqueId);
EOrientationType GetOrientationType() const;
float GetMass() const;
zeus::CAABox GetBounds() const;
void GetType() const;
void GetNextId() const;
void GetPivotId() const;
void ScaleAllBounds(const zeus::CVector3f&);
void GetTween() const;
};
}
#endif // __URDE_CJOINTCOLLISIONDESCRIPTION_HPP__

View File

@ -19,6 +19,8 @@ set(COLLISION_SOURCES
CMaterialFilter.hpp CMaterialFilter.cpp
CInternalRayCastStructure.hpp CInternalRayCastStructure.cpp
CRayCastResult.hpp CRayCastResult.cpp
CCollisionActor.hpp CCollisionActor.cpp)
CCollisionActor.hpp CCollisionActor.cpp
CCollisionActorManager.hpp CCollisionActorManager.cpp
CJointCollisionDescription.hpp CJointCollisionDescription.cpp)
runtime_add_list(Collision COLLISION_SOURCES)

View File

@ -3,6 +3,37 @@
namespace urde
{
const CDamageVulnerability CDamageVulnerability::sNormalVulnerability(
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal,
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal,
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal,
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal,
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal,
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::DoubleDamage);
const CDamageVulnerability CDamageVulnerability::sImmuneVulnerability(
EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect,
EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect,
EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect,
EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect,
EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect,
EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::DoubleDamage);
/* LOL, thanks retro */
const CDamageVulnerability CDamageVulnerability::sReflectVulnerability(
EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect,
EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect,
EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect,
EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect,
EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect,
EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::Reflect, EVulnerability::DoubleDamage);
const CDamageVulnerability CDamageVulnerability::sPassThroughVulnerability(
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::DoubleDamage);
static inline bool is_normal_or_weak(EVulnerability vuln)
{
return (vuln == EVulnerability::DoubleDamage || vuln == EVulnerability::Normal);
@ -10,8 +41,7 @@ static inline bool is_normal_or_weak(EVulnerability vuln)
static inline bool is_not_immune(EVulnerability vuln)
{
return vuln != EVulnerability::Immune &&
vuln != EVulnerability::DirectImmune;
return vuln != EVulnerability::Immune && vuln != EVulnerability::DirectImmune;
}
void CDamageVulnerability::ConstructNew(CInputStream& in, int propCount)
@ -72,6 +102,42 @@ CDamageVulnerability::CDamageVulnerability(CInputStream& in)
ConstructNew(in, propCount);
}
CDamageVulnerability::CDamageVulnerability(EVulnerability power, EVulnerability ice, EVulnerability wave,
EVulnerability plasma, EVulnerability bomb, EVulnerability powerBomb,
EVulnerability missile, EVulnerability boostBall, EVulnerability phazon,
EVulnerability enemyWp1, EVulnerability enemyWp2, EVulnerability enemyWp3,
EVulnerability enemyWp4, EVulnerability v1, EVulnerability v2,
EVulnerability chargedPower, EVulnerability chargedIce,
EVulnerability chargedWave, EVulnerability chargedPlasma,
EVulnerability superMissile, EVulnerability iceSpreader,
EVulnerability waveBuster, EVulnerability flameThrower, EVulnerability v3)
: x0_power(power)
, x4_ice(ice)
, x8_wave(wave)
, xc_plasma(plasma)
, x10_bomb(bomb)
, x14_powerbomb(powerBomb)
, x18_missile(missile)
, x1c_boostBall(boostBall)
, x20_phazon(phazon)
, x24_enemyWp1(enemyWp1)
, x28_enemyWp2Poison(enemyWp2)
, x2c_enemyWp3Lava(enemyWp3)
, x30_enemyWp4(enemyWp4)
, x34_unk1(v1)
, x38_unk2(v2)
, x3c_chargedPower(chargedPower)
, x40_chargedIce(chargedIce)
, x44_chargedWave(chargedWave)
, x48_chargedPlasma(chargedPlasma)
, x4c_superMissile(superMissile)
, x50_iceSpreader(iceSpreader)
, x54_wavebuster(waveBuster)
, x58_flamethrower(flameThrower)
, x5c_(v3)
{
}
EVulnerability CDamageVulnerability::GetPhazonVulnerability(const CWeaponMode& mode) const
{
if (mode.IsCharged())

View File

@ -53,14 +53,32 @@ class CDamageVulnerability
void ConstructNew(CInputStream& in, int propCount);
static const CDamageVulnerability sNormalVulnerability;
static const CDamageVulnerability sImmuneVulnerability;
static const CDamageVulnerability sReflectVulnerability;
static const CDamageVulnerability sPassThroughVulnerability;
public:
CDamageVulnerability(CInputStream& in);
CDamageVulnerability(EVulnerability power, EVulnerability ice, EVulnerability wave, EVulnerability plasma,
EVulnerability bomb, EVulnerability powerBomb, EVulnerability missile,
EVulnerability boostBall, EVulnerability phazon, EVulnerability enemyWp1,
EVulnerability enemyWp2, EVulnerability enemyWp3, EVulnerability enemyWp4, EVulnerability v1,
EVulnerability v2, EVulnerability chargedPower, EVulnerability chargedIce,
EVulnerability chargedWave, EVulnerability chargedPlasma, EVulnerability superMissile,
EVulnerability iceSpreader, EVulnerability waveBuster, EVulnerability flameThrower,
EVulnerability v3);
EVulnerability GetPhazonVulnerability(const CWeaponMode& mode) const;
bool WeaponHurts(const CWeaponMode&, bool ignoreDirect) const;
bool WeaponHits(const CWeaponMode& mode, bool checkDirect) const;
EVulnerability GetVulnerability(const CWeaponMode& mode, bool ignoreDirect) const;
static CDamageVulnerability NormalVulnerabilty() { return sNormalVulnerability; }
static CDamageVulnerability ImmuneVulnerabilty() { return sImmuneVulnerability; }
static CDamageVulnerability ReflectVulnerabilty() { return sReflectVulnerability; }
static CDamageVulnerability PasshThroughVulnerabilty() { return sPassThroughVulnerability; }
};
}

View File

@ -38,7 +38,7 @@ public:
bool InSpiderBallMode() const { return false; }
zeus::CVector3f GetBallContactSurfaceNormal() const { return {}; }
void GetModel() const {}
CCollidableSphere GetCollidableSphere() const { return {}; }
CCollidableSphere* GetCollidableSphere() const { return nullptr; }
bool IsProjectile() const { return false; }
void GetBallContactMeterials() const {}
void GetWallBumpCounter() const {}

View File

@ -10,7 +10,7 @@ CPhysicsActor::CPhysicsActor(TUniqueId uid, bool active, const std::string& name
: CActor(uid, active, name, info, xf, std::move(mData), matList, actorParms, kInvalidUniqueId)
, xe8_mass(moverData.x30_mass)
, xec_massRecip(moverData.x30_mass <= 0.f ? 1.f : 1.f / moverData.x30_mass)
, x150_momentum(moverData.x18_)
, x150_momentum(moverData.x18_momentum)
, x1c0_collisionPrimitive(box, matList)
, x1f4_translation(xf.origin)
, x200_orientation(xf.buildMatrix3f())

View File

@ -13,7 +13,7 @@ struct SMoverData
{
zeus::CVector3f x0_velocity;
zeus::CAxisAngle xc_angularVelocity;
zeus::CVector3f x18_;
zeus::CVector3f x18_momentum;
zeus::CAxisAngle x24_;
float x30_mass;

View File

@ -218,6 +218,8 @@ enum class EScriptObjectMessage
InternalMessage16 = 38,
InternalMessage17 = 39,
InternalMessage18 = 40,
InternalMessage19 = 41,
InternalMessage20 = 42
};
}

2
amuse

@ -1 +1 @@
Subproject commit a23af16349383be647494e9ae245568cc5194eae
Subproject commit 54bbc7399a57a50ced2725094d9a0b8a4ea79c39