mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 16:15:43 +00:00
chore: dump iw5 weapon sound overrides
This commit is contained in:
parent
8554939c91
commit
ea0cb66eae
@ -117,6 +117,7 @@ namespace IW5
|
||||
WFT_ANIM_NAME,
|
||||
WFT_ATTACHMENT,
|
||||
WFT_ANIM_OVERRIDES,
|
||||
WFT_SOUND_OVERRIDES,
|
||||
|
||||
WFT_NUM_FIELD_TYPES,
|
||||
};
|
||||
|
@ -3923,13 +3923,24 @@ namespace IW5
|
||||
int altTime;
|
||||
};
|
||||
|
||||
enum SoundOverrideTypes : unsigned int
|
||||
{
|
||||
SNDTYPE_NONE = 0x0,
|
||||
SNDTYPE_FIRE = 0x1,
|
||||
SNDTYPE_PLAYER_FIRE = 0x2,
|
||||
SNDTYPE_PLAYER_AKIMBO = 0x3,
|
||||
SNDTYPE_PLAYER_LASTSHOT = 0x4,
|
||||
|
||||
SNDTYPE_PLAYER_COUNT
|
||||
};
|
||||
|
||||
struct SoundOverrideEntry
|
||||
{
|
||||
unsigned short attachment1;
|
||||
unsigned short attachment2;
|
||||
WeaponAttachmentCombination attachment1;
|
||||
WeaponAttachmentCombination attachment2;
|
||||
SndAliasCustom overrideSound;
|
||||
SndAliasCustom altmodeSound;
|
||||
unsigned int soundType;
|
||||
SoundOverrideTypes soundType;
|
||||
};
|
||||
|
||||
struct FXOverrideEntry
|
||||
|
@ -4,7 +4,6 @@
|
||||
namespace IW5
|
||||
{
|
||||
// WeaponCompleteDef:
|
||||
// TODO: soundOverrides
|
||||
// TODO: fxOverrides
|
||||
// TODO: reloadOverrides
|
||||
// TODO: notetrackOverrides
|
||||
@ -734,6 +733,7 @@ namespace IW5
|
||||
{"missileConeSoundCrossfadeBottomSize", offsetof(WeaponFullDef, weapDef.missileConeSoundCrossfadeBottomSize), CSPFT_FLOAT },
|
||||
{"attachments", offsetof(WeaponFullDef, scopes), WFT_ATTACHMENT },
|
||||
{"animOverrides", offsetof(WeaponFullDef, weapCompleteDef.animOverrides), WFT_ANIM_OVERRIDES },
|
||||
{"soundOverrides", offsetof(WeaponFullDef, weapCompleteDef.soundOverrides), WFT_SOUND_OVERRIDES },
|
||||
};
|
||||
|
||||
inline const char* szWeapTypeNames[]{
|
||||
@ -925,4 +925,13 @@ namespace IW5
|
||||
"ads_down", "alt_adjust",
|
||||
};
|
||||
static_assert(std::extent_v<decltype(weapAnimFilesNames)> == WEAP_ANIM_COUNT);
|
||||
|
||||
inline const char* soundOverrideTypeNames[]{
|
||||
"none",
|
||||
"fire",
|
||||
"player_fire",
|
||||
"player_akimbo",
|
||||
"player_lastshot",
|
||||
};
|
||||
static_assert(std::extent_v<decltype(soundOverrideTypeNames)> == SNDTYPE_PLAYER_COUNT);
|
||||
} // namespace IW5
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user