2020-03-26 22:09:50 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-09-20 21:25:46 +00:00
|
|
|
#include "Runtime/Particle/CElementGen.hpp"
|
2020-03-26 22:09:50 +00:00
|
|
|
#include "Runtime/World/CActor.hpp"
|
|
|
|
#include "Runtime/World/CDamageInfo.hpp"
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce::MP1 {
|
2020-03-26 22:09:50 +00:00
|
|
|
struct SShockWaveData {
|
2020-04-01 06:41:31 +00:00
|
|
|
private:
|
2020-03-26 22:09:50 +00:00
|
|
|
u32 x0_ = 8;
|
|
|
|
CAssetId x4_particleDesc;
|
|
|
|
CDamageInfo x8_damageInfo;
|
2020-05-07 23:13:43 +00:00
|
|
|
float x24_initialRadius = 0.f;
|
|
|
|
float x28_widthPercent = 0.5f;
|
|
|
|
float x2c_initialExpansionSpeed;
|
|
|
|
float x30_speedIncrease = 0.f;
|
2020-03-26 22:09:50 +00:00
|
|
|
CAssetId x34_weaponDesc;
|
2020-04-01 06:41:31 +00:00
|
|
|
u16 x38_electrocuteSfx;
|
|
|
|
|
|
|
|
public:
|
2020-05-07 23:13:43 +00:00
|
|
|
SShockWaveData(CAssetId part, const CDamageInfo& dInfo, float initialExpansionSpeed, CAssetId weapon, u16 sfx)
|
|
|
|
: x4_particleDesc(part)
|
|
|
|
, x8_damageInfo(dInfo)
|
|
|
|
, x2c_initialExpansionSpeed(initialExpansionSpeed)
|
|
|
|
, x34_weaponDesc(weapon)
|
|
|
|
, x38_electrocuteSfx(sfx) {}
|
2020-03-26 22:09:50 +00:00
|
|
|
|
2020-04-01 06:41:31 +00:00
|
|
|
[[nodiscard]] CAssetId GetParticleDescId() const { return x4_particleDesc; }
|
|
|
|
[[nodiscard]] const CDamageInfo& GetDamageInfo() const { return x8_damageInfo; }
|
2020-05-07 23:13:43 +00:00
|
|
|
[[nodiscard]] float GetInitialRadius() const { return x24_initialRadius; }
|
|
|
|
[[nodiscard]] float GetWidthPercent() const { return x28_widthPercent; }
|
|
|
|
[[nodiscard]] float GetInitialExpansionSpeed() const { return x2c_initialExpansionSpeed; }
|
|
|
|
[[nodiscard]] float GetSpeedIncrease() const { return x30_speedIncrease; }
|
2020-09-20 21:25:46 +00:00
|
|
|
void SetSpeedIncrease(float speed) { x30_speedIncrease = speed; }
|
2020-04-01 06:41:31 +00:00
|
|
|
[[nodiscard]] CAssetId GetWeaponDescId() const { return x34_weaponDesc; }
|
|
|
|
[[nodiscard]] u16 GetElectrocuteSfx() const { return x38_electrocuteSfx; }
|
2020-03-26 22:09:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CShockWave : public CActor {
|
2020-03-31 07:29:00 +00:00
|
|
|
private:
|
2020-05-07 23:13:43 +00:00
|
|
|
TUniqueId xe8_parentId;
|
2020-03-26 22:09:50 +00:00
|
|
|
CDamageInfo xec_damageInfo;
|
|
|
|
TToken<CGenDescription> x108_elementGenDesc;
|
|
|
|
std::unique_ptr<CElementGen> x110_elementGen;
|
|
|
|
SShockWaveData x114_data;
|
2020-05-07 23:13:43 +00:00
|
|
|
float x150_radius;
|
|
|
|
float x154_expansionSpeed;
|
2020-04-01 18:54:01 +00:00
|
|
|
float x158_activeTime = 0.f;
|
|
|
|
float x15c_minActiveTime;
|
|
|
|
float x160_knockback;
|
2020-04-01 06:41:31 +00:00
|
|
|
float x164_timeSinceHitPlayerInAir = 0.f;
|
|
|
|
float x168_timeSinceHitPlayer = 0.f;
|
|
|
|
bool x16c_hitPlayerInAir = false;
|
|
|
|
bool x16d_hitPlayer = false;
|
|
|
|
rstl::reserved_vector<TUniqueId, 1024> x170_hitIds;
|
2020-03-26 22:09:50 +00:00
|
|
|
std::optional<TToken<CElectricDescription>> x974_electricDesc;
|
|
|
|
TUniqueId x980_id2 = kInvalidUniqueId;
|
|
|
|
|
2020-03-31 07:29:00 +00:00
|
|
|
public:
|
2021-05-26 14:00:57 +00:00
|
|
|
DEFINE_ENTITY
|
2020-03-26 22:09:50 +00:00
|
|
|
CShockWave(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
2020-04-01 18:54:01 +00:00
|
|
|
TUniqueId parent, const SShockWaveData& data, float minActiveTime, float knockback);
|
2020-03-26 22:09:50 +00:00
|
|
|
|
|
|
|
void Accept(IVisitor& visitor) override;
|
|
|
|
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override;
|
2020-04-05 11:54:02 +00:00
|
|
|
void AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr) override;
|
2020-03-31 07:29:00 +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-26 22:09:50 +00:00
|
|
|
void Think(float dt, CStateManager& mgr) override;
|
|
|
|
void Touch(CActor& actor, CStateManager& mgr) override;
|
2020-04-01 06:41:31 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
[[nodiscard]] bool IsHit(TUniqueId id) const;
|
2020-03-26 22:09:50 +00:00
|
|
|
};
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce::MP1
|