CNewFlameThrower: Make constructor take a std::array by reference

Same behavior, but enforces the size requirement instead of accepting
any arbitrary const CAssetId* pointer.
This commit is contained in:
Lioncash 2020-04-11 19:36:52 -04:00
parent fa0dcf5b12
commit 54dededb9b
3 changed files with 19 additions and 16 deletions

View File

@ -210,19 +210,21 @@ void CAuxWeapon::CreateFlameThrower(const zeus::CTransform& xf, CStateManager& m
if (x6e_flameThrowerId != kInvalidUniqueId) if (x6e_flameThrowerId != kInvalidUniqueId)
return; return;
CAssetId resInfo[] = {NWeaponTypes::get_asset_id_from_name("NFTMainFire"), const std::array<CAssetId, 8> resInfo{
NWeaponTypes::get_asset_id_from_name("NFTMainFire"),
NWeaponTypes::get_asset_id_from_name("NFTMainSmoke"), NWeaponTypes::get_asset_id_from_name("NFTMainSmoke"),
NWeaponTypes::get_asset_id_from_name("NFTSwooshCenter"), NWeaponTypes::get_asset_id_from_name("NFTSwooshCenter"),
NWeaponTypes::get_asset_id_from_name("NFTSwooshFire"), NWeaponTypes::get_asset_id_from_name("NFTSwooshFire"),
NWeaponTypes::get_asset_id_from_name("NFTSecondarySmoke"), NWeaponTypes::get_asset_id_from_name("NFTSecondarySmoke"),
NWeaponTypes::get_asset_id_from_name("NFTSecondaryFire"), NWeaponTypes::get_asset_id_from_name("NFTSecondaryFire"),
NWeaponTypes::get_asset_id_from_name("NFTSecondarySparks"), NWeaponTypes::get_asset_id_from_name("NFTSecondarySparks"),
{}}; {},
};
x6e_flameThrowerId = mgr.AllocateUniqueId(); x6e_flameThrowerId = mgr.AllocateUniqueId();
CNewFlameThrower* ft = new CNewFlameThrower( auto* ft = new CNewFlameThrower(x28_combos[3], "Player_FlameThrower", EWeaponType::Plasma, resInfo, xf,
x28_combos[3], "Player_FlameThrower", EWeaponType::Plasma, resInfo, xf, EMaterialTypes::Player, EMaterialTypes::Player,
CGunWeapon::GetShotDamageInfo(g_tweakPlayerGun->GetComboShotInfo(3), mgr), x6e_flameThrowerId, kInvalidAreaId, CGunWeapon::GetShotDamageInfo(g_tweakPlayerGun->GetComboShotInfo(3), mgr),
x6c_playerId, EProjectileAttrib::None); x6e_flameThrowerId, kInvalidAreaId, x6c_playerId, EProjectileAttrib::None);
mgr.AddObject(ft); mgr.AddObject(ft);
ft->Think(dt, mgr); ft->Think(dt, mgr);
ft->StartFiring(xf, mgr); ft->StartFiring(xf, mgr);

View File

@ -8,9 +8,9 @@
namespace urde { namespace urde {
CNewFlameThrower::CNewFlameThrower(const TToken<CWeaponDescription>& desc, std::string_view name, EWeaponType wType, CNewFlameThrower::CNewFlameThrower(const TToken<CWeaponDescription>& desc, std::string_view name, EWeaponType wType,
const CAssetId resInfo[8], const zeus::CTransform& xf, EMaterialTypes matType, const std::array<CAssetId, 8>& resInfo, const zeus::CTransform& xf,
const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid, TUniqueId owner, EMaterialTypes matType, const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid,
EProjectileAttrib attribs) TUniqueId owner, EProjectileAttrib attribs)
: CGameProjectile(false, desc, name, wType, xf, matType, dInfo, uid, aid, owner, kInvalidUniqueId, attribs, false, : CGameProjectile(false, desc, name, wType, xf, matType, dInfo, uid, aid, owner, kInvalidUniqueId, attribs, false,
zeus::skOne3f, {}, -1, false) zeus::skOne3f, {}, -1, false)
, x304_mainFire(g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), resInfo[0]})) , x304_mainFire(g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), resInfo[0]}))

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <array>
#include <memory> #include <memory>
#include <utility> #include <utility>
#include <vector> #include <vector>
@ -53,7 +54,7 @@ public:
// NFTSecondarySparks // NFTSecondarySparks
// <invalid> // <invalid>
CNewFlameThrower(const TToken<CWeaponDescription>& desc, std::string_view name, EWeaponType wType, CNewFlameThrower(const TToken<CWeaponDescription>& desc, std::string_view name, EWeaponType wType,
const CAssetId resInfo[8], const zeus::CTransform& xf, EMaterialTypes matType, const std::array<CAssetId, 8>& resInfo, const zeus::CTransform& xf, EMaterialTypes matType,
const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid, TUniqueId owner, EProjectileAttrib attribs); const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid, TUniqueId owner, EProjectileAttrib attribs);
void StartFiring(const zeus::CTransform& xf, CStateManager& mgr); void StartFiring(const zeus::CTransform& xf, CStateManager& mgr);
bool CanRenderAuxEffects() const { return x37c_24_renderAuxEffects; } bool CanRenderAuxEffects() const { return x37c_24_renderAuxEffects; }