mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-31 21:50:48 +00:00
Send a quitting
argument to the GameQuit Lua hook
This commit is contained in:
parent
bcf6823cbf
commit
59d2646593
6 changed files with 12 additions and 11 deletions
|
@ -3027,7 +3027,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||||
if (pnum == consoleplayer)
|
if (pnum == consoleplayer)
|
||||||
{
|
{
|
||||||
if (Playing())
|
if (Playing())
|
||||||
LUAh_GameQuit();
|
LUAh_GameQuit(false);
|
||||||
#ifdef DUMPCONSISTENCY
|
#ifdef DUMPCONSISTENCY
|
||||||
if (msg == KICK_MSG_CON_FAIL) SV_SavedGame();
|
if (msg == KICK_MSG_CON_FAIL) SV_SavedGame();
|
||||||
#endif
|
#endif
|
||||||
|
@ -3728,7 +3728,7 @@ static void HandleShutdown(SINT8 node)
|
||||||
{
|
{
|
||||||
(void)node;
|
(void)node;
|
||||||
if (Playing())
|
if (Playing())
|
||||||
LUAh_GameQuit();
|
LUAh_GameQuit(false);
|
||||||
D_QuitNetGame();
|
D_QuitNetGame();
|
||||||
CL_Reset();
|
CL_Reset();
|
||||||
D_StartTitle();
|
D_StartTitle();
|
||||||
|
@ -3744,7 +3744,7 @@ static void HandleTimeout(SINT8 node)
|
||||||
{
|
{
|
||||||
(void)node;
|
(void)node;
|
||||||
if (Playing())
|
if (Playing())
|
||||||
LUAh_GameQuit();
|
LUAh_GameQuit(false);
|
||||||
D_QuitNetGame();
|
D_QuitNetGame();
|
||||||
CL_Reset();
|
CL_Reset();
|
||||||
D_StartTitle();
|
D_StartTitle();
|
||||||
|
|
|
@ -3607,7 +3607,7 @@ static void Command_Playintro_f(void)
|
||||||
FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void)
|
FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void)
|
||||||
{
|
{
|
||||||
if (Playing())
|
if (Playing())
|
||||||
LUAh_GameQuit();
|
LUAh_GameQuit(true);
|
||||||
I_Quit();
|
I_Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4270,7 +4270,7 @@ void Command_ExitGame_f(void)
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
if (Playing())
|
if (Playing())
|
||||||
LUAh_GameQuit();
|
LUAh_GameQuit(false);
|
||||||
|
|
||||||
D_QuitNetGame();
|
D_QuitNetGame();
|
||||||
CL_Reset();
|
CL_Reset();
|
||||||
|
|
|
@ -117,6 +117,6 @@ boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend); // Hook for MT_
|
||||||
#endif
|
#endif
|
||||||
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
|
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
|
||||||
boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname); // Hook for whether a jingle of the given music should continue playing
|
boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname); // Hook for whether a jingle of the given music should continue playing
|
||||||
void LUAh_GameQuit(void); // Hook for game quitting
|
void LUAh_GameQuit(boolean quitting); // Hook for game quitting
|
||||||
boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Hook for building player's ticcmd struct (Ported from SRB2Kart)
|
boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Hook for building player's ticcmd struct (Ported from SRB2Kart)
|
||||||
boolean LUAh_MusicChange(const char *oldname, char *newname, UINT16 *mflags, boolean *looping, UINT32 *position, UINT32 *prefadems, UINT32 *fadeinms); // Hook for music changes
|
boolean LUAh_MusicChange(const char *oldname, char *newname, UINT16 *mflags, boolean *looping, UINT32 *position, UINT32 *prefadems, UINT32 *fadeinms); // Hook for music changes
|
|
@ -1846,7 +1846,7 @@ boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook for game quitting
|
// Hook for game quitting
|
||||||
void LUAh_GameQuit(void)
|
void LUAh_GameQuit(boolean quitting)
|
||||||
{
|
{
|
||||||
hook_p hookp;
|
hook_p hookp;
|
||||||
if (!gL || !(hooksAvailable[hook_GameQuit/8] & (1<<(hook_GameQuit%8))))
|
if (!gL || !(hooksAvailable[hook_GameQuit/8] & (1<<(hook_GameQuit%8))))
|
||||||
|
@ -1860,7 +1860,8 @@ void LUAh_GameQuit(void)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
PushHook(gL, hookp);
|
PushHook(gL, hookp);
|
||||||
if (lua_pcall(gL, 0, 0, 1)) {
|
lua_pushboolean(gL, quitting);
|
||||||
|
if (lua_pcall(gL, 1, 0, 1)) {
|
||||||
if (!hookp->error || cv_debug & DBG_LUA)
|
if (!hookp->error || cv_debug & DBG_LUA)
|
||||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||||
lua_pop(gL, 1);
|
lua_pop(gL, 1);
|
||||||
|
|
|
@ -6938,7 +6938,7 @@ static void M_UltimateCheat(INT32 choice)
|
||||||
{
|
{
|
||||||
(void)choice;
|
(void)choice;
|
||||||
if (Playing())
|
if (Playing())
|
||||||
LUAh_GameQuit();
|
LUAh_GameQuit(true);
|
||||||
I_Quit();
|
I_Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13373,7 +13373,7 @@ void M_QuitResponse(INT32 ch)
|
||||||
if (ch != 'y' && ch != KEY_ENTER)
|
if (ch != 'y' && ch != KEY_ENTER)
|
||||||
return;
|
return;
|
||||||
if (Playing())
|
if (Playing())
|
||||||
LUAh_GameQuit();
|
LUAh_GameQuit(true);
|
||||||
if (!(netgame || cv_debug))
|
if (!(netgame || cv_debug))
|
||||||
{
|
{
|
||||||
S_ResetCaptions();
|
S_ResetCaptions();
|
||||||
|
|
|
@ -1058,7 +1058,7 @@ void I_GetEvent(void)
|
||||||
break;
|
break;
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
if (Playing())
|
if (Playing())
|
||||||
LUAh_GameQuit();
|
LUAh_GameQuit(true);
|
||||||
I_Quit();
|
I_Quit();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue