#pragma once #include #include #include #include #include #include #include "Runtime/rstl.hpp" #include "Runtime/Weapon/CGameProjectile.hpp" namespace metaforce { class CCollisionPrimitive; class CCollisionInfoList; class CCollisionInfo; class CNewFlameThrower : public CGameProjectile { struct Contact { Contact(float contact, u32 remainingTime) : contact(contact), remainingTime(remainingTime) {} float contact; u32 remainingTime; bool operator<(Contact const& o) const { return contact < o.contact; } }; struct Cube { Cube(zeus::CVector3f center, float bounds) : center(center), bounds(bounds) {} zeus::CVector3f center; float bounds; }; enum class EFlameState { Default, FireStart, FireActive, FireStopTimer, FireWaitForParticlesDone }; CRandom16 x2e8_rand{99}; float x2ec_particlesDoneTimer = 0.f; float x2f0_flamesDoneTimer = 0.f; zeus::CVector3f x2f4_lastParticleCollisionLoc; bool x300_wasPointAdded = false; TCachedToken x304_mainFire; TCachedToken x310_mainSmoke; TCachedToken x31c_secondarySmoke; TCachedToken x328_secondaryFire; TCachedToken x334_secondarySparks; TCachedToken x340_swooshCenter; TCachedToken x34c_swooshFire; std::unique_ptr x358_mainFireGen; std::unique_ptr x35c_mainSmokeGen; std::unique_ptr x360_secondarySmokeGen; std::unique_ptr x364_secondaryFireGen; std::unique_ptr x368_secondarySparksGen; std::unique_ptr x36c_swooshCenterGen; std::unique_ptr x370_swooshFireGen; EFlameState x374_flameState = EFlameState::Default; TAreaId x378_currentLitArea = kInvalidAreaId; bool x37c_24_renderAuxEffects : 1 = false; bool x37c_25_firing : 1 = false; bool x37c_26_runningSlowish : 1 = false; bool x37c_27_newPointAdded : 1 = true; bool x37c_28_activeLighting : 1 = false; rstl::reserved_vector, 3> x380_flameContactPoints; int x3b4_numSmokeParticlesSpawned = 0; rstl::reserved_vector x3b8_lightIds; // std::array, 5> beam_filters; void DeleteLightObjects(CStateManager& mgr); void CreateLightObjects(CStateManager& mgr); void EnableFx(CStateManager& mgr); void UpdateLights(CStateManager& mgr); bool UpdateParticleCollisions(float dt, CStateManager &mgr, rstl::reserved_vector &collisions_out); bool CanDamageActor(CActor &hit_actor, CStateManager &mgr); void AddContactPoint(CCollisionInfo const& cinfo, u32 time); int SortAndFindOverlappingPoints(Cube const& box); bool FindCollisionInNearList(CStateManager &mgr, rstl::reserved_vector const &near_list, CCollisionPrimitive const& coll, TUniqueId &first_coll_out, CCollisionInfoList& collisions); void DecrementContactPointTimers(); void SetLightsActive(CStateManager &mgr, bool active); void UpdateFlameState(float dt, CStateManager &mgr); void SetWorldLighting(CStateManager &mgr, TAreaId area, float speed, float target); // void RenderParticles(std::array const& elem_gens); // void LoadParticleGenQuads(); bool loaded_textures = false; public: // Resinfo: // NFTMainFire // NFTMainSmoke // NFTSwooshCenter // NFTSwooshFire // NFTSecondarySmoke // NFTSecondaryFire // NFTSecondarySparks // CNewFlameThrower(const TToken& desc, std::string_view name, EWeaponType wType, const std::array& resInfo, const zeus::CTransform& xf, EMaterialTypes matType, const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid, TUniqueId owner, EProjectileAttrib attribs); void StartFiring(const zeus::CTransform& xf, CStateManager& mgr); bool CanRenderAuxEffects() const { return x37c_24_renderAuxEffects; } bool IsFiring() const { return x37c_25_firing; } bool AreEffectsFinished() const; void UpdateFx(const zeus::CTransform& xf, float dt, CStateManager& mgr); void Reset(CStateManager& mgr, bool deactivate); void Render(CStateManager& mgr) override; void Think(float dt, CStateManager &mgr) override; std::optional GetTouchBounds() const override { return {}; } void Accept(IVisitor& visitor) override; void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager &mgr) override; void AddToRenderer(zeus::CFrustum const& planes, CStateManager& mgr) override; }; } // namespace metaforce