chore: dump iw5 weapon sound overrides

This commit is contained in:
Jan
2024-04-07 14:08:06 +02:00
parent 8554939c91
commit ea0cb66eae
4 changed files with 78 additions and 4 deletions

View File

@ -221,6 +221,10 @@ namespace IW5
FillFromAnimOverrides(std::string(field.szName));
break;
case WFT_SOUND_OVERRIDES:
FillFromSoundOverrides(std::string(field.szName));
break;
case WFT_NUM_FIELD_TYPES:
default:
assert(false);
@ -357,6 +361,55 @@ namespace IW5
m_info_string.SetValueForKey(key, ss.str());
}
void FillFromSoundOverrides(const std::string& key)
{
std::stringstream ss;
bool first = true;
for (auto i = 0u; i < m_weapon->weapCompleteDef.numSoundOverrides; i++)
{
const auto& soundOverride = m_weapon->weapCompleteDef.soundOverrides[i];
if (!first)
ss << "\n";
else
first = false;
assert(soundOverride.soundType < SNDTYPE_PLAYER_COUNT);
if (soundOverride.attachment1.fields)
ss << GetNameForSingleWeaponAttachment(soundOverride.attachment1);
else
ss << "none";
ss << ' ';
if (soundOverride.attachment2.fields)
ss << GetNameForSingleWeaponAttachment(soundOverride.attachment2);
else
ss << "none";
ss << ' ';
if (soundOverride.soundType < SNDTYPE_PLAYER_COUNT)
ss << soundOverrideTypeNames[soundOverride.soundType] << ' ';
if (soundOverride.overrideSound.name && soundOverride.overrideSound.name->soundName && soundOverride.overrideSound.name->soundName[0])
ss << soundOverride.overrideSound.name->soundName;
else
ss << "none";
ss << ' ';
if (soundOverride.altmodeSound.name && soundOverride.altmodeSound.name->soundName && soundOverride.altmodeSound.name->soundName[0])
ss << soundOverride.altmodeSound.name->soundName;
else
ss << "none";
}
m_info_string.SetValueForKey(key, ss.str());
}
const WeaponFullDef* m_weapon;
};
} // namespace IW5