mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-24 13:21:20 +00:00
Make Lua use correct keynums for gamepad events
This commit is contained in:
parent
7c6b03f9ab
commit
be3e7e7edf
1 changed files with 8 additions and 2 deletions
|
@ -199,13 +199,19 @@ static int keyevent_get(lua_State *L)
|
|||
{
|
||||
event_t *event = *((event_t **)luaL_checkudata(L, 1, META_KEYEVENT));
|
||||
const char *field = luaL_checkstring(L, 2);
|
||||
INT32 keynum;
|
||||
|
||||
I_Assert(event != NULL);
|
||||
|
||||
if (event->type == ev_gamepad_up || event->type == ev_gamepad_down)
|
||||
keynum = event->key + KEY_GAMEPAD;
|
||||
else
|
||||
keynum = event->key;
|
||||
|
||||
if (fastcmp(field,"name"))
|
||||
lua_pushstring(L, G_KeyNumToName(event->key));
|
||||
lua_pushstring(L, G_KeyNumToName(keynum));
|
||||
else if (fastcmp(field,"num"))
|
||||
lua_pushinteger(L, event->key);
|
||||
lua_pushinteger(L, keynum);
|
||||
else if (fastcmp(field,"repeated"))
|
||||
lua_pushboolean(L, event->repeated);
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue