metaforce/Runtime/World/CDamageVulnerability.hpp

117 lines
2.9 KiB
C++

#ifndef __URDE_CDAMAGEVULNERABILITY_HPP__
#define __URDE_CDAMAGEVULNERABILITY_HPP__
#include "RetroTypes.hpp"
#include "Weapon/CWeaponMode.hpp"
namespace urde
{
enum class EVulnerability
{
DoubleDamage,
Normal,
Reflect,
Immune,
PassThrough,
DirectDouble,
Direct
};
class CDamageVulnerability
{
EVulnerability x0_power;
EVulnerability x4_ice;
EVulnerability x8_wave;
EVulnerability xc_plasma;
EVulnerability x10_bomb;
EVulnerability x14_powerbomb;
EVulnerability x18_missile;
EVulnerability x1c_boostBall;
EVulnerability x20_phazon;
EVulnerability x24_enemyWp1;
EVulnerability x28_enemyWp2Poison;
EVulnerability x2c_enemyWp3Lava;
EVulnerability x30_enemyWp4;
EVulnerability x34_unk1;
EVulnerability x38_unk2;
EVulnerability x3c_chargedPower;
EVulnerability x40_chargedIce;
EVulnerability x44_chargedWave;
EVulnerability x48_chargedPlasma;
EVulnerability x4c_superMissile;
EVulnerability x50_iceSpreader;
EVulnerability x54_wavebuster;
EVulnerability x58_flamethrower;
u32 x5c_;
u32 x60_;
u32 x64_;
void ConstructNew(CInputStream& in, int propCount)
{
EVulnerability* vulns = &x0_power;
for (int i=0 ; i<std::min(propCount - 3, 15) ; ++i)
vulns[i] = EVulnerability(in.readUint32Big());
if (propCount < 15)
{
for (int i=propCount ; i<15 ; ++i)
vulns[i] = EVulnerability::Reflect;
}
for (int i=15 ; i<propCount ; ++i)
in.readUint32Big();
x5c_ = in.readUint32Big();
EVulnerability* vulns2 = &x3c_chargedPower;
in.readUint32Big();
for (int i=0 ; i<4 ; ++i)
vulns2[i] = EVulnerability(in.readUint32Big());
x60_ = in.readUint32Big();
EVulnerability* vulns3 = &x4c_superMissile;
in.readUint32Big();
for (int i=0 ; i<4 ; ++i)
vulns3[i] = EVulnerability(in.readUint32Big());
x64_ = in.readUint32Big();
}
public:
CDamageVulnerability(CInputStream& in)
{
u32 propCount = in.readUint32Big();;
if (propCount == 11)
{
EVulnerability* vulns = &x0_power;
for (int i=0 ; i<15 ; ++i)
vulns[i] = EVulnerability(in.readUint32Big());
if (propCount == 15)
x5c_ = 0;
else
x5c_ = in.readUint32Big();
x3c_chargedPower = x0_power;
x4c_superMissile = x0_power;
x40_chargedIce = x4_ice;
x50_iceSpreader = x4_ice;
x44_chargedWave = x8_wave;
x54_wavebuster = x8_wave;
x48_chargedPlasma = xc_plasma;
x58_flamethrower = xc_plasma;
}
else
ConstructNew(in, propCount);
}
bool WeaponHurts(const CWeaponMode&, u32) const { return false; }
};
}
#endif // __URDE_CDAMAGEVULNERABILITY_HPP__