General DDRace binds improvements

This commit is contained in:
GreYFoX 2011-04-17 19:14:49 +02:00
parent 5924b5a8bf
commit dad66bffc3
5 changed files with 114 additions and 29 deletions

View file

@ -104,8 +104,9 @@ MACRO_CONFIG_INT(SvHit, sv_hit, 1, 0, 1, CFGFLAG_SERVER, "Whether players can ha
MACRO_CONFIG_INT(SvEndlessDrag, sv_endless_drag, 0, 0, 1, CFGFLAG_SERVER, "Turns endless hooking on/off", IConsole::CONSOLELEVEL_ADMIN)
MACRO_CONFIG_INT(SvTestingCommands, sv_test_cmds, 0, 0, 1, CFGFLAG_SERVER, "Turns testing commands aka cheats on/off", IConsole::CONSOLELEVEL_ADMIN)
MACRO_CONFIG_INT(SvFreezeDelay, sv_freeze_delay, 3, 1, 30, CFGFLAG_SERVER, "How many seconds the players will remain frozen (applies to all except delayed freeze in switch layer & deepfreeze)", IConsole::CONSOLELEVEL_ADMIN)
MACRO_CONFIG_INT(ClDDRaceCheats, cl_race_cheats, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Enable Cheats Such as Zoom",IConsole::CONSOLELEVEL_USER)
MACRO_CONFIG_INT(ClDDRaceBinds, cl_race_binds, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Enable Default DDrace builds when pressing the reset binds button",IConsole::CONSOLELEVEL_USER)
MACRO_CONFIG_INT(ClDDRaceCheats, cl_race_cheats, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Enable Cheats Such as Zoom", IConsole::CONSOLELEVEL_USER)
MACRO_CONFIG_INT(ClDDRaceBinds, cl_race_binds, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Enable Default DDRace builds when pressing the reset binds button", IConsole::CONSOLELEVEL_USER)
MACRO_CONFIG_INT(ClDDRaceBindsSet, cl_race_binds_set, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Whether the DDRace binds set or not (this is automated you don't need to use this)", IConsole::CONSOLELEVEL_USER)
MACRO_CONFIG_INT(SvEndlessSuperHook, sv_endless_super_hook, 0, 0, 1, CFGFLAG_SERVER, "Endless hook for super players on/off", IConsole::CONSOLELEVEL_ADMIN)
MACRO_CONFIG_INT(SvHideScore, sv_hide_score, 0, 0, 1, CFGFLAG_SERVER, "Whether players scores will be announced or not", IConsole::CONSOLELEVEL_ADMIN)
MACRO_CONFIG_INT(SvPauseable, sv_pauseable, 1, 0, 1, CFGFLAG_SERVER, "Whether players can pause their char or not", IConsole::CONSOLELEVEL_ADMIN)

View file

@ -120,33 +120,8 @@ void CBinds::SetDefaults()
// DDRace
if(!g_Config.m_ClDDRaceBinds)
return;
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('z', "emote 12");
Bind('x', "emote 14");
Bind('h', "emote 2");
Bind('m', "emote 5");
Bind(KEY_PAGEDOWN, "cl_show_entities 0");
Bind(KEY_PAGEUP, "cl_show_entities 1");
Bind(KEY_KP0, "say /emote normal 999999");
Bind(KEY_KP1, "say /emote happy 999999");
Bind(KEY_KP2, "say /emote angry 999999");
Bind(KEY_KP3, "say /emote pain 999999");
Bind(KEY_KP4, "say /emote surprise 999999");
Bind(KEY_KP5, "say /emote blink 999999");
if(g_Config.m_ClDDRaceBinds)
SetDDRaceBinds(false);
}
void CBinds::OnConsoleInit()
@ -270,3 +245,98 @@ void CBinds::ConfigSaveCallback(IConfig *pConfig, void *pUserData)
pConfig->WriteLine(aBuffer);
}
}
// 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('z', "emote 12");
Bind('x', "emote 14");
Bind('h', "emote 2");
Bind('m', "emote 5");
Bind(KEY_PAGEDOWN, "cl_show_entities 0");
Bind(KEY_PAGEUP, "cl_show_entities 1");
Bind(KEY_KP0, "say /emote normal 999999");
Bind(KEY_KP1, "say /emote happy 999999");
Bind(KEY_KP2, "say /emote angry 999999");
Bind(KEY_KP3, "say /emote pain 999999");
Bind(KEY_KP4, "say /emote surprise 999999");
Bind(KEY_KP5, "say /emote blink 999999");
Bind(KEY_MOUSE_3, "+spectate");
}
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('z')[0])
Bind('z', "emote 12");
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");
if(!Get(KEY_PAGEDOWN)[0])
Bind(KEY_PAGEDOWN, "cl_show_entities 0");
if(!Get(KEY_PAGEUP)[0])
Bind(KEY_PAGEUP, "cl_show_entities 1");
if(!Get(KEY_KP0)[0])
Bind(KEY_KP0, "say /emote normal 999999");
if(!Get(KEY_KP1)[0])
Bind(KEY_KP1, "say /emote happy 999999");
if(!Get(KEY_KP2)[0])
Bind(KEY_KP2, "say /emote angry 999999");
if(!Get(KEY_KP3)[0])
Bind(KEY_KP3, "say /emote pain 999999");
if(!Get(KEY_KP4)[0])
Bind(KEY_KP4, "say /emote surprise 999999");
if(!Get(KEY_KP5)[0])
Bind(KEY_KP5, "say /emote blink 999999");
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");
}
g_Config.m_ClDDRaceBindsSet = 1;
}

View file

@ -39,5 +39,9 @@ public:
virtual void OnConsoleInit();
virtual bool OnInput(IInput::CEvent Event);
// DDRace
void SetDDRaceBinds(bool FreeOnly);
};
#endif

View file

@ -1030,6 +1030,12 @@ void CMenus::RenderSettingsDDRace(CUIRect MainView)
Console()->ExecuteLine("rcon showothers 0", -1, IConsole::CONSOLELEVEL_USER, 0, 0);
}
MainView.HSplitTop(20.0f, &Button, &MainView);
if(DoButton_CheckBox(&g_Config.m_ClDDRaceBinds, Localize("Bind Free keys with DDRace pre-configured binds"), g_Config.m_ClDDRaceBinds, &Button))
{
g_Config.m_ClDDRaceBinds ^= 1;
}
MainView.HSplitTop(20.0f, &Button, &MainView);
if(DoButton_CheckBox(&g_Config.m_ClPredictOldHookthrough, Localize("Predict old Hook through tiles"), g_Config.m_ClPredictOldHookthrough, &Button))
{

View file

@ -290,6 +290,10 @@ void CGameClient::OnInit()
m_ServerMode = SERVERMODE_PURE;
m_DDRaceMsgSent = false;
// Set free binds to DDRace binds if it's active
if(!g_Config.m_ClDDRaceBindsSet && g_Config.m_ClDDRaceBinds)
gs_Binds.SetDDRaceBinds(true);
}
void CGameClient::DispatchInput()