Skip to content

Commit

Permalink
bindwheel fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrc6 committed Nov 21, 2024
1 parent 4fe7af5 commit 30873ee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/game/client/components/bindwheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void CBindWheel::OnConsoleInit()
pConfigManager->RegisterTCallback(ConfigSaveCallback, this);

Console()->Register("+bindwheel", "", CFGFLAG_CLIENT, ConOpenBindwheel, this, "Open bindwheel selector");
Console()->Register("+bindwheel_execute_hover", "", CFGFLAG_CLIENT, ConOpenBindwheel, this, "Execute hovered bindwheel bind");
Console()->Register("+bindwheel_execute_hover", "", CFGFLAG_CLIENT, ConExecuteHover, this, "Execute hovered bindwheel bind");

Console()->Register("bindwheel", "i[index] s[name] s[command]", CFGFLAG_CLIENT, ConAddBindwheel_Legacy, this, "DONT USE THIS! USE add_bindwheel INSTEAD!");
Console()->Register("add_bindwheel", "s[name] s[command]", CFGFLAG_CLIENT, ConAddBindwheel, this, "Add a bind to the bindwheel");
Expand Down
26 changes: 15 additions & 11 deletions src/game/client/components/menus_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3686,7 +3686,7 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
int HoveringIndex = (int)(HoveringAngle / (2 * pi) * SegmentCount);
if(HoveringIndex == i)
{
FontSize = 30.0f;
FontSize = 28.0f;
if(Ui()->MouseButtonClicked(0))
{
s_SelectedBindIndex = i;
Expand Down Expand Up @@ -3760,16 +3760,7 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
str_copy(GameClient()->m_Bindwheel.m_vBinds[s_AltSelectedBindIndex].m_aCommand, BindA.m_aCommand);
}

BindWheelOptions.HSplitTop(MarginSmall * 2.0f, nullptr, &BindWheelOptions);
BindWheelOptions.HSplitTop(ButtonSize, &Button, &BindWheelOptions);
if(DoButton_Menu(&s_RemoveButton, Localize("Remove Bind"), 0, &Button) && s_SelectedBindIndex >= 0)
{
GameClient()->m_Bindwheel.RemoveBind(s_SelectedBindIndex);
s_SelectedBindIndex = -1;
s_AltSelectedBindIndex = -1;
}

BindWheelOptions.HSplitTop(MarginSmall, nullptr, &BindWheelOptions);
BindWheelOptions.HSplitTop(MarginSmall * 4.0f, nullptr, &BindWheelOptions);
BindWheelOptions.HSplitTop(ButtonSize, &Button, &BindWheelOptions);
if(DoButton_Menu(&s_OverrideButton, Localize("Override Bind"), 0, &Button) && s_SelectedBindIndex >= 0)
{
Expand All @@ -3783,6 +3774,19 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
str_copy(GameClient()->m_Bindwheel.m_vBinds[s_SelectedBindIndex].m_aCommand, s_aBindCommand);
}

BindWheelOptions.HSplitTop(MarginSmall, nullptr, &BindWheelOptions);
BindWheelOptions.HSplitTop(ButtonSize, &Button, &BindWheelOptions);
if(DoButton_Menu(&s_RemoveButton, Localize("Remove Bind"), 0, &Button) && s_SelectedBindIndex >= 0)
{
GameClient()->m_Bindwheel.RemoveBind(s_SelectedBindIndex);
s_SelectedBindIndex = -1;
s_AltSelectedBindIndex = -1;
}
BindWheelOptions.HSplitTop(10.0f, nullptr, &BindWheelOptions);
BindWheelOptions.HSplitTop(25.0f, &Button, &BindWheelOptions);
Ui()->DoLabel(&Button, Localize("Use left mouse to select\nUse right mouse to alt-select"), 14.0f, TEXTALIGN_ML);


// Do Settings Key
CKeyInfo Key = CKeyInfo{"Bind Wheel Key", "+bindwheel", 0, 0};
for(int Mod = 0; Mod < CBinds::MODIFIER_COMBINATION_COUNT; Mod++)
Expand Down

0 comments on commit 30873ee

Please sign in to comment.