2018-10-06 20:42:33 -07:00
|
|
|
#pragma once
|
2018-06-04 12:30:04 -07:00
|
|
|
|
2019-09-22 06:47:06 -07:00
|
|
|
#include <array>
|
|
|
|
|
2019-09-22 06:26:46 -07:00
|
|
|
#include "Runtime/GCNTypes.hpp"
|
|
|
|
#include "Runtime/rstl.hpp"
|
2019-09-22 06:47:06 -07:00
|
|
|
|
2019-09-22 06:26:46 -07:00
|
|
|
#include <zeus/CVector3f.hpp>
|
2018-06-04 12:30:04 -07:00
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
namespace metaforce {
|
2019-09-22 06:26:46 -07:00
|
|
|
class CStateManager;
|
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
struct SBurst {
|
|
|
|
s32 x0_randomSelectionWeight;
|
2019-09-22 06:47:06 -07:00
|
|
|
std::array<s32, 8> x4_shotAngles;
|
2018-12-07 21:30:43 -08:00
|
|
|
float x24_timeToNextShot;
|
|
|
|
float x28_timeToNextShotVariance;
|
2018-06-04 12:30:04 -07:00
|
|
|
};
|
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
class CBurstFire {
|
|
|
|
s32 x0_burstType = -1;
|
|
|
|
s32 x4_angleIdx = -1;
|
|
|
|
float x8_timeToNextShot = 0.f;
|
|
|
|
s32 xc_firstBurstIdx = 0;
|
|
|
|
s32 x10_firstBurstCounter;
|
2020-04-19 21:57:50 -07:00
|
|
|
bool x14_24_shouldFire : 1 = false;
|
|
|
|
bool x14_25_avoidAccuracy : 1 = false;
|
2018-12-07 21:30:43 -08:00
|
|
|
|
|
|
|
const SBurst* x18_curBursts = nullptr;
|
|
|
|
rstl::reserved_vector<const SBurst*, 16> x1c_burstDefs;
|
2018-06-04 12:30:04 -07:00
|
|
|
|
|
|
|
public:
|
2020-03-02 23:59:50 -08:00
|
|
|
CBurstFire(const SBurst* const* burstDefs, s32 firstBurstCount);
|
2018-06-04 12:30:04 -07:00
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
void SetAvoidAccuracy(bool b) { x14_25_avoidAccuracy = b; }
|
|
|
|
void SetBurstType(s32 type) { x0_burstType = type; }
|
|
|
|
void SetTimeToNextShot(float t) { x8_timeToNextShot = t; }
|
|
|
|
float GetTimeToNextShot() const { return x8_timeToNextShot; }
|
|
|
|
s32 GetBurstType() const { return x0_burstType; }
|
|
|
|
void Start(CStateManager& mgr);
|
|
|
|
void Update(CStateManager& mgr, float dt);
|
|
|
|
zeus::CVector3f GetError(float xMag, float zMag) const;
|
|
|
|
zeus::CVector3f GetDistanceCompensatedError(float dist, float maxErrDist) const;
|
|
|
|
float GetMaxXError() const;
|
|
|
|
float GetMaxZError() const;
|
|
|
|
void SetFirstBurstIndex(s32 idx) { xc_firstBurstIdx = idx; }
|
|
|
|
bool ShouldFire() const { return x14_24_shouldFire; }
|
|
|
|
bool IsBurstSet() const { return x18_curBursts != nullptr; }
|
2018-06-04 12:30:04 -07:00
|
|
|
};
|
2021-04-10 01:42:06 -07:00
|
|
|
} // namespace metaforce
|