2020-03-30 07:05:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Runtime/World/CPhysicsActor.hpp"
|
|
|
|
#include "Runtime/World/CDamageInfo.hpp"
|
|
|
|
#include "Runtime/Particle/CElementGen.hpp"
|
|
|
|
|
|
|
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
|
|
|
|
|
|
|
#include <zeus/CTransform.hpp>
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce::MP1 {
|
2020-05-07 23:13:43 +00:00
|
|
|
struct SGrenadeVelocityInfo {
|
2020-03-31 00:40:38 +00:00
|
|
|
private:
|
2020-03-30 07:05:16 +00:00
|
|
|
float x0_mass;
|
2020-05-07 23:13:43 +00:00
|
|
|
float x4_speed;
|
2020-03-31 00:40:38 +00:00
|
|
|
|
|
|
|
public:
|
2020-05-07 23:13:43 +00:00
|
|
|
explicit SGrenadeVelocityInfo(CInputStream& in) : x0_mass(in.readFloatBig()), x4_speed(in.readFloatBig()) {}
|
2020-03-30 07:05:16 +00:00
|
|
|
|
2020-03-31 00:40:38 +00:00
|
|
|
[[nodiscard]] float GetMass() const { return x0_mass; }
|
|
|
|
[[nodiscard]] float GetSpeed() const { return x4_speed; }
|
2020-03-30 07:05:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SBouncyGrenadeData {
|
2020-03-31 00:40:38 +00:00
|
|
|
private:
|
2020-05-07 23:13:43 +00:00
|
|
|
SGrenadeVelocityInfo x0_velocityInfo;
|
2020-03-30 07:05:16 +00:00
|
|
|
CDamageInfo x8_damageInfo;
|
|
|
|
CAssetId x24_elementGenId1;
|
|
|
|
CAssetId x28_elementGenId2;
|
|
|
|
CAssetId x2c_elementGenId3;
|
|
|
|
CAssetId x30_elementGenId4;
|
|
|
|
u32 x34_numBounces;
|
|
|
|
u16 x38_bounceSfx;
|
|
|
|
u16 x3a_explodeSfx;
|
|
|
|
|
2020-03-31 00:40:38 +00:00
|
|
|
public:
|
2020-05-07 23:13:43 +00:00
|
|
|
SBouncyGrenadeData(const SGrenadeVelocityInfo& velocityInfo, const CDamageInfo& damageInfo, CAssetId elementGenId1,
|
|
|
|
CAssetId elementGenId2, CAssetId elementGenId3, CAssetId elementGenId4, u32 numBounces,
|
|
|
|
u16 bounceSfxId, u16 explodeSfxId)
|
|
|
|
: x0_velocityInfo(velocityInfo)
|
2020-03-30 07:05:16 +00:00
|
|
|
, x8_damageInfo(damageInfo)
|
2020-05-07 23:13:43 +00:00
|
|
|
, x24_elementGenId1(elementGenId1)
|
|
|
|
, x28_elementGenId2(elementGenId2)
|
|
|
|
, x2c_elementGenId3(elementGenId3)
|
|
|
|
, x30_elementGenId4(elementGenId4)
|
|
|
|
, x34_numBounces(numBounces)
|
|
|
|
, x38_bounceSfx(bounceSfxId)
|
2020-08-23 19:03:33 +00:00
|
|
|
, x3a_explodeSfx(explodeSfxId) {}
|
2020-03-31 00:40:38 +00:00
|
|
|
|
2020-05-07 23:13:43 +00:00
|
|
|
[[nodiscard]] const SGrenadeVelocityInfo& GetUnkStruct() const { return x0_velocityInfo; }
|
2020-03-31 00:40:38 +00:00
|
|
|
[[nodiscard]] const CDamageInfo& GetDamageInfo() const { return x8_damageInfo; }
|
|
|
|
[[nodiscard]] CAssetId GetElementGenId1() const { return x24_elementGenId1; }
|
|
|
|
[[nodiscard]] CAssetId GetElementGenId2() const { return x28_elementGenId2; }
|
|
|
|
[[nodiscard]] CAssetId GetElementGenId3() const { return x2c_elementGenId3; }
|
|
|
|
[[nodiscard]] CAssetId GetElementGenId4() const { return x30_elementGenId4; }
|
|
|
|
[[nodiscard]] u32 GetNumBounces() const { return x34_numBounces; }
|
|
|
|
[[nodiscard]] u16 GetBounceSfx() const { return x38_bounceSfx; }
|
|
|
|
[[nodiscard]] u16 GetExplodeSfx() const { return x3a_explodeSfx; }
|
2020-03-30 07:05:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CBouncyGrenade : public CPhysicsActor {
|
|
|
|
private:
|
|
|
|
SBouncyGrenadeData x258_data;
|
|
|
|
u32 x294_numBounces;
|
|
|
|
TUniqueId x298_parentId;
|
|
|
|
float x29c_ = 0.f;
|
2020-12-18 11:05:22 +00:00
|
|
|
std::unique_ptr<CElementGen> x2a0_elementGenCombat;
|
|
|
|
std::unique_ptr<CElementGen> x2a4_elementGenXRay;
|
|
|
|
std::unique_ptr<CElementGen> x2a8_elementGenThermal;
|
2020-03-30 07:05:16 +00:00
|
|
|
std::unique_ptr<CElementGen> x2ac_elementGen4;
|
|
|
|
float x2b0_explodePlayerDistance;
|
2020-04-21 07:22:41 +00:00
|
|
|
bool x2b4_24_exploded : 1 = false;
|
|
|
|
bool x2b4_25_ : 1 = false;
|
2020-03-30 07:05:16 +00:00
|
|
|
|
|
|
|
public:
|
2021-05-26 14:00:57 +00:00
|
|
|
DEFINE_ENTITY
|
2020-03-30 07:05:16 +00:00
|
|
|
CBouncyGrenade(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
|
|
|
CModelData&& mData, const CActorParameters& actParams, TUniqueId parentId,
|
|
|
|
const SBouncyGrenadeData& data, float velocity, float explodePlayerDistance);
|
|
|
|
|
|
|
|
void Accept(IVisitor& visitor) override { visitor.Visit(this); }
|
2020-04-05 11:54:02 +00:00
|
|
|
void AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr) override;
|
2020-03-31 00:40:38 +00:00
|
|
|
void CollidedWith(TUniqueId id, const CCollisionInfoList& list, CStateManager& mgr) override;
|
2020-03-30 23:42:11 +00:00
|
|
|
[[nodiscard]] std::optional<zeus::CAABox> GetTouchBounds() const override;
|
2020-04-09 17:28:20 +00:00
|
|
|
void Render(CStateManager& mgr) override;
|
2020-03-30 07:05:16 +00:00
|
|
|
void Think(float dt, CStateManager& mgr) override;
|
|
|
|
void Touch(CActor& act, CStateManager& mgr) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void Explode(CStateManager& mgr, TUniqueId uid);
|
|
|
|
};
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce::MP1
|