|
|
|
|
@@ -1,10 +1,11 @@
|
|
|
|
|
#include "AssetDumperWeapon.h"
|
|
|
|
|
#include "WeaponDumperIW5.h"
|
|
|
|
|
|
|
|
|
|
#include "Game/IW5/CommonIW5.h"
|
|
|
|
|
#include "Game/IW5/InfoString/InfoStringFromStructConverter.h"
|
|
|
|
|
#include "Game/IW5/ObjConstantsIW5.h"
|
|
|
|
|
#include "Game/IW5/Weapon/WeaponFields.h"
|
|
|
|
|
#include "Weapon/AccuracyGraphWriter.h"
|
|
|
|
|
#include "Weapon/WeaponCommon.h"
|
|
|
|
|
|
|
|
|
|
#include <bit>
|
|
|
|
|
#include <cassert>
|
|
|
|
|
@@ -14,8 +15,9 @@
|
|
|
|
|
#include <unordered_set>
|
|
|
|
|
|
|
|
|
|
using namespace IW5;
|
|
|
|
|
using namespace ::weapon;
|
|
|
|
|
|
|
|
|
|
namespace IW5
|
|
|
|
|
namespace
|
|
|
|
|
{
|
|
|
|
|
class InfoStringFromWeaponConverter final : public InfoStringFromStructConverter
|
|
|
|
|
{
|
|
|
|
|
@@ -551,211 +553,217 @@ namespace IW5
|
|
|
|
|
|
|
|
|
|
return graph;
|
|
|
|
|
}
|
|
|
|
|
} // namespace IW5
|
|
|
|
|
|
|
|
|
|
void AssetDumperWeapon::CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFullDef* fullDef)
|
|
|
|
|
{
|
|
|
|
|
fullDef->weapCompleteDef = *weapon;
|
|
|
|
|
|
|
|
|
|
if (weapon->weapDef)
|
|
|
|
|
void CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFullDef* fullDef)
|
|
|
|
|
{
|
|
|
|
|
fullDef->weapDef = *weapon->weapDef;
|
|
|
|
|
fullDef->weapCompleteDef.weapDef = &fullDef->weapDef;
|
|
|
|
|
fullDef->weapCompleteDef = *weapon;
|
|
|
|
|
|
|
|
|
|
if (weapon->weapDef)
|
|
|
|
|
{
|
|
|
|
|
fullDef->weapDef = *weapon->weapDef;
|
|
|
|
|
fullDef->weapCompleteDef.weapDef = &fullDef->weapDef;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (weapon->hideTags)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->hideTags, weapon->hideTags, sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::hideTags)>);
|
|
|
|
|
fullDef->weapCompleteDef.hideTags = fullDef->hideTags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (weapon->szXAnims)
|
|
|
|
|
{
|
|
|
|
|
static_assert(std::extent_v<decltype(WeaponFullDef::szXAnims)> == WEAP_ANIM_COUNT);
|
|
|
|
|
memcpy(fullDef->szXAnims, weapon->szXAnims, sizeof(void*) * WEAP_ANIM_COUNT);
|
|
|
|
|
fullDef->weapCompleteDef.szXAnims = fullDef->szXAnims;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.gunXModel)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->gunXModel, fullDef->weapDef.gunXModel, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::gunXModel)>);
|
|
|
|
|
fullDef->weapDef.gunXModel = fullDef->gunXModel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.szXAnimsRightHanded)
|
|
|
|
|
{
|
|
|
|
|
static_assert(std::extent_v<decltype(WeaponFullDef::szXAnimsRightHanded)> == WEAP_ANIM_COUNT);
|
|
|
|
|
memcpy(fullDef->szXAnimsRightHanded, fullDef->weapDef.szXAnimsRightHanded, sizeof(void*) * WEAP_ANIM_COUNT);
|
|
|
|
|
fullDef->weapDef.szXAnimsRightHanded = fullDef->szXAnimsRightHanded;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.szXAnimsLeftHanded)
|
|
|
|
|
{
|
|
|
|
|
static_assert(std::extent_v<decltype(WeaponFullDef::szXAnimsLeftHanded)> == WEAP_ANIM_COUNT);
|
|
|
|
|
memcpy(fullDef->szXAnimsLeftHanded, fullDef->weapDef.szXAnimsLeftHanded, sizeof(void*) * WEAP_ANIM_COUNT);
|
|
|
|
|
fullDef->weapDef.szXAnimsLeftHanded = fullDef->szXAnimsLeftHanded;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.notetrackSoundMapKeys)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->notetrackSoundMapKeys,
|
|
|
|
|
fullDef->weapDef.notetrackSoundMapKeys,
|
|
|
|
|
sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>);
|
|
|
|
|
fullDef->weapDef.notetrackSoundMapKeys = fullDef->notetrackSoundMapKeys;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.notetrackSoundMapValues)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->notetrackSoundMapValues,
|
|
|
|
|
fullDef->weapDef.notetrackSoundMapValues,
|
|
|
|
|
sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackSoundMapValues)>);
|
|
|
|
|
fullDef->weapDef.notetrackSoundMapValues = fullDef->notetrackSoundMapValues;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.notetrackRumbleMapKeys)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->notetrackRumbleMapKeys,
|
|
|
|
|
fullDef->weapDef.notetrackRumbleMapKeys,
|
|
|
|
|
sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackRumbleMapKeys)>);
|
|
|
|
|
fullDef->weapDef.notetrackRumbleMapKeys = fullDef->notetrackRumbleMapKeys;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.notetrackRumbleMapValues)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->notetrackRumbleMapValues,
|
|
|
|
|
fullDef->weapDef.notetrackRumbleMapValues,
|
|
|
|
|
sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackRumbleMapValues)>);
|
|
|
|
|
fullDef->weapDef.notetrackRumbleMapValues = fullDef->notetrackRumbleMapValues;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.worldModel)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->worldModel, fullDef->weapDef.worldModel, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::worldModel)>);
|
|
|
|
|
fullDef->weapDef.worldModel = fullDef->worldModel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.parallelBounce)
|
|
|
|
|
{
|
|
|
|
|
static_assert(std::extent_v<decltype(WeaponFullDef::parallelBounce)> == SURF_TYPE_COUNT);
|
|
|
|
|
assert(sizeof(WeaponFullDef::parallelBounce) >= sizeof(float) * std::extent_v<decltype(WeaponFullDef::parallelBounce)>);
|
|
|
|
|
memcpy(fullDef->parallelBounce, fullDef->weapDef.parallelBounce, sizeof(float) * std::extent_v<decltype(WeaponFullDef::parallelBounce)>);
|
|
|
|
|
fullDef->weapDef.parallelBounce = fullDef->parallelBounce;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.perpendicularBounce)
|
|
|
|
|
{
|
|
|
|
|
static_assert(std::extent_v<decltype(WeaponFullDef::perpendicularBounce)> == SURF_TYPE_COUNT);
|
|
|
|
|
assert(sizeof(WeaponFullDef::perpendicularBounce) >= sizeof(float) * std::extent_v<decltype(WeaponFullDef::perpendicularBounce)>);
|
|
|
|
|
memcpy(fullDef->perpendicularBounce,
|
|
|
|
|
fullDef->weapDef.perpendicularBounce,
|
|
|
|
|
sizeof(float) * std::extent_v<decltype(WeaponFullDef::perpendicularBounce)>);
|
|
|
|
|
fullDef->weapDef.perpendicularBounce = fullDef->perpendicularBounce;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.locationDamageMultipliers)
|
|
|
|
|
{
|
|
|
|
|
static_assert(std::extent_v<decltype(WeaponFullDef::locationDamageMultipliers)> == HITLOC_COUNT);
|
|
|
|
|
assert(sizeof(WeaponFullDef::locationDamageMultipliers) >= sizeof(float) * std::extent_v<decltype(WeaponFullDef::locationDamageMultipliers)>);
|
|
|
|
|
memcpy(fullDef->locationDamageMultipliers,
|
|
|
|
|
fullDef->weapDef.locationDamageMultipliers,
|
|
|
|
|
sizeof(float) * std::extent_v<decltype(WeaponFullDef::locationDamageMultipliers)>);
|
|
|
|
|
fullDef->weapDef.locationDamageMultipliers = fullDef->locationDamageMultipliers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapCompleteDef.scopes)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->scopes, fullDef->weapCompleteDef.scopes, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::scopes)>);
|
|
|
|
|
fullDef->weapCompleteDef.scopes = fullDef->scopes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapCompleteDef.underBarrels)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->underBarrels, fullDef->weapCompleteDef.underBarrels, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::underBarrels)>);
|
|
|
|
|
fullDef->weapCompleteDef.underBarrels = fullDef->underBarrels;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapCompleteDef.others)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->others, fullDef->weapCompleteDef.others, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::others)>);
|
|
|
|
|
fullDef->weapCompleteDef.others = fullDef->others;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (weapon->hideTags)
|
|
|
|
|
InfoString CreateInfoString(XAssetInfo<WeaponCompleteDef>* asset)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->hideTags, weapon->hideTags, sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::hideTags)>);
|
|
|
|
|
fullDef->weapCompleteDef.hideTags = fullDef->hideTags;
|
|
|
|
|
const auto fullDef = std::make_unique<WeaponFullDef>();
|
|
|
|
|
memset(fullDef.get(), 0, sizeof(WeaponFullDef));
|
|
|
|
|
CopyToFullDef(asset->Asset(), fullDef.get());
|
|
|
|
|
|
|
|
|
|
InfoStringFromWeaponConverter converter(fullDef.get(),
|
|
|
|
|
weapon_fields,
|
|
|
|
|
std::extent_v<decltype(weapon_fields)>,
|
|
|
|
|
[asset](const scr_string_t scrStr) -> std::string
|
|
|
|
|
{
|
|
|
|
|
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
|
|
|
|
if (scrStr >= asset->m_zone->m_script_strings.Count())
|
|
|
|
|
return "";
|
|
|
|
|
|
|
|
|
|
return asset->m_zone->m_script_strings[scrStr];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return converter.Convert();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (weapon->szXAnims)
|
|
|
|
|
void DumpAccuracyGraphs(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset)
|
|
|
|
|
{
|
|
|
|
|
static_assert(std::extent_v<decltype(WeaponFullDef::szXAnims)> == WEAP_ANIM_COUNT);
|
|
|
|
|
memcpy(fullDef->szXAnims, weapon->szXAnims, sizeof(void*) * WEAP_ANIM_COUNT);
|
|
|
|
|
fullDef->weapCompleteDef.szXAnims = fullDef->szXAnims;
|
|
|
|
|
}
|
|
|
|
|
auto* accuracyGraphWriter = context.GetZoneAssetDumperState<AccuracyGraphWriter>();
|
|
|
|
|
const auto weapon = asset->Asset();
|
|
|
|
|
const auto* weapDef = weapon->weapDef;
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.gunXModel)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->gunXModel, fullDef->weapDef.gunXModel, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::gunXModel)>);
|
|
|
|
|
fullDef->weapDef.gunXModel = fullDef->gunXModel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.szXAnimsRightHanded)
|
|
|
|
|
{
|
|
|
|
|
static_assert(std::extent_v<decltype(WeaponFullDef::szXAnimsRightHanded)> == WEAP_ANIM_COUNT);
|
|
|
|
|
memcpy(fullDef->szXAnimsRightHanded, fullDef->weapDef.szXAnimsRightHanded, sizeof(void*) * WEAP_ANIM_COUNT);
|
|
|
|
|
fullDef->weapDef.szXAnimsRightHanded = fullDef->szXAnimsRightHanded;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.szXAnimsLeftHanded)
|
|
|
|
|
{
|
|
|
|
|
static_assert(std::extent_v<decltype(WeaponFullDef::szXAnimsLeftHanded)> == WEAP_ANIM_COUNT);
|
|
|
|
|
memcpy(fullDef->szXAnimsLeftHanded, fullDef->weapDef.szXAnimsLeftHanded, sizeof(void*) * WEAP_ANIM_COUNT);
|
|
|
|
|
fullDef->weapDef.szXAnimsLeftHanded = fullDef->szXAnimsLeftHanded;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.notetrackSoundMapKeys)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->notetrackSoundMapKeys,
|
|
|
|
|
fullDef->weapDef.notetrackSoundMapKeys,
|
|
|
|
|
sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>);
|
|
|
|
|
fullDef->weapDef.notetrackSoundMapKeys = fullDef->notetrackSoundMapKeys;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.notetrackSoundMapValues)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->notetrackSoundMapValues,
|
|
|
|
|
fullDef->weapDef.notetrackSoundMapValues,
|
|
|
|
|
sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackSoundMapValues)>);
|
|
|
|
|
fullDef->weapDef.notetrackSoundMapValues = fullDef->notetrackSoundMapValues;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.notetrackRumbleMapKeys)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->notetrackRumbleMapKeys,
|
|
|
|
|
fullDef->weapDef.notetrackRumbleMapKeys,
|
|
|
|
|
sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackRumbleMapKeys)>);
|
|
|
|
|
fullDef->weapDef.notetrackRumbleMapKeys = fullDef->notetrackRumbleMapKeys;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.notetrackRumbleMapValues)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->notetrackRumbleMapValues,
|
|
|
|
|
fullDef->weapDef.notetrackRumbleMapValues,
|
|
|
|
|
sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackRumbleMapValues)>);
|
|
|
|
|
fullDef->weapDef.notetrackRumbleMapValues = fullDef->notetrackRumbleMapValues;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.worldModel)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->worldModel, fullDef->weapDef.worldModel, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::worldModel)>);
|
|
|
|
|
fullDef->weapDef.worldModel = fullDef->worldModel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.parallelBounce)
|
|
|
|
|
{
|
|
|
|
|
static_assert(std::extent_v<decltype(WeaponFullDef::parallelBounce)> == SURF_TYPE_COUNT);
|
|
|
|
|
assert(sizeof(WeaponFullDef::parallelBounce) >= sizeof(float) * std::extent_v<decltype(WeaponFullDef::parallelBounce)>);
|
|
|
|
|
memcpy(fullDef->parallelBounce, fullDef->weapDef.parallelBounce, sizeof(float) * std::extent_v<decltype(WeaponFullDef::parallelBounce)>);
|
|
|
|
|
fullDef->weapDef.parallelBounce = fullDef->parallelBounce;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.perpendicularBounce)
|
|
|
|
|
{
|
|
|
|
|
static_assert(std::extent_v<decltype(WeaponFullDef::perpendicularBounce)> == SURF_TYPE_COUNT);
|
|
|
|
|
assert(sizeof(WeaponFullDef::perpendicularBounce) >= sizeof(float) * std::extent_v<decltype(WeaponFullDef::perpendicularBounce)>);
|
|
|
|
|
memcpy(fullDef->perpendicularBounce, fullDef->weapDef.perpendicularBounce, sizeof(float) * std::extent_v<decltype(WeaponFullDef::perpendicularBounce)>);
|
|
|
|
|
fullDef->weapDef.perpendicularBounce = fullDef->perpendicularBounce;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapDef.locationDamageMultipliers)
|
|
|
|
|
{
|
|
|
|
|
static_assert(std::extent_v<decltype(WeaponFullDef::locationDamageMultipliers)> == HITLOC_COUNT);
|
|
|
|
|
assert(sizeof(WeaponFullDef::locationDamageMultipliers) >= sizeof(float) * std::extent_v<decltype(WeaponFullDef::locationDamageMultipliers)>);
|
|
|
|
|
memcpy(fullDef->locationDamageMultipliers,
|
|
|
|
|
fullDef->weapDef.locationDamageMultipliers,
|
|
|
|
|
sizeof(float) * std::extent_v<decltype(WeaponFullDef::locationDamageMultipliers)>);
|
|
|
|
|
fullDef->weapDef.locationDamageMultipliers = fullDef->locationDamageMultipliers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapCompleteDef.scopes)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->scopes, fullDef->weapCompleteDef.scopes, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::scopes)>);
|
|
|
|
|
fullDef->weapCompleteDef.scopes = fullDef->scopes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapCompleteDef.underBarrels)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->underBarrels, fullDef->weapCompleteDef.underBarrels, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::underBarrels)>);
|
|
|
|
|
fullDef->weapCompleteDef.underBarrels = fullDef->underBarrels;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullDef->weapCompleteDef.others)
|
|
|
|
|
{
|
|
|
|
|
memcpy(fullDef->others, fullDef->weapCompleteDef.others, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::others)>);
|
|
|
|
|
fullDef->weapCompleteDef.others = fullDef->others;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InfoString AssetDumperWeapon::CreateInfoString(XAssetInfo<WeaponCompleteDef>* asset)
|
|
|
|
|
{
|
|
|
|
|
const auto fullDef = std::make_unique<WeaponFullDef>();
|
|
|
|
|
memset(fullDef.get(), 0, sizeof(WeaponFullDef));
|
|
|
|
|
CopyToFullDef(asset->Asset(), fullDef.get());
|
|
|
|
|
|
|
|
|
|
InfoStringFromWeaponConverter converter(fullDef.get(),
|
|
|
|
|
weapon_fields,
|
|
|
|
|
std::extent_v<decltype(weapon_fields)>,
|
|
|
|
|
[asset](const scr_string_t scrStr) -> std::string
|
|
|
|
|
{
|
|
|
|
|
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
|
|
|
|
if (scrStr >= asset->m_zone->m_script_strings.Count())
|
|
|
|
|
return "";
|
|
|
|
|
|
|
|
|
|
return asset->m_zone->m_script_strings[scrStr];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return converter.Convert();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AssetDumperWeapon::DumpAccuracyGraphs(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset)
|
|
|
|
|
{
|
|
|
|
|
auto* accuracyGraphWriter = context.GetZoneAssetDumperState<AccuracyGraphWriter>();
|
|
|
|
|
const auto weapon = asset->Asset();
|
|
|
|
|
const auto* weapDef = weapon->weapDef;
|
|
|
|
|
|
|
|
|
|
if (!weapDef)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (weapDef->aiVsAiAccuracyGraphName && weapDef->originalAiVsAiAccuracyGraphKnots
|
|
|
|
|
&& accuracyGraphWriter->ShouldDumpAiVsAiGraph(weapDef->aiVsAiAccuracyGraphName))
|
|
|
|
|
{
|
|
|
|
|
AccuracyGraphWriter::DumpAiVsAiGraph(
|
|
|
|
|
context,
|
|
|
|
|
ConvertAccuracyGraph(weapDef->aiVsAiAccuracyGraphName, weapDef->originalAiVsAiAccuracyGraphKnots, weapDef->originalAiVsAiAccuracyGraphKnotCount));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (weapDef->aiVsPlayerAccuracyGraphName && weapDef->originalAiVsPlayerAccuracyGraphKnots
|
|
|
|
|
&& accuracyGraphWriter->ShouldDumpAiVsPlayerGraph(weapDef->aiVsPlayerAccuracyGraphName))
|
|
|
|
|
{
|
|
|
|
|
AccuracyGraphWriter::DumpAiVsPlayerGraph(context,
|
|
|
|
|
ConvertAccuracyGraph(weapDef->aiVsPlayerAccuracyGraphName,
|
|
|
|
|
weapDef->originalAiVsPlayerAccuracyGraphKnots,
|
|
|
|
|
weapDef->originalAiVsPlayerAccuracyGraphKnotCount));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AssetDumperWeapon::ShouldDump(XAssetInfo<WeaponCompleteDef>* asset)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AssetDumperWeapon::DumpAsset(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset)
|
|
|
|
|
{
|
|
|
|
|
// TODO: only dump infostring fields when non-default
|
|
|
|
|
|
|
|
|
|
// Only dump raw when no gdt available
|
|
|
|
|
if (context.m_gdt)
|
|
|
|
|
{
|
|
|
|
|
const auto infoString = CreateInfoString(asset);
|
|
|
|
|
GdtEntry gdtEntry(asset->m_name, ObjConstants::GDF_FILENAME_WEAPON);
|
|
|
|
|
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_WEAPON, gdtEntry);
|
|
|
|
|
context.m_gdt->WriteEntry(gdtEntry);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const auto assetFile = context.OpenAssetFile("weapons/" + asset->m_name);
|
|
|
|
|
|
|
|
|
|
if (!assetFile)
|
|
|
|
|
if (!weapDef)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
auto& stream = *assetFile;
|
|
|
|
|
const auto infoString = CreateInfoString(asset);
|
|
|
|
|
const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_WEAPON);
|
|
|
|
|
stream.write(stringValue.c_str(), stringValue.size());
|
|
|
|
|
if (weapDef->aiVsAiAccuracyGraphName && weapDef->originalAiVsAiAccuracyGraphKnots
|
|
|
|
|
&& accuracyGraphWriter->ShouldDumpAiVsAiGraph(weapDef->aiVsAiAccuracyGraphName))
|
|
|
|
|
{
|
|
|
|
|
AccuracyGraphWriter::DumpAiVsAiGraph(context,
|
|
|
|
|
ConvertAccuracyGraph(weapDef->aiVsAiAccuracyGraphName,
|
|
|
|
|
weapDef->originalAiVsAiAccuracyGraphKnots,
|
|
|
|
|
weapDef->originalAiVsAiAccuracyGraphKnotCount));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (weapDef->aiVsPlayerAccuracyGraphName && weapDef->originalAiVsPlayerAccuracyGraphKnots
|
|
|
|
|
&& accuracyGraphWriter->ShouldDumpAiVsPlayerGraph(weapDef->aiVsPlayerAccuracyGraphName))
|
|
|
|
|
{
|
|
|
|
|
AccuracyGraphWriter::DumpAiVsPlayerGraph(context,
|
|
|
|
|
ConvertAccuracyGraph(weapDef->aiVsPlayerAccuracyGraphName,
|
|
|
|
|
weapDef->originalAiVsPlayerAccuracyGraphKnots,
|
|
|
|
|
weapDef->originalAiVsPlayerAccuracyGraphKnotCount));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
namespace IW5::weapon
|
|
|
|
|
{
|
|
|
|
|
bool Dumper::ShouldDump(XAssetInfo<WeaponCompleteDef>* asset)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DumpAccuracyGraphs(context, asset);
|
|
|
|
|
}
|
|
|
|
|
void Dumper::DumpAsset(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset)
|
|
|
|
|
{
|
|
|
|
|
// TODO: only dump infostring fields when non-default
|
|
|
|
|
|
|
|
|
|
// Only dump raw when no gdt available
|
|
|
|
|
if (context.m_gdt)
|
|
|
|
|
{
|
|
|
|
|
const auto infoString = CreateInfoString(asset);
|
|
|
|
|
GdtEntry gdtEntry(asset->m_name, ObjConstants::GDF_FILENAME_WEAPON);
|
|
|
|
|
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_WEAPON, gdtEntry);
|
|
|
|
|
context.m_gdt->WriteEntry(gdtEntry);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const auto assetFile = context.OpenAssetFile(GetFileNameForAssetName(asset->m_name));
|
|
|
|
|
|
|
|
|
|
if (!assetFile)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
auto& stream = *assetFile;
|
|
|
|
|
const auto infoString = CreateInfoString(asset);
|
|
|
|
|
const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_WEAPON);
|
|
|
|
|
stream.write(stringValue.c_str(), stringValue.size());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DumpAccuracyGraphs(context, asset);
|
|
|
|
|
}
|
|
|
|
|
} // namespace IW5::weapon
|