mirror of https://github.com/AxioDL/metaforce.git
CDamageVulnerability: Make constructors constexpr
Eliminates any potential runtime initializers related to file-scope constant instances of this class.
This commit is contained in:
parent
0ad1f8ba42
commit
07ebdd364c
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace urde {
|
||||
|
||||
const CDamageVulnerability CDamageVulnerability::sNormalVulnerability(
|
||||
constexpr CDamageVulnerability CDamageVulnerability::sNormalVulnerability(
|
||||
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal,
|
||||
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal,
|
||||
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal,
|
||||
|
@ -10,7 +10,7 @@ const CDamageVulnerability CDamageVulnerability::sNormalVulnerability(
|
|||
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal,
|
||||
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EDeflectType::None);
|
||||
|
||||
const CDamageVulnerability CDamageVulnerability::sImmuneVulnerability(
|
||||
constexpr CDamageVulnerability CDamageVulnerability::sImmuneVulnerability(
|
||||
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
|
||||
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
|
||||
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
|
||||
|
@ -18,7 +18,7 @@ const CDamageVulnerability CDamageVulnerability::sImmuneVulnerability(
|
|||
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
|
||||
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EDeflectType::None);
|
||||
|
||||
const CDamageVulnerability CDamageVulnerability::sReflectVulnerability(
|
||||
constexpr CDamageVulnerability CDamageVulnerability::sReflectVulnerability(
|
||||
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
|
||||
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
|
||||
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
|
||||
|
@ -26,7 +26,7 @@ const CDamageVulnerability CDamageVulnerability::sReflectVulnerability(
|
|||
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
|
||||
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EDeflectType::One);
|
||||
|
||||
const CDamageVulnerability CDamageVulnerability::sPassThroughVulnerability(
|
||||
constexpr CDamageVulnerability CDamageVulnerability::sPassThroughVulnerability(
|
||||
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
|
||||
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
|
||||
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
|
||||
|
@ -95,69 +95,6 @@ CDamageVulnerability::CDamageVulnerability(CInputStream& in) {
|
|||
ConstructNew(in, propCount);
|
||||
}
|
||||
|
||||
CDamageVulnerability::CDamageVulnerability(EVulnerability power, EVulnerability ice, EVulnerability wave,
|
||||
EVulnerability plasma, EVulnerability bomb, EVulnerability powerBomb,
|
||||
EVulnerability missile, EVulnerability boostBall, EVulnerability phazon,
|
||||
EVulnerability enemyWp1, EVulnerability enemyWp2, EVulnerability enemyWp3,
|
||||
EVulnerability enemyWp4, EVulnerability v1, EVulnerability v2,
|
||||
EDeflectType deflectType)
|
||||
: x0_power(power)
|
||||
, x4_ice(ice)
|
||||
, x8_wave(wave)
|
||||
, xc_plasma(plasma)
|
||||
, x10_bomb(bomb)
|
||||
, x14_powerbomb(powerBomb)
|
||||
, x18_missile(missile)
|
||||
, x1c_boostBall(boostBall)
|
||||
, x20_phazon(phazon)
|
||||
, x24_enemyWp1(enemyWp1)
|
||||
, x28_enemyWp2Poison(enemyWp2)
|
||||
, x2c_enemyWp3Lava(enemyWp3)
|
||||
, x30_enemyWp4(enemyWp4)
|
||||
, x34_unk1(v1)
|
||||
, x38_unk2(v2)
|
||||
, x3c_chargedPower(x0_power)
|
||||
, x40_chargedIce(x4_ice)
|
||||
, x44_chargedWave(x8_wave)
|
||||
, x48_chargedPlasma(xc_plasma)
|
||||
, x4c_superMissile(x0_power)
|
||||
, x50_iceSpreader(x4_ice)
|
||||
, x54_wavebuster(x8_wave)
|
||||
, x58_flamethrower(xc_plasma)
|
||||
, x5c_deflected(deflectType) {}
|
||||
|
||||
CDamageVulnerability::CDamageVulnerability(
|
||||
EVulnerability power, EVulnerability ice, EVulnerability wave, EVulnerability plasma, EVulnerability bomb,
|
||||
EVulnerability powerBomb, EVulnerability missile, EVulnerability boostBall, EVulnerability phazon,
|
||||
EVulnerability enemyWp1, EVulnerability enemyWp2, EVulnerability enemyWp3, EVulnerability enemyWp4,
|
||||
EVulnerability v1, EVulnerability v2, EVulnerability chargedPower, EVulnerability chargedIce,
|
||||
EVulnerability chargedWave, EVulnerability chargedPlasma, EVulnerability superMissile, EVulnerability iceSpreader,
|
||||
EVulnerability waveBuster, EVulnerability flameThrower, EDeflectType deflected)
|
||||
: x0_power(power)
|
||||
, x4_ice(ice)
|
||||
, x8_wave(wave)
|
||||
, xc_plasma(plasma)
|
||||
, x10_bomb(bomb)
|
||||
, x14_powerbomb(powerBomb)
|
||||
, x18_missile(missile)
|
||||
, x1c_boostBall(boostBall)
|
||||
, x20_phazon(phazon)
|
||||
, x24_enemyWp1(enemyWp1)
|
||||
, x28_enemyWp2Poison(enemyWp2)
|
||||
, x2c_enemyWp3Lava(enemyWp3)
|
||||
, x30_enemyWp4(enemyWp4)
|
||||
, x34_unk1(v1)
|
||||
, x38_unk2(v2)
|
||||
, x3c_chargedPower(chargedPower)
|
||||
, x40_chargedIce(chargedIce)
|
||||
, x44_chargedWave(chargedWave)
|
||||
, x48_chargedPlasma(chargedPlasma)
|
||||
, x4c_superMissile(superMissile)
|
||||
, x50_iceSpreader(iceSpreader)
|
||||
, x54_wavebuster(waveBuster)
|
||||
, x58_flamethrower(flameThrower)
|
||||
, x5c_deflected(deflected) {}
|
||||
|
||||
EDeflectType CDamageVulnerability::GetDeflectionType(const CWeaponMode& mode) const {
|
||||
if (mode.IsCharged())
|
||||
return x60_chargedDeflected;
|
||||
|
|
|
@ -36,8 +36,8 @@ class CDamageVulnerability {
|
|||
EVulnerability x58_flamethrower;
|
||||
|
||||
EDeflectType x5c_deflected;
|
||||
EDeflectType x60_chargedDeflected;
|
||||
EDeflectType x64_comboDeflected;
|
||||
EDeflectType x60_chargedDeflected{};
|
||||
EDeflectType x64_comboDeflected{};
|
||||
|
||||
void ConstructNew(CInputStream& in, int propCount);
|
||||
|
||||
|
@ -48,17 +48,69 @@ class CDamageVulnerability {
|
|||
|
||||
public:
|
||||
explicit CDamageVulnerability(CInputStream& in);
|
||||
CDamageVulnerability(EVulnerability power, EVulnerability ice, EVulnerability wave, EVulnerability plasma,
|
||||
EVulnerability bomb, EVulnerability powerBomb, EVulnerability missile, EVulnerability boostBall,
|
||||
EVulnerability phazon, EVulnerability enemyWp1, EVulnerability enemyWp2, EVulnerability enemyWp3,
|
||||
EVulnerability enemyWp4, EVulnerability v1, EVulnerability v2, EDeflectType deflectType);
|
||||
CDamageVulnerability(EVulnerability power, EVulnerability ice, EVulnerability wave, EVulnerability plasma,
|
||||
EVulnerability bomb, EVulnerability powerBomb, EVulnerability missile, EVulnerability boostBall,
|
||||
EVulnerability phazon, EVulnerability enemyWp1, EVulnerability enemyWp2, EVulnerability enemyWp3,
|
||||
EVulnerability enemyWp4, EVulnerability v1, EVulnerability v2, EVulnerability chargedPower,
|
||||
EVulnerability chargedIce, EVulnerability chargedWave, EVulnerability chargedPlasma,
|
||||
EVulnerability superMissile, EVulnerability iceSpreader, EVulnerability waveBuster,
|
||||
EVulnerability flameThrower, EDeflectType deflected);
|
||||
|
||||
constexpr CDamageVulnerability(EVulnerability power, EVulnerability ice, EVulnerability wave, EVulnerability plasma,
|
||||
EVulnerability bomb, EVulnerability powerBomb, EVulnerability missile,
|
||||
EVulnerability boostBall, EVulnerability phazon, EVulnerability enemyWp1,
|
||||
EVulnerability enemyWp2, EVulnerability enemyWp3, EVulnerability enemyWp4,
|
||||
EVulnerability v1, EVulnerability v2, EDeflectType deflectType)
|
||||
: x0_power(power)
|
||||
, x4_ice(ice)
|
||||
, x8_wave(wave)
|
||||
, xc_plasma(plasma)
|
||||
, x10_bomb(bomb)
|
||||
, x14_powerbomb(powerBomb)
|
||||
, x18_missile(missile)
|
||||
, x1c_boostBall(boostBall)
|
||||
, x20_phazon(phazon)
|
||||
, x24_enemyWp1(enemyWp1)
|
||||
, x28_enemyWp2Poison(enemyWp2)
|
||||
, x2c_enemyWp3Lava(enemyWp3)
|
||||
, x30_enemyWp4(enemyWp4)
|
||||
, x34_unk1(v1)
|
||||
, x38_unk2(v2)
|
||||
, x3c_chargedPower(x0_power)
|
||||
, x40_chargedIce(x4_ice)
|
||||
, x44_chargedWave(x8_wave)
|
||||
, x48_chargedPlasma(xc_plasma)
|
||||
, x4c_superMissile(x0_power)
|
||||
, x50_iceSpreader(x4_ice)
|
||||
, x54_wavebuster(x8_wave)
|
||||
, x58_flamethrower(xc_plasma)
|
||||
, x5c_deflected(deflectType) {}
|
||||
|
||||
constexpr CDamageVulnerability(EVulnerability power, EVulnerability ice, EVulnerability wave, EVulnerability plasma,
|
||||
EVulnerability bomb, EVulnerability powerBomb, EVulnerability missile,
|
||||
EVulnerability boostBall, EVulnerability phazon, EVulnerability enemyWp1,
|
||||
EVulnerability enemyWp2, EVulnerability enemyWp3, EVulnerability enemyWp4,
|
||||
EVulnerability v1, EVulnerability v2, EVulnerability chargedPower,
|
||||
EVulnerability chargedIce, EVulnerability chargedWave, EVulnerability chargedPlasma,
|
||||
EVulnerability superMissile, EVulnerability iceSpreader, EVulnerability waveBuster,
|
||||
EVulnerability flameThrower, EDeflectType deflected)
|
||||
: x0_power(power)
|
||||
, x4_ice(ice)
|
||||
, x8_wave(wave)
|
||||
, xc_plasma(plasma)
|
||||
, x10_bomb(bomb)
|
||||
, x14_powerbomb(powerBomb)
|
||||
, x18_missile(missile)
|
||||
, x1c_boostBall(boostBall)
|
||||
, x20_phazon(phazon)
|
||||
, x24_enemyWp1(enemyWp1)
|
||||
, x28_enemyWp2Poison(enemyWp2)
|
||||
, x2c_enemyWp3Lava(enemyWp3)
|
||||
, x30_enemyWp4(enemyWp4)
|
||||
, x34_unk1(v1)
|
||||
, x38_unk2(v2)
|
||||
, x3c_chargedPower(chargedPower)
|
||||
, x40_chargedIce(chargedIce)
|
||||
, x44_chargedWave(chargedWave)
|
||||
, x48_chargedPlasma(chargedPlasma)
|
||||
, x4c_superMissile(superMissile)
|
||||
, x50_iceSpreader(iceSpreader)
|
||||
, x54_wavebuster(waveBuster)
|
||||
, x58_flamethrower(flameThrower)
|
||||
, x5c_deflected(deflected) {}
|
||||
|
||||
EDeflectType GetDeflectionType(const CWeaponMode& mode) const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue