diff --git a/src/lua_hook.h b/src/lua_hook.h index 0d631aa4e..fa6df2ee9 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -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 diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 1665e36b0..130fc0a28 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -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); diff --git a/src/lua_hud.h b/src/lua_hud.h index 0a83b6de7..a7f17aab5 100644 --- a/src/lua_hud.h +++ b/src/lua_hud.h @@ -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); diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 862ab4423..3dacd121e 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -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<