Skip to content

Commit

Permalink
Add kick sounds
Browse files Browse the repository at this point in the history
Co-authored-by: Drombeys <[email protected]>
  • Loading branch information
Shtrecker and Drombeys committed Mar 4, 2025
1 parent 412f2f8 commit bafb1aa
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions src/xrGame/WeaponKnife.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,16 @@ void CWeaponKnife::Load (LPCSTR section)

fWallmarkSize = pSettings->r_float(section,"wm_size");

m_sounds.LoadSound(section,"snd_shoot", "sndShot", false, SOUND_TYPE_WEAPON_SHOOTING);

if (pSettings->line_exist(section, "snd_kick_1") && pSettings->line_exist(section, "snd_kick_2"))
{
m_sounds.LoadSound(section, "snd_kick_1", "sndKick1", false, SOUND_TYPE_WEAPON_SHOOTING);
m_sounds.LoadSound(section, "snd_kick_2", "sndKick2", false, SOUND_TYPE_WEAPON_SHOOTING);
}
else
{
m_sounds.LoadSound(section, "snd_shoot", "sndShot", false, SOUND_TYPE_WEAPON_SHOOTING);
}

if (pSettings->line_exist(section, "snd_draw"))
m_sounds.LoadSound(section, "snd_draw", "SndShow", false, ESoundTypes(SOUND_TYPE_ITEM_TAKING));

Expand Down Expand Up @@ -204,7 +212,10 @@ void CWeaponKnife::MakeShot(Fvector const & pos, Fvector const & dir, float cons
iAmmoElapsed = (u32)m_magazine.size();
bool SendHit = SendHitAllowed(H_Parent());

PlaySound ("sndShot",pos);
if (m_sounds.FindSoundItem("sndShot", false))
{
PlaySound("sndShot", pos);
}

CActor* actor = smart_cast<CActor*>(H_Parent());
if (actor->active_cam() != eacFirstEye) {
Expand Down Expand Up @@ -275,12 +286,25 @@ void CWeaponKnife::state_Attacking (float)

void CWeaponKnife::switch2_Attacking (u32 state)
{
if(IsPending()) return;
if(IsPending())
return;

if(state==eFire)
PlayHUDMotion("anm_attack", FALSE, this, state);
else //eFire2
PlayHUDMotion("anm_attack2", FALSE, this, state);
if (state == eFire)
{
PlayHUDMotion("anm_attack", FALSE, this, state);
if (m_sounds.FindSoundItem("sndKick1", false))
{
PlaySound("sndKick1", Position());
}
}
else
{//eFire2
PlayHUDMotion("anm_attack2", FALSE, this, state);
if (m_sounds.FindSoundItem("sndKick2", false))
{
PlaySound("sndKick2", Position());
}
}

SetPending (TRUE);
}
Expand Down

0 comments on commit bafb1aa

Please sign in to comment.