Skip to content

Commit

Permalink
done requested code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JSaurusRex committed Oct 8, 2023
1 parent 03fad41 commit 3c7ad14
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/game/client/components/binds.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#include "binds.h"
#include <cstring>
#include <base/system.h>
#include <engine/config.h>
#include <engine/shared/config.h>

Expand Down Expand Up @@ -135,14 +135,14 @@ bool CBinds::OnInput(const IInput::CEvent &Event)
Mask &= ~KeyModifierMask;

bool ret = false;
char *key = 0;
const char *pKey = nullptr;

if(m_aapKeyBindings[Mask][Event.m_Key])
{
if(Event.m_Flags & IInput::FLAG_PRESS)
{
Console()->ExecuteLineStroked(1, m_aapKeyBindings[Mask][Event.m_Key]);
key = m_aapKeyBindings[Mask][Event.m_Key];
pKey = m_aapKeyBindings[Mask][Event.m_Key];
}
// Have to check for nullptr again because the previous execute can unbind itself
if(Event.m_Flags & IInput::FLAG_RELEASE && m_aapKeyBindings[Mask][Event.m_Key])
Expand All @@ -156,19 +156,19 @@ bool CBinds::OnInput(const IInput::CEvent &Event)
if(Event.m_Flags & IInput::FLAG_PRESS && Mask != ((1 << MODIFIER_CTRL) | (1 << MODIFIER_SHIFT)) && Mask != ((1 << MODIFIER_GUI) | (1 << MODIFIER_SHIFT)))
{
Console()->ExecuteLineStroked(1, m_aapKeyBindings[0][Event.m_Key]);
key = m_aapKeyBindings[Mask][Event.m_Key];
pKey = m_aapKeyBindings[Mask][Event.m_Key];
}
// Have to check for nullptr again because the previous execute can unbind itself
if(Event.m_Flags & IInput::FLAG_RELEASE && m_aapKeyBindings[0][Event.m_Key])
Console()->ExecuteLineStroked(0, m_aapKeyBindings[0][Event.m_Key]);
ret = true;
}

if(g_Config.m_ClSubTickAiming && key)
if(g_Config.m_ClSubTickAiming && pKey)
{
if(strcmp("+fire", key) == 0 || strcmp("+hook", key) == 0)
if(str_comp("+fire", pKey) == 0 || str_comp("+hook", pKey) == 0)
{
mouseOnAction = true;
m_MouseOnAction = true;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/client/components/binds.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CBinds : public CComponent
virtual bool OnInput(const IInput::CEvent &Event) override;
};

bool mouseOnAction;
bool m_MouseOnAction;

enum
{
Expand Down
6 changes: 3 additions & 3 deletions src/game/client/gameclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,10 @@ void CGameClient::OnUpdate()
}
}

if(g_Config.m_ClSubTickAiming && m_Binds.mouseOnAction)
if(g_Config.m_ClSubTickAiming && m_Binds.m_MouseOnAction)
{
m_Controls.m_aMousePosOnAction[g_Config.m_ClDummy] = m_Controls.m_aMousePos[g_Config.m_ClDummy]; //idk what g_Config.m_ClDummy is
m_Binds.mouseOnAction = false;
m_Controls.m_aMousePosOnAction[g_Config.m_ClDummy] = m_Controls.m_aMousePos[g_Config.m_ClDummy];
m_Binds.m_MouseOnAction = false;
}
}

Expand Down

0 comments on commit 3c7ad14

Please sign in to comment.