Send IntermissionThinker and intermission hud hooks stagefailed.

This commit is contained in:
GoldenTails 2020-12-17 03:09:20 -06:00
parent aa54a04c9e
commit 43c21edcbd
5 changed files with 17 additions and 10 deletions

View file

@ -111,7 +111,7 @@ 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
UINT8 LUAh_PlayerCanDamage(player_t *player, mobj_t *mobj); // Hook for P_PlayerCanDamage
void LUAh_PlayerQuit(player_t *plr, kickreason_t reason); // Hook for player quitting
void LUAh_IntermissionThinker(void); // Hook for Y_Ticker
void LUAh_IntermissionThinker(boolean stagefailed); // Hook for Y_Ticker
boolean LUAh_TeamSwitch(player_t *player, int newteam, boolean fromspectators, boolean tryingautobalance, boolean tryingscramble); // Hook for team switching in... uh....
UINT8 LUAh_ViewpointSwitch(player_t *player, player_t *newdisplayplayer, boolean forced); // Hook for spy mode
boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend); // Hook for MT_NAMECHECK

View file

@ -1633,7 +1633,7 @@ void LUAh_PlayerQuit(player_t *plr, kickreason_t reason)
}
// Hook for Y_Ticker
void LUAh_IntermissionThinker(void)
void LUAh_IntermissionThinker(boolean failedstage)
{
hook_p hookp;
if (!gL || !(hooksAvailable[hook_IntermissionThinker/8] & (1<<(hook_IntermissionThinker%8))))
@ -1646,8 +1646,11 @@ void LUAh_IntermissionThinker(void)
if (hookp->type != hook_IntermissionThinker)
continue;
lua_pushboolean(gL, failedstage); // stagefailed
PushHook(gL, hookp);
if (lua_pcall(gL, 0, 0, 1)) {
lua_pushvalue(gL, -2); // stagefailed
if (lua_pcall(gL, 1, 0, 1)) {
if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1);

View file

@ -51,4 +51,4 @@ void LUAh_GameHUD(player_t *stplyr);
void LUAh_ScoresHUD(void);
void LUAh_TitleHUD(void);
void LUAh_TitleCardHUD(player_t *stplayr);
void LUAh_IntermissionHUD(void);
void LUAh_IntermissionHUD(boolean failedstage);

View file

@ -1386,7 +1386,7 @@ void LUAh_TitleCardHUD(player_t *stplayr)
hud_running = false;
}
void LUAh_IntermissionHUD(void)
void LUAh_IntermissionHUD(boolean failedstage)
{
if (!gL || !(hudAvailable & (1<<hudhook_intermission)))
return;
@ -1404,10 +1404,14 @@ void LUAh_IntermissionHUD(void)
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
I_Assert(lua_istable(gL, -1));
lua_remove(gL, -3); // pop HUD
lua_pushboolean(gL, failedstage); // stagefailed
lua_pushnil(gL);
while (lua_next(gL, -3) != 0) {
lua_pushvalue(gL, -3); // graphics library (HUD[1])
LUA_Call(gL, 1, 0, 1);
while (lua_next(gL, -4) != 0) {
lua_pushvalue(gL, -4); // graphics library (HUD[1])
lua_pushvalue(gL, -4); // stagefailed
LUA_Call(gL, 2, 0, 1);
}
lua_settop(gL, 0);
hud_running = false;

View file

@ -430,7 +430,7 @@ void Y_IntermissionDrawer(void)
else if (bgtile)
V_DrawPatchFill(bgtile);
LUAh_IntermissionHUD();
LUAh_IntermissionHUD(intertype == int_spec && stagefailed);
if (!LUA_HudEnabled(hud_intermissiontally))
goto skiptallydrawer;
@ -1021,7 +1021,7 @@ void Y_Ticker(void)
if (paused || P_AutoPause())
return;
LUAh_IntermissionThinker();
LUAh_IntermissionThinker(intertype == int_spec && stagefailed);
intertic++;