mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-20 18:01:16 +00:00
Merge branch 'key-hooks-no-return' into 'next'
Use return value of KeyDown and KeyUp hooks See merge request STJr/SRB2!1559
This commit is contained in:
commit
b597508c55
2 changed files with 12 additions and 12 deletions
|
@ -107,6 +107,7 @@ void LUA_HookInt(INT32 integer, int hook);
|
|||
void LUA_HookBool(boolean value, int hook);
|
||||
int LUA_HookPlayer(player_t *, int hook);
|
||||
int LUA_HookTiccmd(player_t *, ticcmd_t *, int hook);
|
||||
int LUA_HookKey(INT32 keycode, int hook); // Hooks for key events
|
||||
|
||||
void LUA_HookThinkFrame(void);
|
||||
int LUA_HookMobjLineCollide(mobj_t *, line_t *);
|
||||
|
@ -130,4 +131,3 @@ int LUA_HookPlayerCmd(player_t *, ticcmd_t *);
|
|||
int LUA_HookMusicChange(const char *oldname, struct MusicChange *);
|
||||
fixed_t LUA_HookPlayerHeight(player_t *player);
|
||||
int LUA_HookPlayerCanEnterSpinGaps(player_t *player);
|
||||
int LUA_HookKey(INT32 keycode, int hooktype); // Hooks for key events
|
||||
|
|
|
@ -588,6 +588,17 @@ int LUA_HookTiccmd(player_t *player, ticcmd_t *cmd, int hook_type)
|
|||
return hook.status;
|
||||
}
|
||||
|
||||
int LUA_HookKey(INT32 keycode, int hook_type)
|
||||
{
|
||||
Hook_State hook;
|
||||
if (prepare_hook(&hook, false, hook_type))
|
||||
{
|
||||
lua_pushinteger(gL, keycode);
|
||||
call_hooks(&hook, 1, 1, res_true);
|
||||
}
|
||||
return hook.status;
|
||||
}
|
||||
|
||||
/* =========================================================================
|
||||
SPECIALIZED HOOKS
|
||||
========================================================================= */
|
||||
|
@ -1088,14 +1099,3 @@ int LUA_HookPlayerCanEnterSpinGaps(player_t *player)
|
|||
}
|
||||
return hook.status;
|
||||
}
|
||||
|
||||
int LUA_HookKey(INT32 keycode, int hooktype)
|
||||
{
|
||||
Hook_State hook;
|
||||
if (prepare_hook(&hook, 0, hooktype))
|
||||
{
|
||||
lua_pushinteger(gL, keycode);
|
||||
call_hooks(&hook, 1, 0, res_true);
|
||||
}
|
||||
return hook.status;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue