Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client: Allow to specify name for kill sound and regulate volume #133

Merged
merged 3 commits into from
Dec 3, 2023

Conversation

SmileyAG
Copy link
Contributor

@SmileyAG SmileyAG commented Mar 2, 2022

Closes #132

@SmileyAG SmileyAG changed the title Client: Allow to specify name for kill sound Client: Allow to specify name for kill sound and regulate volume Mar 7, 2022
@tmp64
Copy link
Owner

tmp64 commented Mar 8, 2022

Volume control will stop working as soon as "Apply" is pressed in the advanced options dialog because CCvarCheckButton only allows boolean values

void CCvarCheckButton::ResetData()
{
if (m_pCvar)
{
bool val = !!m_pCvar->value;
if (m_bInverse)
val = !val;
BaseClass::SetSelected(val);
}
}
void CCvarCheckButton::ApplyChanges()
{
if (m_pCvar)
{
char buf[256];
bool val = IsSelected();
if (m_bInverse)
val = !val;
snprintf(buf, sizeof(buf), "%s \"%s\"", m_pCvar->name, (val ? "1" : "0"));
gEngfuncs.pfnClientCmd(buf);
}
}

I see two ways to resolve that
a. Replace checkboxes with sliders. But there's barely any space for anything as it is.
b. Modify CCvarCheckButton to only update the value if it was changed.

@tmp64
Copy link
Owner

tmp64 commented Dec 3, 2023

Rebased on top of master

@tmp64 tmp64 merged commit d5b9670 into tmp64:master Dec 3, 2023
4 checks passed
@tmp64
Copy link
Owner

tmp64 commented Dec 3, 2023

Thanks!

@tmp64
Copy link
Owner

tmp64 commented Dec 3, 2023

I see two ways to resolve that
a. Replace checkboxes with sliders. But there's barely any space for anything as it is.
b. Modify CCvarCheckButton to only update the value if it was changed.

I changed CCvarCheckButton to only apply if the user clicked the checkbox (f4deeab).

@SmileyAG SmileyAG deleted the killsound_string branch December 24, 2023 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kill sound
2 participants