mirror of https://github.com/AxioDL/metaforce.git
CIceBeam/CPhazonBeam: Make use of std::array where applicable
Same behavior, stronger typing.
This commit is contained in:
parent
b631b5f3a1
commit
a433a7852f
|
@ -1,5 +1,7 @@
|
|||
#include "Runtime/Weapon/CIceBeam.hpp"
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "Runtime/CSimplePool.hpp"
|
||||
#include "Runtime/GameGlobalObjects.hpp"
|
||||
|
||||
|
@ -59,12 +61,12 @@ void CIceBeam::UpdateGunFx(bool shotSmoke, float dt, const CStateManager& mgr, c
|
|||
CGunWeapon::UpdateGunFx(shotSmoke, dt, mgr, xf);
|
||||
}
|
||||
|
||||
static const u16 kSoundId[] = {SFXwpn_fire_ice_normal, SFXwpn_fire_ice_charged};
|
||||
|
||||
void CIceBeam::Fire(bool underwater, float dt, EChargeState chargeState, const zeus::CTransform& xf, CStateManager& mgr,
|
||||
TUniqueId homingTarget, float chargeFactor1, float chargeFactor2) {
|
||||
static constexpr std::array<u16, 2> soundId{SFXwpn_fire_ice_normal, SFXwpn_fire_ice_charged};
|
||||
|
||||
CGunWeapon::Fire(underwater, dt, chargeState, xf, mgr, homingTarget, chargeFactor1, chargeFactor2);
|
||||
NWeaponTypes::play_sfx(kSoundId[int(chargeState)], underwater, false, 0.165f);
|
||||
NWeaponTypes::play_sfx(soundId[size_t(chargeState)], underwater, false, 0.165f);
|
||||
}
|
||||
|
||||
void CIceBeam::EnableFx(bool enable) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "Runtime/Weapon/CPhazonBeam.hpp"
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "Runtime/CSimplePool.hpp"
|
||||
#include "Runtime/GameGlobalObjects.hpp"
|
||||
#include "Runtime/Graphics/CBooRenderer.hpp"
|
||||
|
@ -77,8 +79,6 @@ void CPhazonBeam::UpdateGunFx(bool shotSmoke, float dt, const CStateManager& mgr
|
|||
CGunWeapon::UpdateGunFx(shotSmoke, dt, mgr, xf);
|
||||
}
|
||||
|
||||
static const u16 kSoundId[] = {SFXwpn_fire_phazon_normal, SFXwpn_fire_power_charged};
|
||||
|
||||
void CPhazonBeam::Fire(bool underwater, float dt, EChargeState chargeState, const zeus::CTransform& xf,
|
||||
CStateManager& mgr, TUniqueId homingTarget, float chargeFactor1, float chargeFactor2) {
|
||||
if (chargeState == EChargeState::Normal) {
|
||||
|
@ -95,7 +95,8 @@ void CPhazonBeam::Fire(bool underwater, float dt, EChargeState chargeState, cons
|
|||
CGunWeapon::Fire(underwater, dt, chargeState, xf, mgr, homingTarget, chargeFactor1, chargeFactor2);
|
||||
}
|
||||
|
||||
NWeaponTypes::play_sfx(kSoundId[int(chargeState)], underwater, false, 0.165f);
|
||||
static constexpr std::array<u16, 2> soundId{SFXwpn_fire_phazon_normal, SFXwpn_fire_power_charged};
|
||||
NWeaponTypes::play_sfx(soundId[size_t(chargeState)], underwater, false, 0.165f);
|
||||
}
|
||||
|
||||
void CPhazonBeam::Update(float dt, CStateManager& mgr) {
|
||||
|
|
Loading…
Reference in New Issue