metaforce/DataSpec/DNACommon/Tweaks/ITweakGunRes.hpp

143 lines
4.7 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
#include <array>
2017-01-21 06:03:37 +00:00
#include "ITweak.hpp"
2016-09-18 23:47:48 +00:00
#include "Runtime/IFactory.hpp"
2017-09-05 03:00:19 +00:00
#include "Runtime/CPlayerState.hpp"
2018-12-08 05:30:43 +00:00
namespace DataSpec {
struct ITweakGunRes : ITweak {
2021-04-10 08:42:06 +00:00
using ResId = metaforce::CAssetId;
using EBeamId = metaforce::CPlayerState::EBeamId;
2018-12-08 05:30:43 +00:00
ResId x4_gunMotion;
ResId x8_grappleArm;
ResId xc_rightHand;
ResId x10_powerBeam;
ResId x14_iceBeam;
ResId x18_waveBeam;
ResId x1c_plasmaBeam;
ResId x20_phazonBeam;
ResId x24_holoTransition;
ResId x28_bombSet;
ResId x2c_bombExplode;
ResId x30_powerBombExplode;
/* Power, Ice, Wave, Plasma, Phazon / Beam, Ball */
using WeaponPair = std::array<ResId, 2>;
std::array<WeaponPair, 5> x34_weapons;
std::array<ResId, 5> x84_muzzle;
std::array<ResId, 5> x94_charge;
std::array<ResId, 5> xa4_auxMuzzle;
2018-12-08 05:30:43 +00:00
ResId xb4_grappleSegment;
ResId xb8_grappleClaw;
ResId xbc_grappleHit;
ResId xc0_grappleMuzzle;
ResId xc4_grappleSwoosh;
ResId GetBeamModel(EBeamId beam) const {
auto b = int(beam);
if (b < 0 || b > 4)
b = 0;
switch (EBeamId(b)) {
default:
case EBeamId::Power:
return x10_powerBeam;
case EBeamId::Ice:
return x14_iceBeam;
case EBeamId::Wave:
return x18_waveBeam;
case EBeamId::Plasma:
return x1c_plasmaBeam;
case EBeamId::Phazon:
return x20_phazonBeam;
2016-09-18 23:47:48 +00:00
}
2018-12-08 05:30:43 +00:00
}
2016-09-18 23:47:48 +00:00
const WeaponPair& GetWeaponPair(EBeamId beam) const {
const auto b = int(beam);
if (b < 0 || b > 4) {
2018-12-08 05:30:43 +00:00
return x34_weapons[0];
}
2018-12-08 05:30:43 +00:00
return x34_weapons[b];
}
2017-07-23 23:45:04 +00:00
2021-04-10 08:42:06 +00:00
void ResolveResources(const metaforce::IFactory& factory) {
x4_gunMotion = factory.GetResourceIdByName(GetGunMotion())->id;
x8_grappleArm = factory.GetResourceIdByName(GetGrappleArm())->id;
xc_rightHand = factory.GetResourceIdByName(GetRightHand())->id;
2016-09-18 23:47:48 +00:00
x10_powerBeam = factory.GetResourceIdByName(GetPowerBeam())->id;
x14_iceBeam = factory.GetResourceIdByName(GetIceBeam())->id;
x18_waveBeam = factory.GetResourceIdByName(GetWaveBeam())->id;
x1c_plasmaBeam = factory.GetResourceIdByName(GetPlasmaBeam())->id;
x20_phazonBeam = factory.GetResourceIdByName(GetPhazonBeam())->id;
2016-09-18 23:47:48 +00:00
x24_holoTransition = factory.GetResourceIdByName(GetHoloTransition())->id;
2016-09-18 23:47:48 +00:00
x28_bombSet = factory.GetResourceIdByName(GetBombSet())->id;
x2c_bombExplode = factory.GetResourceIdByName(GetBombExplode())->id;
x30_powerBombExplode = factory.GetResourceIdByName(GetPowerBombExplode())->id;
2016-09-18 23:47:48 +00:00
for (size_t i = 0; i < x34_weapons.size(); ++i) {
for (size_t j = 0; j < x34_weapons[i].size(); ++j) {
x34_weapons[i][j] = factory.GetResourceIdByName(GetWeapon(i, j != 0))->id;
}
}
2016-09-18 23:47:48 +00:00
for (size_t i = 0; i < x84_muzzle.size(); ++i) {
x84_muzzle[i] = factory.GetResourceIdByName(GetMuzzleParticle(i))->id;
}
2016-09-18 23:47:48 +00:00
for (size_t i = 0; i < x94_charge.size(); ++i) {
x94_charge[i] = factory.GetResourceIdByName(GetChargeParticle(i))->id;
}
2016-09-18 23:47:48 +00:00
for (size_t i = 0; i < xa4_auxMuzzle.size(); ++i) {
xa4_auxMuzzle[i] = factory.GetResourceIdByName(GetAuxMuzzleParticle(i))->id;
}
2016-09-18 23:47:48 +00:00
xb4_grappleSegment = factory.GetResourceIdByName(GetGrappleSegmentParticle())->id;
xb8_grappleClaw = factory.GetResourceIdByName(GetGrappleClawParticle())->id;
xbc_grappleHit = factory.GetResourceIdByName(GetGrappleHitParticle())->id;
xc0_grappleMuzzle = factory.GetResourceIdByName(GetGrappleMuzzleParticle())->id;
xc4_grappleSwoosh = factory.GetResourceIdByName(GetGrappleSwooshParticle())->id;
2018-12-08 05:30:43 +00:00
}
2016-09-18 23:47:48 +00:00
protected:
2018-12-08 05:30:43 +00:00
virtual const std::string& GetGunMotion() const = 0;
virtual const std::string& GetGrappleArm() const = 0;
virtual const std::string& GetRightHand() const = 0;
virtual const std::string& GetPowerBeam() const = 0;
virtual const std::string& GetIceBeam() const = 0;
virtual const std::string& GetWaveBeam() const = 0;
virtual const std::string& GetPlasmaBeam() const = 0;
virtual const std::string& GetPhazonBeam() const = 0;
virtual const std::string& GetHoloTransition() const = 0;
virtual const std::string& GetBombSet() const = 0;
virtual const std::string& GetBombExplode() const = 0;
virtual const std::string& GetPowerBombExplode() const = 0;
virtual const std::string& GetWeapon(size_t idx, bool ball) const = 0;
virtual const std::string& GetMuzzleParticle(size_t idx) const = 0;
virtual const std::string& GetChargeParticle(size_t idx) const = 0;
virtual const std::string& GetAuxMuzzleParticle(size_t idx) const = 0;
virtual const std::string& GetGrappleSegmentParticle() const = 0;
virtual const std::string& GetGrappleClawParticle() const = 0;
virtual const std::string& GetGrappleHitParticle() const = 0;
virtual const std::string& GetGrappleMuzzleParticle() const = 0;
virtual const std::string& GetGrappleSwooshParticle() const = 0;
};
2018-12-08 05:30:43 +00:00
} // namespace DataSpec