Skip to content

Commit

Permalink
Add hammer rotates with cursor option
Browse files Browse the repository at this point in the history
  • Loading branch information
SollyBunny committed Nov 18, 2024
1 parent 61d3b2f commit 7facf20
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
8 changes: 7 additions & 1 deletion src/game/client/components/menus_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3581,8 +3581,14 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
// checkbox for hiding nameplates
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRenderNameplateSpec, ("Hide nameplates in spec"), &g_Config.m_ClRenderNameplateSpec, &MainView, LineMargin);

// create dropdown for rainbow modes
// hammer rotates with cursor
CUIRect HammerRotatesWithCursorButton;
MainView.HSplitTop(20.0f, &HammerRotatesWithCursorButton, &MainView);
if(DoButton_CheckBox(&g_Config.m_ClHammerRotatesWithCursor, Localize("Hammer rotates with cursor"), g_Config.m_ClHammerRotatesWithCursor, &HammerRotatesWithCursorButton))
g_Config.m_ClHammerRotatesWithCursor ^= 1;
GameClient()->m_Tooltips.DoToolTip(&g_Config.m_ClHammerRotatesWithCursor, &HammerRotatesWithCursorButton, Localize("Allow your hammer to rotate like other weapons"));

// create dropdown for rainbow modes
static std::vector<const char *> s_DropDownNames = {Localize("Rainbow"), Localize("Pulse"), Localize("Black")};

static CUi::SDropDownState s_RainbowDropDownState;
Expand Down
20 changes: 12 additions & 8 deletions src/game/client/components/players.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,16 +608,20 @@ void CPlayers::RenderPlayer(
if(IsSit)
WeaponPosition.y += 3.0f;

// if active and attack is under way, bash stuffs
if(!Inactive || LastAttackTime < m_pClient->m_aTuning[g_Config.m_ClDummy].GetWeaponFireDelay(Player.m_Weapon))
// set rotation
float QuadsRotation = -pi / 2;
QuadsRotation += State.GetAttach()->m_Angle * (Direction.x < 0 ? -1 : 1) * pi * 2;
if(g_Config.m_ClHammerRotatesWithCursor)
{
if(Direction.x < 0)
Graphics()->QuadsSetRotation(-pi / 2 - State.GetAttach()->m_Angle * pi * 2);
else
Graphics()->QuadsSetRotation(-pi / 2 + State.GetAttach()->m_Angle * pi * 2);
QuadsRotation += Angle;
if (Direction.x < 0)
QuadsRotation += pi;
}
else
Graphics()->QuadsSetRotation(Direction.x < 0 ? 100.0f : 500.0f);
else if(Inactive && LastAttackTime > m_pClient->m_aTuning[g_Config.m_ClDummy].GetWeaponFireDelay(Player.m_Weapon))
{
QuadsRotation = Direction.x < 0 ? 100.0f : 500.0f;
}
Graphics()->QuadsSetRotation(QuadsRotation);

Graphics()->RenderQuadContainerAsSprite(m_WeaponEmoteQuadContainerIndex, QuadOffset, WeaponPosition.x, WeaponPosition.y);
}
Expand Down
2 changes: 2 additions & 0 deletions src/game/tater_variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ MACRO_CONFIG_INT(ClSpecmenuID, tc_spec_menu_ID, 0, 0, 1, CFGFLAG_CLIENT | CFGFLA

MACRO_CONFIG_INT(ClLimitMouseToScreen, tc_limit_mouse_to_screen, 0, 0, 2, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Limit mouse to screen boundries")

MACRO_CONFIG_INT(ClHammerRotatesWithCursor, tc_hammer_rotates_with_cursor, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Allow your hammer to rotate like other weapons")

// Anti Latency Tools
MACRO_CONFIG_INT(ClFreezeUpdateFix, tc_freeze_update_fix, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Will change your skin faster when you enter freeze. ")
MACRO_CONFIG_INT(ClRemoveAnti, tc_remove_anti, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Removes some amount of antiping & player prediction in freeze")
Expand Down

0 comments on commit 7facf20

Please sign in to comment.