2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2017-09-10 00:36:21 +00:00
|
|
|
|
2019-09-23 19:00:23 +00:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "Runtime/CRandom16.hpp"
|
|
|
|
#include "Runtime/RetroTypes.hpp"
|
|
|
|
#include "Runtime/Weapon/CGameProjectile.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CTransform.hpp>
|
|
|
|
#include <zeus/CVector3f.hpp>
|
2017-09-10 00:36:21 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
class CWaveBuster : public CGameProjectile {
|
|
|
|
zeus::CTransform x2e8_originalXf;
|
|
|
|
zeus::CVector3f x318_;
|
|
|
|
zeus::CVector3f x324_;
|
|
|
|
zeus::CVector3f x330_;
|
|
|
|
zeus::CVector3f x33c_;
|
|
|
|
zeus::CVector3f x348_targetPoint;
|
|
|
|
TCachedToken<CSwooshDescription> x354_busterSwoosh1;
|
|
|
|
TCachedToken<CSwooshDescription> x360_busterSwoosh2;
|
|
|
|
TCachedToken<CGenDescription> x36c_busterSparks;
|
|
|
|
TCachedToken<CGenDescription> x378_busterLight;
|
|
|
|
std::unique_ptr<CParticleSwoosh> x384_busterSwoosh1Gen;
|
|
|
|
std::unique_ptr<CParticleSwoosh> x388_busterSwoosh2Gen;
|
|
|
|
std::unique_ptr<CElementGen> x38c_busterSparksGen;
|
|
|
|
std::unique_ptr<CElementGen> x390_busterLightGen;
|
2020-04-11 19:35:44 +00:00
|
|
|
CRandom16 x394_rand{99};
|
2020-04-15 07:56:10 +00:00
|
|
|
float x398_ = 2.f * M_PIF;
|
2018-12-08 05:30:43 +00:00
|
|
|
float x39c_ = 0.5f;
|
|
|
|
float x3a0_ = 0.5f;
|
|
|
|
float x3a4_ = 0.f;
|
|
|
|
float x3a8_ = 0.f;
|
|
|
|
float x3ac_ = 0.f;
|
|
|
|
float x3b0_ = 0.f;
|
|
|
|
float x3b4_ = 0.f;
|
|
|
|
float x3b8_ = 0.f;
|
|
|
|
float x3bc_ = 0.f;
|
|
|
|
float x3c0_ = 0.f;
|
|
|
|
float x3c4_ = 0.f;
|
|
|
|
float x3c8_ = 0.f;
|
|
|
|
u32 x3cc_ = 0;
|
2020-04-13 02:28:06 +00:00
|
|
|
bool x3d0_24_firing : 1;
|
|
|
|
bool x3d0_25_ : 1;
|
|
|
|
bool x3d0_26_ : 1;
|
|
|
|
bool x3d0_27_ : 1;
|
|
|
|
bool x3d0_28_ : 1;
|
|
|
|
CLineRenderer m_lineRenderer1;
|
|
|
|
CLineRenderer m_lineRenderer2;
|
2017-09-10 00:36:21 +00:00
|
|
|
|
2020-04-15 07:56:10 +00:00
|
|
|
void RenderParticles();
|
|
|
|
void RenderBeam();
|
2020-04-15 21:57:28 +00:00
|
|
|
CRayCastResult SeekDamageTarget(TUniqueId& uid, const zeus::CVector3f& pos, const zeus::CVector3f& dir, CStateManager& mgr,
|
2020-04-15 21:49:22 +00:00
|
|
|
float dt);
|
|
|
|
bool ApplyDamageToTarget(TUniqueId damagee, const CRayCastResult& actRes, const CRayCastResult& physRes,
|
|
|
|
const CRayCastResult& selfRes, CStateManager& mgr, float dt);
|
|
|
|
[[nodiscard]] float GetViewAngleToTarget(zeus::CVector3f& p1, const CActor& act);
|
2020-04-13 02:28:06 +00:00
|
|
|
void UpdateTargetSeek(float dt, CStateManager& mgr);
|
2020-04-12 09:40:51 +00:00
|
|
|
void UpdateTargetDamage(float dt, CStateManager& mgr);
|
2020-04-13 02:28:06 +00:00
|
|
|
bool UpdateBeamFrame(CStateManager& mgr, float dt);
|
2020-04-15 21:57:28 +00:00
|
|
|
void RayCastTarget(CStateManager& mgr, TUniqueId& physId, TUniqueId& actId, const zeus::CVector3f& start,
|
2020-04-15 21:49:22 +00:00
|
|
|
const zeus::CVector3f& end, float length, CRayCastResult& physRes, CRayCastResult& actorRes);
|
2020-04-15 07:56:10 +00:00
|
|
|
CRayCastResult SeekTarget(float dt, TUniqueId& uid, CStateManager& mgr);
|
|
|
|
|
2017-09-10 00:36:21 +00:00
|
|
|
public:
|
2021-05-26 14:00:57 +00:00
|
|
|
DEFINE_ENTITY
|
2018-12-08 05:30:43 +00:00
|
|
|
CWaveBuster(const TToken<CWeaponDescription>& desc, EWeaponType type, const zeus::CTransform& xf,
|
|
|
|
EMaterialTypes matType, const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid, TUniqueId owner,
|
|
|
|
TUniqueId homingTarget, EProjectileAttrib attrib);
|
2020-05-10 01:17:20 +00:00
|
|
|
void Accept(IVisitor& visitor) override;
|
2020-04-12 09:40:51 +00:00
|
|
|
void Think(float dt, CStateManager& mgr) override;
|
|
|
|
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) override;
|
2020-05-10 01:12:09 +00:00
|
|
|
void AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr) override;
|
2020-04-12 09:40:51 +00:00
|
|
|
void Render(CStateManager& mgr) override;
|
2020-03-09 18:47:34 +00:00
|
|
|
std::optional<zeus::CAABox> GetTouchBounds() const override;
|
2020-04-12 09:40:51 +00:00
|
|
|
bool IsFiring() const { return x3d0_24_firing; }
|
|
|
|
void UpdateFx(const zeus::CTransform& xf, float dt, CStateManager& mgr);
|
|
|
|
void ResetBeam(bool deactivate);
|
|
|
|
void SetNewTarget(TUniqueId id, CStateManager& mgr);
|
2017-09-10 00:36:21 +00:00
|
|
|
};
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|