Rename KeyNumToString to KeyNumToName and vice-versa

This commit is contained in:
LJ Sonic 2021-08-15 15:24:23 +02:00
parent 5bc0ce7a62
commit 772695741c
5 changed files with 21 additions and 21 deletions

View file

@ -221,7 +221,7 @@ static void CONS_Bind_f(void)
for (key = 0; key < NUMINPUTS; key++)
if (bindtable[key])
{
CONS_Printf("%s : \"%s\"\n", G_KeyNumToString(key), bindtable[key]);
CONS_Printf("%s : \"%s\"\n", G_KeyNumToName(key), bindtable[key]);
na = 1;
}
if (!na)
@ -229,7 +229,7 @@ static void CONS_Bind_f(void)
return;
}
key = G_KeyStringToNum(COM_Argv(1));
key = G_KeyNameToNum(COM_Argv(1));
if (key <= 0 || key >= NUMINPUTS)
{
CONS_Alert(CONS_NOTICE, M_GetText("Invalid key name\n"));

View file

@ -624,7 +624,7 @@ void G_ClearAllControlKeys(void)
// Returns the name of a key (or virtual key for mouse and joy)
// the input value being an keynum
//
const char *G_KeyNumToString(INT32 keynum)
const char *G_KeyNumToName(INT32 keynum)
{
static char keynamestr[8];
@ -648,7 +648,7 @@ const char *G_KeyNumToString(INT32 keynum)
return keynamestr;
}
INT32 G_KeyStringToNum(const char *keystr)
INT32 G_KeyNameToNum(const char *keystr)
{
UINT32 j;
@ -811,10 +811,10 @@ void G_SaveKeySetting(FILE *f, INT32 (*fromcontrols)[2], INT32 (*fromcontrolsbis
for (i = 1; i < num_gamecontrols; i++)
{
fprintf(f, "setcontrol \"%s\" \"%s\"", gamecontrolname[i],
G_KeyNumToString(fromcontrols[i][0]));
G_KeyNumToName(fromcontrols[i][0]));
if (fromcontrols[i][1])
fprintf(f, " \"%s\"\n", G_KeyNumToString(fromcontrols[i][1]));
fprintf(f, " \"%s\"\n", G_KeyNumToName(fromcontrols[i][1]));
else
fprintf(f, "\n");
}
@ -822,10 +822,10 @@ void G_SaveKeySetting(FILE *f, INT32 (*fromcontrols)[2], INT32 (*fromcontrolsbis
for (i = 1; i < num_gamecontrols; i++)
{
fprintf(f, "setcontrol2 \"%s\" \"%s\"", gamecontrolname[i],
G_KeyNumToString(fromcontrolsbis[i][0]));
G_KeyNumToName(fromcontrolsbis[i][0]));
if (fromcontrolsbis[i][1])
fprintf(f, " \"%s\"\n", G_KeyNumToString(fromcontrolsbis[i][1]));
fprintf(f, " \"%s\"\n", G_KeyNumToName(fromcontrolsbis[i][1]));
else
fprintf(f, "\n");
}
@ -1001,8 +1001,8 @@ static void setcontrol(INT32 (*gc)[2])
CONS_Printf(M_GetText("Control '%s' unknown\n"), namectrl);
return;
}
keynum1 = G_KeyStringToNum(COM_Argv(2));
keynum2 = G_KeyStringToNum(COM_Argv(3));
keynum1 = G_KeyNameToNum(COM_Argv(2));
keynum2 = G_KeyNameToNum(COM_Argv(3));
keynum = G_FilterKeyByVersion(numctrl, 0, player, &keynum1, &keynum2, &nestedoverride);
if (keynum >= 0)

View file

@ -181,8 +181,8 @@ extern const INT32 gcl_jump_spin[num_gcl_jump_spin];
void G_MapEventsToControls(event_t *ev);
// returns the name of a key
const char *G_KeyNumToString(INT32 keynum);
INT32 G_KeyStringToNum(const char *keystr);
const char *G_KeyNumToName(INT32 keynum);
INT32 G_KeyNameToNum(const char *keystr);
// detach any keys associated to the given game control
void G_ClearControlKeys(INT32 (*setupcontrols)[2], INT32 control);

View file

@ -75,17 +75,17 @@ static int lib_joy2Axis(lua_State *L)
return 1;
}
static int lib_keyNumToString(lua_State *L)
static int lib_keyNumToName(lua_State *L)
{
int i = luaL_checkinteger(L, 1);
lua_pushstring(L, G_KeyNumToString(i));
lua_pushstring(L, G_KeyNumToName(i));
return 1;
}
static int lib_keyStringToNum(lua_State *L)
static int lib_keyNameToNum(lua_State *L)
{
const char *str = luaL_checkstring(L, 1);
lua_pushinteger(L, G_KeyStringToNum(str));
lua_pushinteger(L, G_KeyNameToNum(str));
return 1;
}
@ -133,8 +133,8 @@ static luaL_Reg lib[] = {
{"gameControl2ToKeyNum", lib_gameControl2ToKeyNum},
{"joyAxis", lib_joyAxis},
{"joy2Axis", lib_joy2Axis},
{"keyNumToString", lib_keyNumToString},
{"keyStringToNum", lib_keyStringToNum},
{"keyNumToName", lib_keyNumToName},
{"keyNameToNum", lib_keyNameToNum},
{"keyNumPrintable", lib_keyNumPrintable},
{"shiftKeyNum", lib_shiftKeyNum},
{"getMouseGrab", lib_getMouseGrab},
@ -184,7 +184,7 @@ static int keyevent_get(lua_State *L)
I_Assert(event != NULL);
if (fastcmp(field,"name"))
lua_pushstring(L, G_KeyNumToString(event->key));
lua_pushstring(L, G_KeyNumToName(event->key));
else if (fastcmp(field,"num"))
lua_pushinteger(L, event->key);
else if (fastcmp(field,"repeated"))

View file

@ -12826,13 +12826,13 @@ static void M_DrawControl(void)
else
{
if (keys[0] != KEY_NULL)
strcat (tmp, G_KeyNumToString (keys[0]));
strcat (tmp, G_KeyNumToName (keys[0]));
if (keys[0] != KEY_NULL && keys[1] != KEY_NULL)
strcat(tmp," or ");
if (keys[1] != KEY_NULL)
strcat (tmp, G_KeyNumToString (keys[1]));
strcat (tmp, G_KeyNumToName (keys[1]));
}