2010-11-20 10:37:14 +00:00
|
|
|
/* (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. */
|
2010-05-29 07:25:38 +00:00
|
|
|
#include <engine/config.h>
|
|
|
|
#include <engine/shared/config.h>
|
|
|
|
#include "binds.h"
|
2008-08-27 15:48:50 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
bool CBinds::CBindsSpecial::OnInput(IInput::CEvent Event)
|
2008-08-30 09:34:55 +00:00
|
|
|
{
|
|
|
|
// don't handle invalid events and keys that arn't set to anything
|
2015-08-24 20:46:28 +00:00
|
|
|
if(((Event.m_Key >= KEY_F1 && Event.m_Key <= KEY_F12) || (Event.m_Key >= KEY_F13 && Event.m_Key <= KEY_F24)) && m_pBinds->m_aaKeyBindings[Event.m_Key][0] != 0)
|
2008-08-30 09:34:55 +00:00
|
|
|
{
|
2010-05-29 07:25:38 +00:00
|
|
|
int Stroke = 0;
|
|
|
|
if(Event.m_Flags&IInput::FLAG_PRESS)
|
|
|
|
Stroke = 1;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2011-08-13 00:11:06 +00:00
|
|
|
m_pBinds->GetConsole()->ExecuteLineStroked(Stroke, m_pBinds->m_aaKeyBindings[Event.m_Key]);
|
2008-08-30 09:34:55 +00:00
|
|
|
return true;
|
|
|
|
}
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-30 09:34:55 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
CBinds::CBinds()
|
2008-08-27 15:48:50 +00:00
|
|
|
{
|
2010-05-29 07:25:38 +00:00
|
|
|
mem_zero(m_aaKeyBindings, sizeof(m_aaKeyBindings));
|
|
|
|
m_SpecialBinds.m_pBinds = this;
|
2008-08-27 15:48:50 +00:00
|
|
|
}
|
|
|
|
|
2011-02-12 10:40:36 +00:00
|
|
|
void CBinds::Bind(int KeyID, const char *pStr)
|
2008-08-27 15:48:50 +00:00
|
|
|
{
|
2011-02-12 10:40:36 +00:00
|
|
|
if(KeyID < 0 || KeyID >= KEY_LAST)
|
2008-08-27 15:48:50 +00:00
|
|
|
return;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2011-02-12 10:40:36 +00:00
|
|
|
str_copy(m_aaKeyBindings[KeyID], pStr, sizeof(m_aaKeyBindings[KeyID]));
|
2010-08-17 22:06:00 +00:00
|
|
|
char aBuf[256];
|
2011-02-12 10:40:36 +00:00
|
|
|
if(!m_aaKeyBindings[KeyID][0])
|
|
|
|
str_format(aBuf, sizeof(aBuf), "unbound %s (%d)", Input()->KeyName(KeyID), KeyID);
|
2008-08-27 15:48:50 +00:00
|
|
|
else
|
2011-02-12 10:40:36 +00:00
|
|
|
str_format(aBuf, sizeof(aBuf), "bound %s (%d) = %s", Input()->KeyName(KeyID), KeyID, m_aaKeyBindings[KeyID]);
|
2010-08-17 22:06:00 +00:00
|
|
|
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "binds", aBuf);
|
2008-08-27 15:48:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
bool CBinds::OnInput(IInput::CEvent e)
|
2008-08-27 15:48:50 +00:00
|
|
|
{
|
|
|
|
// don't handle invalid events and keys that arn't set to anything
|
2010-05-29 07:25:38 +00:00
|
|
|
if(e.m_Key <= 0 || e.m_Key >= KEY_LAST || m_aaKeyBindings[e.m_Key][0] == 0)
|
2008-08-27 15:48:50 +00:00
|
|
|
return false;
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
if(e.m_Flags&IInput::FLAG_PRESS)
|
2016-04-30 18:11:26 +00:00
|
|
|
Console()->ExecuteLineStroked(1, m_aaKeyBindings[e.m_Key]);
|
|
|
|
if(e.m_Flags&IInput::FLAG_RELEASE)
|
|
|
|
Console()->ExecuteLineStroked(0, m_aaKeyBindings[e.m_Key]);
|
2008-08-27 15:48:50 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
void CBinds::UnbindAll()
|
2008-08-27 15:48:50 +00:00
|
|
|
{
|
|
|
|
for(int i = 0; i < KEY_LAST; i++)
|
2010-05-29 07:25:38 +00:00
|
|
|
m_aaKeyBindings[i][0] = 0;
|
2008-08-27 15:48:50 +00:00
|
|
|
}
|
|
|
|
|
2011-02-12 10:40:36 +00:00
|
|
|
const char *CBinds::Get(int KeyID)
|
2008-08-27 15:48:50 +00:00
|
|
|
{
|
2011-02-12 10:40:36 +00:00
|
|
|
if(KeyID > 0 && KeyID < KEY_LAST)
|
|
|
|
return m_aaKeyBindings[KeyID];
|
2008-08-27 15:48:50 +00:00
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
const char *CBinds::GetKey(const char *pBindStr)
|
2008-09-25 14:04:02 +00:00
|
|
|
{
|
2010-05-29 07:25:38 +00:00
|
|
|
for(int KeyId = 0; KeyId < KEY_LAST; KeyId++)
|
2008-09-25 14:04:02 +00:00
|
|
|
{
|
2010-05-29 07:25:38 +00:00
|
|
|
const char *pBind = Get(KeyId);
|
|
|
|
if(!pBind[0])
|
2008-09-25 14:04:02 +00:00
|
|
|
continue;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
if(str_comp(pBind, pBindStr) == 0)
|
|
|
|
return Input()->KeyName(KeyId);
|
2008-09-25 14:04:02 +00:00
|
|
|
}
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-09-25 14:04:02 +00:00
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
void CBinds::SetDefaults()
|
2008-08-27 15:48:50 +00:00
|
|
|
{
|
|
|
|
// set default key bindings
|
2010-05-29 07:25:38 +00:00
|
|
|
UnbindAll();
|
|
|
|
Bind(KEY_F1, "toggle_local_console");
|
|
|
|
Bind(KEY_F2, "toggle_remote_console");
|
|
|
|
Bind(KEY_TAB, "+scoreboard");
|
2016-04-30 21:39:42 +00:00
|
|
|
Bind(KEY_BACKQUOTE, "+statboard");
|
2010-05-29 07:25:38 +00:00
|
|
|
Bind(KEY_F10, "screenshot");
|
|
|
|
|
|
|
|
Bind('a', "+left");
|
|
|
|
Bind('d', "+right");
|
|
|
|
|
|
|
|
Bind(KEY_SPACE, "+jump");
|
|
|
|
Bind(KEY_MOUSE_1, "+fire");
|
|
|
|
Bind(KEY_MOUSE_2, "+hook");
|
|
|
|
Bind(KEY_LSHIFT, "+emote");
|
2014-06-16 11:29:18 +00:00
|
|
|
#if defined(__ANDROID__)
|
|
|
|
Bind(KEY_RCTRL, "+fire");
|
|
|
|
Bind(KEY_RETURN, "+hook");
|
|
|
|
Bind(KEY_RIGHT, "+right");
|
|
|
|
Bind(KEY_LEFT, "+left");
|
|
|
|
Bind(KEY_UP, "+jump");
|
|
|
|
Bind(KEY_DOWN, "+hook");
|
|
|
|
Bind(KEY_PAGEUP, "+prevweapon");
|
|
|
|
Bind(KEY_PAGEDOWN, "+nextweapon");
|
2014-06-16 12:44:00 +00:00
|
|
|
Bind(KEY_F5, "spectate_previous");
|
|
|
|
Bind(KEY_F6, "spectate_next");
|
2014-06-16 11:29:18 +00:00
|
|
|
#else
|
2015-08-05 13:34:08 +00:00
|
|
|
Bind(KEY_RETURN, "+show_chat; chat all");
|
2011-04-13 15:39:26 +00:00
|
|
|
Bind(KEY_RIGHT, "spectate_next");
|
|
|
|
Bind(KEY_LEFT, "spectate_previous");
|
2014-06-16 12:44:00 +00:00
|
|
|
Bind(KEY_RSHIFT, "+spectate");
|
2014-06-16 11:29:18 +00:00
|
|
|
#endif
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
Bind('1', "+weapon1");
|
|
|
|
Bind('2', "+weapon2");
|
|
|
|
Bind('3', "+weapon3");
|
|
|
|
Bind('4', "+weapon4");
|
|
|
|
Bind('5', "+weapon5");
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
Bind(KEY_MOUSE_WHEEL_UP, "+prevweapon");
|
|
|
|
Bind(KEY_MOUSE_WHEEL_DOWN, "+nextweapon");
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2015-07-07 10:40:22 +00:00
|
|
|
Bind('t', "+show_chat; chat all");
|
|
|
|
Bind('y', "+show_chat; chat team");
|
|
|
|
Bind('z', "+show_chat; chat team"); // For German keyboards
|
|
|
|
Bind('u', "+show_chat");
|
|
|
|
Bind('i', "+show_chat; chat all /c ");
|
2008-09-25 14:04:02 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
Bind(KEY_F3, "vote yes");
|
2011-04-13 18:37:12 +00:00
|
|
|
Bind(KEY_F4, "vote no");
|
2011-02-16 09:20:27 +00:00
|
|
|
|
2013-08-18 01:33:55 +00:00
|
|
|
Bind('k', "kill");
|
2015-07-07 10:40:22 +00:00
|
|
|
Bind('q', "say /pause");
|
2013-08-18 01:33:55 +00:00
|
|
|
Bind('p', "say /pause");
|
|
|
|
|
2011-04-09 06:41:31 +00:00
|
|
|
// DDRace
|
|
|
|
|
2011-04-17 17:14:49 +00:00
|
|
|
if(g_Config.m_ClDDRaceBinds)
|
|
|
|
SetDDRaceBinds(false);
|
2008-08-27 15:48:50 +00:00
|
|
|
}
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
void CBinds::OnConsoleInit()
|
2008-08-27 15:48:50 +00:00
|
|
|
{
|
2008-08-30 21:01:57 +00:00
|
|
|
// bindings
|
2010-05-29 07:25:38 +00:00
|
|
|
IConfig *pConfig = Kernel()->RequestInterface<IConfig>();
|
|
|
|
if(pConfig)
|
|
|
|
pConfig->RegisterCallback(ConfigSaveCallback, this);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2015-12-28 15:14:52 +00:00
|
|
|
Console()->Register("bind", "s[key] r[command]", CFGFLAG_CLIENT, ConBind, this, "Bind key to execute the command");
|
2017-01-28 15:29:03 +00:00
|
|
|
Console()->Register("bind_print", "s[key]", CFGFLAG_CLIENT, ConBindPrint, this, "Print command executed by this keybinding");
|
2015-12-28 15:14:52 +00:00
|
|
|
Console()->Register("unbind", "s[key]", CFGFLAG_CLIENT, ConUnbind, this, "Unbind key");
|
2011-08-13 00:11:06 +00:00
|
|
|
Console()->Register("unbindall", "", CFGFLAG_CLIENT, ConUnbindAll, this, "Unbind all keys");
|
|
|
|
Console()->Register("dump_binds", "", CFGFLAG_CLIENT, ConDumpBinds, this, "Dump binds");
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-30 21:01:57 +00:00
|
|
|
// default bindings
|
2010-05-29 07:25:38 +00:00
|
|
|
SetDefaults();
|
2008-08-27 15:48:50 +00:00
|
|
|
}
|
|
|
|
|
2011-08-13 00:11:06 +00:00
|
|
|
void CBinds::ConBind(IConsole::IResult *pResult, void *pUserData)
|
2008-08-27 15:48:50 +00:00
|
|
|
{
|
2010-05-29 07:25:38 +00:00
|
|
|
CBinds *pBinds = (CBinds *)pUserData;
|
|
|
|
const char *pKeyName = pResult->GetString(0);
|
2011-02-12 10:40:36 +00:00
|
|
|
int id = pBinds->GetKeyID(pKeyName);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-27 15:48:50 +00:00
|
|
|
if(!id)
|
|
|
|
{
|
2010-08-17 22:06:00 +00:00
|
|
|
char aBuf[256];
|
|
|
|
str_format(aBuf, sizeof(aBuf), "key %s not found", pKeyName);
|
2011-08-13 00:11:06 +00:00
|
|
|
pBinds->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "binds", aBuf);
|
2008-08-27 15:48:50 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
pBinds->Bind(id, pResult->GetString(1));
|
2008-08-27 15:48:50 +00:00
|
|
|
}
|
|
|
|
|
2017-01-28 15:29:03 +00:00
|
|
|
void CBinds::ConBindPrint(IConsole::IResult *pResult, void *pUserData)
|
|
|
|
{
|
|
|
|
CBinds *pBinds = (CBinds *)pUserData;
|
|
|
|
const char *pKeyName = pResult->GetString(0);
|
|
|
|
int id = pBinds->GetKeyID(pKeyName);
|
|
|
|
|
|
|
|
if (!id)
|
|
|
|
{
|
|
|
|
char aBuf[256];
|
|
|
|
str_format(aBuf, sizeof(aBuf), "key %s not found", pKeyName);
|
|
|
|
pBinds->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "binds", aBuf);
|
|
|
|
}
|
2017-01-28 17:34:24 +00:00
|
|
|
else
|
|
|
|
{
|
2017-01-28 15:29:03 +00:00
|
|
|
char aBuf[256];
|
2017-01-28 16:02:39 +00:00
|
|
|
|
|
|
|
if (pBinds->m_aaKeyBindings[id][0] == '\0')
|
|
|
|
{
|
|
|
|
str_format(aBuf, sizeof(aBuf), "%s (%d) is not bound", pKeyName, id);
|
|
|
|
}
|
2017-01-28 17:34:24 +00:00
|
|
|
else
|
|
|
|
{
|
2017-01-28 16:02:39 +00:00
|
|
|
str_format(aBuf, sizeof(aBuf), "%s (%d) = %s", pKeyName, id, pBinds->m_aaKeyBindings[id]);
|
|
|
|
}
|
|
|
|
|
2017-01-28 15:29:03 +00:00
|
|
|
pBinds->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "binds", aBuf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-27 15:48:50 +00:00
|
|
|
|
2011-08-13 00:11:06 +00:00
|
|
|
void CBinds::ConUnbind(IConsole::IResult *pResult, void *pUserData)
|
2008-08-27 15:48:50 +00:00
|
|
|
{
|
2010-05-29 07:25:38 +00:00
|
|
|
CBinds *pBinds = (CBinds *)pUserData;
|
|
|
|
const char *pKeyName = pResult->GetString(0);
|
2011-02-12 10:40:36 +00:00
|
|
|
int id = pBinds->GetKeyID(pKeyName);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-27 15:48:50 +00:00
|
|
|
if(!id)
|
|
|
|
{
|
2010-08-17 22:06:00 +00:00
|
|
|
char aBuf[256];
|
|
|
|
str_format(aBuf, sizeof(aBuf), "key %s not found", pKeyName);
|
2011-08-13 00:11:06 +00:00
|
|
|
pBinds->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "binds", aBuf);
|
2008-08-27 15:48:50 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
pBinds->Bind(id, "");
|
2008-08-27 15:48:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-13 00:11:06 +00:00
|
|
|
void CBinds::ConUnbindAll(IConsole::IResult *pResult, void *pUserData)
|
2008-08-27 15:48:50 +00:00
|
|
|
{
|
2010-05-29 07:25:38 +00:00
|
|
|
CBinds *pBinds = (CBinds *)pUserData;
|
|
|
|
pBinds->UnbindAll();
|
2008-08-27 15:48:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-13 00:11:06 +00:00
|
|
|
void CBinds::ConDumpBinds(IConsole::IResult *pResult, void *pUserData)
|
2008-08-27 15:48:50 +00:00
|
|
|
{
|
2010-05-29 07:25:38 +00:00
|
|
|
CBinds *pBinds = (CBinds *)pUserData;
|
2010-05-30 00:15:26 +00:00
|
|
|
char aBuf[1024];
|
2008-08-27 15:48:50 +00:00
|
|
|
for(int i = 0; i < KEY_LAST; i++)
|
|
|
|
{
|
2010-05-29 07:25:38 +00:00
|
|
|
if(pBinds->m_aaKeyBindings[i][0] == 0)
|
2008-08-27 15:48:50 +00:00
|
|
|
continue;
|
2010-08-17 22:06:00 +00:00
|
|
|
str_format(aBuf, sizeof(aBuf), "%s (%d) = %s", pBinds->Input()->KeyName(i), i, pBinds->m_aaKeyBindings[i]);
|
2011-08-13 00:11:06 +00:00
|
|
|
pBinds->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "binds", aBuf);
|
2008-08-30 21:01:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-12 10:40:36 +00:00
|
|
|
int CBinds::GetKeyID(const char *pKeyName)
|
2008-08-30 21:01:57 +00:00
|
|
|
{
|
|
|
|
// check for numeric
|
2010-05-29 07:25:38 +00:00
|
|
|
if(pKeyName[0] == '&')
|
2008-08-30 21:01:57 +00:00
|
|
|
{
|
2010-05-29 07:25:38 +00:00
|
|
|
int i = str_toint(pKeyName+1);
|
2008-08-30 21:01:57 +00:00
|
|
|
if(i > 0 && i < KEY_LAST)
|
|
|
|
return i; // numeric
|
2008-08-27 15:48:50 +00:00
|
|
|
}
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-30 21:01:57 +00:00
|
|
|
// search for key
|
|
|
|
for(int i = 0; i < KEY_LAST; i++)
|
|
|
|
{
|
2010-05-29 07:25:38 +00:00
|
|
|
if(str_comp(pKeyName, Input()->KeyName(i)) == 0)
|
2008-08-30 21:01:57 +00:00
|
|
|
return i;
|
|
|
|
}
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-30 21:01:57 +00:00
|
|
|
return 0;
|
2008-08-27 15:48:50 +00:00
|
|
|
}
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
void CBinds::ConfigSaveCallback(IConfig *pConfig, void *pUserData)
|
2008-08-27 15:48:50 +00:00
|
|
|
{
|
2010-05-29 07:25:38 +00:00
|
|
|
CBinds *pSelf = (CBinds *)pUserData;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
char aBuffer[256];
|
|
|
|
char *pEnd = aBuffer+sizeof(aBuffer)-8;
|
|
|
|
pConfig->WriteLine("unbindall");
|
2008-08-27 15:48:50 +00:00
|
|
|
for(int i = 0; i < KEY_LAST; i++)
|
|
|
|
{
|
2010-05-29 07:25:38 +00:00
|
|
|
if(pSelf->m_aaKeyBindings[i][0] == 0)
|
2008-08-27 15:48:50 +00:00
|
|
|
continue;
|
2010-05-29 07:25:38 +00:00
|
|
|
str_format(aBuffer, sizeof(aBuffer), "bind %s ", pSelf->Input()->KeyName(i));
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-27 15:48:50 +00:00
|
|
|
// process the string. we need to escape some characters
|
2010-05-29 07:25:38 +00:00
|
|
|
const char *pSrc = pSelf->m_aaKeyBindings[i];
|
|
|
|
char *pDst = aBuffer + str_length(aBuffer);
|
|
|
|
*pDst++ = '"';
|
|
|
|
while(*pSrc && pDst < pEnd)
|
2008-08-27 15:48:50 +00:00
|
|
|
{
|
2010-05-29 07:25:38 +00:00
|
|
|
if(*pSrc == '"' || *pSrc == '\\') // escape \ and "
|
|
|
|
*pDst++ = '\\';
|
|
|
|
*pDst++ = *pSrc++;
|
2008-08-27 15:48:50 +00:00
|
|
|
}
|
2010-05-29 07:25:38 +00:00
|
|
|
*pDst++ = '"';
|
|
|
|
*pDst++ = 0;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
pConfig->WriteLine(aBuffer);
|
2008-08-27 15:48:50 +00:00
|
|
|
}
|
|
|
|
}
|
2011-04-17 17:14:49 +00:00
|
|
|
|
|
|
|
// DDRace
|
|
|
|
|
|
|
|
void CBinds::SetDDRaceBinds(bool FreeOnly)
|
|
|
|
{
|
|
|
|
if(!FreeOnly)
|
|
|
|
{
|
|
|
|
Bind(KEY_KP_PLUS, "zoom+");
|
|
|
|
Bind(KEY_KP_MINUS, "zoom-");
|
|
|
|
Bind(KEY_KP_MULTIPLY, "zoom");
|
|
|
|
Bind(KEY_HOME, "kill");
|
|
|
|
Bind(KEY_PAUSE, "say /pause");
|
|
|
|
Bind(KEY_UP, "+jump");
|
|
|
|
Bind(KEY_LEFT, "+left");
|
|
|
|
Bind(KEY_RIGHT, "+right");
|
|
|
|
Bind('[', "+prevweapon");
|
|
|
|
Bind(']', "+nextweapon");
|
|
|
|
Bind('c', "say /rank");
|
|
|
|
Bind('v', "say /info");
|
|
|
|
Bind('b', "say /top5");
|
|
|
|
Bind('x', "emote 14");
|
|
|
|
Bind('h', "emote 2");
|
|
|
|
Bind('m', "emote 5");
|
2014-01-14 20:47:54 +00:00
|
|
|
Bind('s', "+showhookcoll");
|
2014-04-26 18:29:42 +00:00
|
|
|
Bind('x', "toggle cl_dummy 0 1");
|
2014-06-16 11:29:18 +00:00
|
|
|
#if !defined(__ANDROID__)
|
2014-07-25 23:12:32 +00:00
|
|
|
Bind(KEY_PAGEDOWN, "toggle cl_show_quads 0 1");
|
|
|
|
Bind(KEY_PAGEUP, "toggle cl_overlay_entities 0 100");
|
2014-06-16 11:29:18 +00:00
|
|
|
#endif
|
2015-08-24 20:46:28 +00:00
|
|
|
Bind(KEY_KP_0, "say /emote normal 999999");
|
|
|
|
Bind(KEY_KP_1, "say /emote happy 999999");
|
|
|
|
Bind(KEY_KP_2, "say /emote angry 999999");
|
|
|
|
Bind(KEY_KP_3, "say /emote pain 999999");
|
|
|
|
Bind(KEY_KP_4, "say /emote surprise 999999");
|
|
|
|
Bind(KEY_KP_5, "say /emote blink 999999");
|
2011-04-17 17:14:49 +00:00
|
|
|
Bind(KEY_MOUSE_3, "+spectate");
|
2016-03-26 00:09:34 +00:00
|
|
|
Bind(KEY_MINUS, "spectate_previous");
|
|
|
|
Bind(KEY_EQUALS, "spectate_next");
|
2011-04-17 17:14:49 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(!Get(KEY_KP_PLUS)[0])
|
|
|
|
Bind(KEY_KP_PLUS, "zoom+");
|
|
|
|
if(!Get(KEY_KP_MINUS)[0])
|
|
|
|
Bind(KEY_KP_MINUS, "zoom-");
|
|
|
|
if(!Get(KEY_KP_MULTIPLY)[0])
|
|
|
|
Bind(KEY_KP_MULTIPLY, "zoom");
|
|
|
|
if(!Get(KEY_HOME)[0])
|
|
|
|
Bind(KEY_HOME, "kill");
|
|
|
|
if(!Get(KEY_PAUSE)[0])
|
|
|
|
Bind(KEY_PAUSE, "say /pause");
|
|
|
|
if(!Get(KEY_UP)[0])
|
|
|
|
Bind(KEY_UP, "+jump");
|
|
|
|
if(!Get(KEY_LEFT)[0])
|
|
|
|
Bind(KEY_LEFT, "+left");
|
|
|
|
if(!Get(KEY_RIGHT)[0])
|
|
|
|
Bind(KEY_RIGHT, "+right");
|
|
|
|
if(!Get('[')[0])
|
|
|
|
Bind('[', "+prevweapon");
|
|
|
|
if(!Get(']')[0])
|
|
|
|
Bind(']', "+nextweapon");
|
|
|
|
if(!Get('c')[0])
|
|
|
|
Bind('c', "say /rank");
|
|
|
|
if(!Get('v')[0])
|
|
|
|
Bind('v', "say /info");
|
|
|
|
if(!Get('b')[0])
|
|
|
|
Bind('b', "say /top5");
|
|
|
|
if(!Get('x')[0])
|
|
|
|
Bind('x', "emote 14");
|
|
|
|
if(!Get(KEY_KP_PLUS)[0])
|
|
|
|
Bind('h', "emote 2");
|
|
|
|
if(!Get('m')[0])
|
|
|
|
Bind('m', "emote 5");
|
2014-04-26 18:29:42 +00:00
|
|
|
if(!Get('s')[0])
|
|
|
|
Bind('s', "+showhookcoll");
|
|
|
|
if(!Get('x')[0])
|
|
|
|
Bind('x', "toggle cl_dummy 0 1");
|
2011-04-17 17:14:49 +00:00
|
|
|
if(!Get(KEY_PAGEDOWN)[0])
|
2016-03-26 00:09:34 +00:00
|
|
|
Bind(KEY_PAGEDOWN, "toggle cl_show_quads 0 1");
|
2011-04-17 17:14:49 +00:00
|
|
|
if(!Get(KEY_PAGEUP)[0])
|
2016-03-26 00:09:34 +00:00
|
|
|
Bind(KEY_PAGEUP, "toggle cl_overlay_entities 0 100");
|
2015-08-24 20:46:28 +00:00
|
|
|
if(!Get(KEY_KP_0)[0])
|
|
|
|
Bind(KEY_KP_0, "say /emote normal 999999");
|
|
|
|
if(!Get(KEY_KP_1)[0])
|
|
|
|
Bind(KEY_KP_1, "say /emote happy 999999");
|
|
|
|
if(!Get(KEY_KP_2)[0])
|
|
|
|
Bind(KEY_KP_2, "say /emote angry 999999");
|
|
|
|
if(!Get(KEY_KP_3)[0])
|
|
|
|
Bind(KEY_KP_3, "say /emote pain 999999");
|
|
|
|
if(!Get(KEY_KP_4)[0])
|
|
|
|
Bind(KEY_KP_4, "say /emote surprise 999999");
|
|
|
|
if(!Get(KEY_KP_5)[0])
|
|
|
|
Bind(KEY_KP_5, "say /emote blink 999999");
|
2011-04-17 17:14:49 +00:00
|
|
|
if(!Get(KEY_MOUSE_3)[0])
|
|
|
|
Bind(KEY_MOUSE_3, "+spectate");
|
|
|
|
if(!Get(KEY_MINUS)[0])
|
|
|
|
Bind(KEY_MINUS, "spectate_previous");
|
|
|
|
if(!Get(KEY_EQUALS)[0])
|
|
|
|
Bind(KEY_EQUALS, "spectate_next");
|
|
|
|
}
|
2014-01-14 20:47:54 +00:00
|
|
|
|
|
|
|
g_Config.m_ClDDRaceBindsSet = 1;
|
2013-08-18 01:33:55 +00:00
|
|
|
}
|