Skip to content

Commit

Permalink
Merge pull request #133 from SmileyAG/killsound_string
Browse files Browse the repository at this point in the history
Client: Allow to specify name for kill sound and regulate volume
  • Loading branch information
tmp64 authored Dec 3, 2023
2 parents f4deeab + 1857a25 commit d5b9670
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/game/client/hud/chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1340,8 +1340,8 @@ void CHudChat::ChatPrintf(int iPlayerIndex, const char *fmt, ...)
line->InsertAndColorizeText(wbuf, iPlayerIndex);
}

if (hud_saytext.GetBool() && hud_saytext_sound.GetBool())
PlaySound(m_pszChatSoundPath, 1);
if (hud_saytext.GetBool() && hud_saytext_sound.GetFloat() > 0)
PlaySound(m_pszChatSoundPath, hud_saytext_sound.GetFloat());

// Print to console
time_t now;
Expand Down
7 changes: 4 additions & 3 deletions src/game/client/hud/death_notice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ struct DeathNoticeItem
};

extern ConVar hud_deathnotice_vgui;
ConVar cl_killsound("cl_killsound", "1", FCVAR_BHL_ARCHIVE, "Play a bell sound on kill");
ConVar cl_killsound("cl_killsound", "1", FCVAR_BHL_ARCHIVE, "Play a sound on kill");
ConVar cl_killsound_path("cl_killsound_path", "buttons/bell1.wav", FCVAR_BHL_ARCHIVE, "Path to a sound on kill");
ConVar hud_deathnotice_time("hud_deathnotice_time", "6", FCVAR_BHL_ARCHIVE, "How long should death notice stay up for");
ConVar hud_deathnotice_color("hud_deathnotice_color", "255 80 0", FCVAR_BHL_ARCHIVE, "Color of death notice sprite");
ConVar hud_deathnotice_color_tk("hud_deathnotice_color_tk", "10 240 10", FCVAR_BHL_ARCHIVE, "Color of death notice teamkill sprite");
Expand Down Expand Up @@ -267,9 +268,9 @@ int CHudDeathNotice::MsgFunc_DeathMsg(const char *pszName, int iSize, void *pbuf
rgDeathNoticeList[i].flDisplayTime = gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME;

// Play kill sound
if (killerInfo && killerInfo->IsThisPlayer() && !rgDeathNoticeList[i].iNonPlayerKill && !rgDeathNoticeList[i].iSuicide && cl_killsound.GetBool())
if (killerInfo && killerInfo->IsThisPlayer() && !rgDeathNoticeList[i].iNonPlayerKill && !rgDeathNoticeList[i].iSuicide && cl_killsound.GetFloat() > 0)
{
PlaySound("buttons/bell1.wav", 1.0f);
PlaySound(cl_killsound_path.GetString(), cl_killsound.GetFloat());
}

// Set color of own kills/deaths to yellow
Expand Down

0 comments on commit d5b9670

Please sign in to comment.