done requested code changes

This commit is contained in:
JSaurusRex 2023-10-08 17:31:43 +02:00
parent 03fad41def
commit 3c7ad1490b
3 changed files with 11 additions and 11 deletions

View file

@ -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>
@ -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])
@ -156,7 +156,7 @@ 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])
@ -164,11 +164,11 @@ bool CBinds::OnInput(const IInput::CEvent &Event)
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;
}
}

View file

@ -35,7 +35,7 @@ public:
virtual bool OnInput(const IInput::CEvent &Event) override;
};
bool mouseOnAction;
bool m_MouseOnAction;
enum
{

View file

@ -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;
}
}