New intermission thinker hook
This commit is contained in:
parent
bf75a4c29f
commit
0f79396757
|
@ -50,6 +50,7 @@ enum hook {
|
||||||
hook_FollowMobj,
|
hook_FollowMobj,
|
||||||
hook_PlayerCanDamage,
|
hook_PlayerCanDamage,
|
||||||
hook_PlayerQuit,
|
hook_PlayerQuit,
|
||||||
|
hook_IntermissionThinker,
|
||||||
|
|
||||||
hook_MAX // last hook
|
hook_MAX // last hook
|
||||||
};
|
};
|
||||||
|
@ -91,5 +92,6 @@ boolean LUAh_MapThingSpawn(mobj_t *mo, mapthing_t *mthing); // Hook for P_SpawnM
|
||||||
boolean LUAh_FollowMobj(player_t *player, mobj_t *mobj); // Hook for P_PlayerAfterThink Smiles mobj-following
|
boolean LUAh_FollowMobj(player_t *player, mobj_t *mobj); // Hook for P_PlayerAfterThink Smiles mobj-following
|
||||||
UINT8 LUAh_PlayerCanDamage(player_t *player, mobj_t *mobj); // Hook for P_PlayerCanDamage
|
UINT8 LUAh_PlayerCanDamage(player_t *player, mobj_t *mobj); // Hook for P_PlayerCanDamage
|
||||||
void LUAh_PlayerQuit(player_t *plr, int reason); // Hook for player quitting
|
void LUAh_PlayerQuit(player_t *plr, int reason); // Hook for player quitting
|
||||||
|
void LUAh_IntermissionThinker(void); // Hook for Y_Ticker
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -61,6 +61,7 @@ const char *const hookNames[hook_MAX+1] = {
|
||||||
"FollowMobj",
|
"FollowMobj",
|
||||||
"PlayerCanDamage",
|
"PlayerCanDamage",
|
||||||
"PlayerQuit",
|
"PlayerQuit",
|
||||||
|
"IntermissionThinker",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1322,4 +1323,25 @@ void LUAh_PlayerQuit(player_t *plr, int reason)
|
||||||
lua_settop(gL, 0);
|
lua_settop(gL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
|
|
||||||
#include "m_cond.h" // condition sets
|
#include "m_cond.h" // condition sets
|
||||||
|
#include "lua_hook.h" // IntermissionThinker hook
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
#include "hardware/hw_main.h"
|
#include "hardware/hw_main.h"
|
||||||
|
@ -802,6 +803,10 @@ void Y_Ticker(void)
|
||||||
if (paused || P_AutoPause())
|
if (paused || P_AutoPause())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
LUAh_IntermissionThinker();
|
||||||
|
#endif
|
||||||
|
|
||||||
intertic++;
|
intertic++;
|
||||||
|
|
||||||
// Team scramble code for team match and CTF.
|
// Team scramble code for team match and CTF.
|
||||||
|
|
Loading…
Reference in New Issue