From 2c69d6164ea7748fc8bcfdf1242649c0417b2598 Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Mon, 7 Mar 2011 17:28:03 +0000 Subject: [PATCH] Added shorter aliases for a few key names (like KP_DOWNARROW) --- reaction/code/ui/ui_shared.c | 42 ++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/reaction/code/ui/ui_shared.c b/reaction/code/ui/ui_shared.c index d608937d..53791389 100644 --- a/reaction/code/ui/ui_shared.c +++ b/reaction/code/ui/ui_shared.c @@ -5209,6 +5209,44 @@ int BindingIDFromName(const char *name) char g_nameBind1[32]; char g_nameBind2[32]; +static void UI_KeyNumToShortStringBuf(int keynum, char* buf, int buflen) +{ + switch (keynum) + { + case K_DOWNARROW: + Q_strncpyz(buf, "Down", buflen); + return; + case K_KP_DOWNARROW: + Q_strncpyz(buf, "Num Down", buflen); + return; + + case K_UPARROW: + Q_strncpyz(buf, "Up", buflen); + return; + case K_KP_UPARROW: + Q_strncpyz(buf, "Num Up", buflen); + return; + + case K_LEFTARROW: + Q_strncpyz(buf, "Left", buflen); + return; + case K_KP_LEFTARROW: + Q_strncpyz(buf, "Num Left", buflen); + return; + + case K_RIGHTARROW: + Q_strncpyz(buf, "Right", buflen); + return; + case K_KP_RIGHTARROW: + Q_strncpyz(buf, "Num Right", buflen); + return; + + default: + DC->keynumToStringBuf(keynum, buf, buflen); + return; + } +} + void BindingFromName(const char *cvar) { int i, b1, b2; @@ -5220,12 +5258,12 @@ void BindingFromName(const char *cvar) if (b1 == -1) { break; } - DC->keynumToStringBuf(b1, g_nameBind1, 32); + UI_KeyNumToShortStringBuf(b1, g_nameBind1, 32); Q_strupr(g_nameBind1); b2 = g_bindings[i].bind2; if (b2 != -1) { - DC->keynumToStringBuf(b2, g_nameBind2, 32); + UI_KeyNumToShortStringBuf(b2, g_nameBind2, 32); Q_strupr(g_nameBind2); strcat(g_nameBind1, " or "); strcat(g_nameBind1, g_nameBind2);