Merge remote-tracking branch 'remotes/pub/next' into v1

This commit is contained in:
wolfy852 2019-04-26 18:27:41 -05:00
commit 50b00d37e0
3 changed files with 31 additions and 0 deletions

View File

@ -51,6 +51,7 @@ enum hook {
hook_PlayerExplode, //SRB2KART
hook_PlayerSquish, //SRB2KART
hook_PlayerCmd, //SRB2KART
hook_IntermissionThinker, //SRB2KART
hook_MAX // last hook
};
@ -99,4 +100,6 @@ boolean LUAh_PlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source);
boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Allows to write to player cmd before the game does anything with them.
void LUAh_IntermissionThinker(void); // Hook for Y_Ticker
#endif

View File

@ -62,6 +62,7 @@ const char *const hookNames[hook_MAX+1] = {
"PlayerExplode",
"PlayerSquish",
"PlayerCmd",
"IntermissionThinker",
NULL
};
@ -420,6 +421,28 @@ void LUAh_ThinkFrame(void)
}
}
// Hook for Y_Ticker
void LUAh_IntermissionThinker(void)
{
hook_p hookp;
if (!gL || !(hooksAvailable[hook_IntermissionThinker/8] & (1<<(hook_IntermissionThinker%8))))
return;
for (hookp = roothook; hookp; hookp = hookp->next)
if (hookp->type == hook_IntermissionThinker)
{
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
if (lua_pcall(gL, 0, 0, 0)) {
if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1);
hookp->error = true;
}
}
}
// Hook for mobj collisions
UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which)
{

View File

@ -40,6 +40,7 @@
#include "g_input.h" // PLAYER1INPUTDOWN
#include "k_kart.h" // colortranslations
#include "console.h" // cons_menuhighlight
#include "lua_hook.h" // IntermissionThinker hook
#ifdef HWRENDER
#include "hardware/hw_main.h"
@ -574,6 +575,10 @@ void Y_Ticker(void)
if (paused || P_AutoPause())
return;
#ifdef HAVE_BLUA
LUAh_IntermissionThinker();
#endif
intertic++;
// Team scramble code for team match and CTF.