Skip to content

Commit

Permalink
Use snd_shoot when snd_silncer_shot doesn't exist in weapon config
Browse files Browse the repository at this point in the history
This is for compatibility with Clear Sky (#382), closes #1678.
  • Loading branch information
Xottab-DUTY committed Dec 27, 2024
1 parent 03d5924 commit 61f71e8
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/xrGame/WeaponMagazined.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ void CWeaponMagazined::Load(LPCSTR section)
if (WeaponSoundExist(section, "snd_reload_misfire"))
m_sounds.LoadSound(section, "snd_reload_misfire", "sndReloadMisfire", true, m_eSoundReloadMisfire);

m_sSndShotCurrent = IsSilencerAttached() ? "sndSilencerShot" : "sndShot";

//звуки и партиклы глушителя, если такой есть
if (m_eSilencerStatus == ALife::eAddonAttachable || m_eSilencerStatus == ALife::eAddonPermanent)
{
Expand All @@ -101,6 +99,11 @@ void CWeaponMagazined::Load(LPCSTR section)
//-Alundaio
}

if (IsSilencerAttached() && m_layered_sounds.FindSoundItem("sndSilencerShot", false))
m_sSndShotCurrent = "sndSilencerShot";
else
m_sSndShotCurrent = "sndShot";

m_iBaseDispersionedBulletsCount = READ_IF_EXISTS(pSettings, r_u8, section, "base_dispersioned_bullets_count", 0);
m_fBaseDispersionedBulletsSpeed =
READ_IF_EXISTS(pSettings, r_float, section, "base_dispersioned_bullets_speed", m_fStartBulletSpeed);
Expand Down Expand Up @@ -1064,15 +1067,16 @@ void CWeaponMagazined::InitAddons()
}
}

if (IsSilencerAttached() /* && SilencerAttachable() */)
const bool silencer = IsSilencerAttached();

if (silencer && m_layered_sounds.FindSoundItem("sndSilencerShot", false))
{
m_sFlameParticlesCurrent = m_sSilencerFlameParticles;
m_sSmokeParticlesCurrent = m_sSilencerSmokeParticles;
m_sSndShotCurrent = "sndSilencerShot";

//подсветка от выстрела
LoadLights(*cNameSect(), "silencer_");
ApplySilencerKoeffs();
}
else
{
Expand All @@ -1082,9 +1086,13 @@ void CWeaponMagazined::InitAddons()

//подсветка от выстрела
LoadLights(*cNameSect(), "");
ResetSilencerKoeffs();
}

if (silencer)
ApplySilencerKoeffs();
else
ResetSilencerKoeffs();

inherited::InitAddons();
}

Expand Down

0 comments on commit 61f71e8

Please sign in to comment.