From 2714940be992ba23d258d71371a4ddeda9560ab4 Mon Sep 17 00:00:00 2001 From: JugadorXEI Date: Tue, 3 Nov 2020 16:41:00 +0100 Subject: [PATCH 01/19] Polyobject and SPB 'lastlook' interaction fix --- src/p_polyobj.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 60c653b16..cdcf37d9f 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1042,6 +1042,10 @@ static void Polyobj_carryThings(polyobj_t *po, fixed_t dx, fixed_t dy) for (; mo; mo = mo->bnext) { + // lastlook is used by the SPB to determine targets, do not let it affect it + if (mo->type == MT_SPB) + continue; + if (mo->lastlook == pomovecount) continue; @@ -1286,6 +1290,10 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta, for (; mo; mo = mo->bnext) { + // lastlook is used by the SPB to determine targets, do not let it affect it + if (mo->type == MT_SPB) + continue; + if (mo->lastlook == pomovecount) continue; From 29d8e440550ee00d6cbdf14f75312ea58c781254 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 5 Nov 2020 20:00:21 -0800 Subject: [PATCH 02/19] Always allow access to the serverplayer --- src/dehacked.c | 7 +++---- src/lua_playerlib.c | 16 +++++++++++++++- src/lua_script.c | 8 ++++++++ src/lua_script.h | 1 + 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 00f4fa96d..101507511 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -9704,11 +9704,10 @@ static inline int lib_getenum(lua_State *L) lua_pushinteger(L, mapmusposition); return 1; } else if (fastcmp(word,"server")) { - if ((!multiplayer || !(netgame || demo.playback)) && !playeringame[serverplayer]) - return 0; - LUA_PushUserdata(L, &players[serverplayer], META_PLAYER); - return 1; + return LUA_PushServerPlayer(L); } else if (fastcmp(word,"consoleplayer")) { // Player controlling the console, basically our local player + if (consoleplayer == serverplayer) + return LUA_PushServerPlayer(L); if (consoleplayer < 0 || !playeringame[consoleplayer]) return 0; LUA_PushUserdata(L, &players[consoleplayer], META_PLAYER); diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 3aeeed734..c4c996e5e 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -27,17 +27,28 @@ static int lib_iteratePlayers(lua_State *L) { INT32 i = -1; + if (lua_gettop(L) < 2) { //return luaL_error(L, "Don't call players.iterate() directly, use it as 'for player in players.iterate do end'."); lua_pushcfunction(L, lib_iteratePlayers); return 1; } + lua_settop(L, 2); lua_remove(L, 1); // state is unused. + if (!lua_isnil(L, 1)) i = (INT32)(*((player_t **)luaL_checkudata(L, 1, META_PLAYER)) - players); - for (i++; i < MAXPLAYERS; i++) + + i++; + + if (i == serverplayer) + { + return LUA_PushServerPlayer(L); + } + + for (; i < MAXPLAYERS; i++) { if (!playeringame[i]) continue; @@ -46,6 +57,7 @@ static int lib_iteratePlayers(lua_State *L) LUA_PushUserdata(L, &players[i], META_PLAYER); return 1; } + return 0; } @@ -58,6 +70,8 @@ static int lib_getPlayer(lua_State *L) lua_Integer i = luaL_checkinteger(L, 2); if (i < 0 || i >= MAXPLAYERS) return luaL_error(L, "players[] index %d out of range (0 - %d)", i, MAXPLAYERS-1); + if (i == serverplayer) + return LUA_PushServerPlayer(L); if (!playeringame[i]) return 0; if (!players[i].mo) diff --git a/src/lua_script.c b/src/lua_script.c index 7c951efb3..ee49efcc1 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -367,6 +367,14 @@ void LUA_PushUserdata(lua_State *L, void *data, const char *meta) lua_remove(L, -2); // remove LREG_VALID } +int LUA_PushServerPlayer(lua_State *L) +{ + if ((!multiplayer || !(netgame || demo.playback)) && !playeringame[serverplayer]) + return 0; + LUA_PushUserdata(L, &players[serverplayer], META_PLAYER); + return 1; +} + // When userdata is freed, use this function to remove it from Lua. void LUA_InvalidateUserdata(void *data) { diff --git a/src/lua_script.h b/src/lua_script.h index b3ca16bc0..5e2e171f5 100644 --- a/src/lua_script.h +++ b/src/lua_script.h @@ -46,6 +46,7 @@ void LUA_DumpFile(const char *filename); #endif fixed_t LUA_EvalMath(const char *word); void LUA_PushUserdata(lua_State *L, void *data, const char *meta); +int LUA_PushServerPlayer(lua_State *L); void LUA_InvalidateUserdata(void *data); void LUA_InvalidateLevel(void); void LUA_InvalidateMapthings(void); From 9e586c348c3052325593287710141a752fdc7c82 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 5 Nov 2020 20:02:40 -0800 Subject: [PATCH 03/19] Allow accessing a player even if there is no mobj The worst part is you could've just saved the player userdata and accessed it later anyway while player.mo is nil. --- src/lua_playerlib.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index c4c996e5e..24bc6c480 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -52,8 +52,6 @@ static int lib_iteratePlayers(lua_State *L) { if (!playeringame[i]) continue; - if (!players[i].mo) - continue; LUA_PushUserdata(L, &players[i], META_PLAYER); return 1; } @@ -74,8 +72,6 @@ static int lib_getPlayer(lua_State *L) return LUA_PushServerPlayer(L); if (!playeringame[i]) return 0; - if (!players[i].mo) - return 0; LUA_PushUserdata(L, &players[i], META_PLAYER); return 1; } @@ -136,8 +132,6 @@ static int lib_iterateDisplayplayers(lua_State *L) if (i > splitscreen || !playeringame[displayplayers[i]]) return 0; // Stop! There are no more players for us to go through. There will never be a player gap in displayplayers. - if (!players[displayplayers[i]].mo) - continue; LUA_PushUserdata(L, &players[displayplayers[i]], META_PLAYER); lua_pushinteger(L, i); // push this to recall what number we were on for the next function call. I suppose this also means you can retrieve the splitscreen player number with 'for p, n in displayplayers.iterate'! return 2; @@ -158,8 +152,6 @@ static int lib_getDisplayplayers(lua_State *L) return 0; if (!playeringame[displayplayers[i]]) return 0; - if (!players[displayplayers[i]].mo) - return 0; LUA_PushUserdata(L, &players[displayplayers[i]], META_PLAYER); return 1; } From 7890c9b83a507a510ba75ebb026f53d6566c01f5 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 5 Nov 2020 20:05:04 -0800 Subject: [PATCH 04/19] Let access spectator mobj --- src/lua_playerlib.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 24bc6c480..5f034c29d 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -190,12 +190,7 @@ static int player_get(lua_State *L) else if (fastcmp(field,"name")) lua_pushstring(L, player_names[plr-players]); else if (fastcmp(field,"mo")) - { - if (plr->spectator) - lua_pushnil(L); - else - LUA_PushUserdata(L, plr->mo, META_MOBJ); - } + LUA_PushUserdata(L, plr->mo, META_MOBJ); else if (fastcmp(field,"cmd")) LUA_PushUserdata(L, &plr->cmd, META_TICCMD); else if (fastcmp(field,"playerstate")) From bb97e0805e2c6504bf3d28a2a96f5ebf9484d807 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 29 Dec 2019 20:59:48 -0800 Subject: [PATCH 05/19] Fuck magic numbers; COM_ flags for Lua commands! --- src/command.h | 7 +++++++ src/dehacked.c | 4 ++++ src/lua_consolelib.c | 15 +++++++++++---- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/command.h b/src/command.h index 0880065b2..3a4260ec3 100644 --- a/src/command.h +++ b/src/command.h @@ -20,6 +20,13 @@ // Command buffer & command execution //=================================== +/* Lua command registration flags. */ +enum +{ + COM_ADMIN = 1, + COM_SPLITSCREEN = 2, +}; + typedef void (*com_func_t)(void); void COM_AddCommand(const char *name, com_func_t func); diff --git a/src/dehacked.c b/src/dehacked.c index 00f4fa96d..ccda71625 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8685,6 +8685,10 @@ struct { {"BT_CUSTOM2",BT_CUSTOM2}, // Lua customizable {"BT_CUSTOM3",BT_CUSTOM3}, // Lua customizable + // Lua command registration flags + {"COM_ADMIN",COM_ADMIN}, + {"COM_SPLITSCREEN",COM_SPLITSCREEN}, + // cvflags_t {"CV_SAVE",CV_SAVE}, {"CV_CALL",CV_CALL}, diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 0c73459cb..081a5fab7 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -113,12 +113,12 @@ void COM_Lua_f(void) lua_rawgeti(gL, -1, 2); // push flags from command info table if (lua_isboolean(gL, -1)) - flags = (lua_toboolean(gL, -1) ? 1 : 0); + flags = (lua_toboolean(gL, -1) ? COM_ADMIN : 0); else flags = (UINT8)lua_tointeger(gL, -1); lua_pop(gL, 1); // pop flags - if (flags & 2) // flag 2: splitscreen player command. TODO: support 4P + if (flags & COM_SPLITSCREEN) // flag 2: splitscreen player command. TODO: support 4P { if (!splitscreen) { @@ -133,7 +133,7 @@ void COM_Lua_f(void) UINT8 argc; lua_pop(gL, 1); // pop command info table - if (flags & 1 && !server && !IsPlayerAdmin(playernum)) // flag 1: only server/admin can use this command. + if (flags & COM_ADMIN && !server && !IsPlayerAdmin(playernum)) // flag 1: only server/admin can use this command. { CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n")); return; @@ -187,7 +187,14 @@ static int lib_comAddCommand(lua_State *L) if (lua_gettop(L) >= 3) { // For the third argument, only take a boolean or a number. lua_settop(L, 3); - if (lua_type(L, 3) != LUA_TBOOLEAN) + if (lua_type(L, 3) == LUA_TBOOLEAN) + { + CONS_Alert(CONS_WARNING, + "Using a boolean is deprecated and will be removed.\n" + "Use \"COM_\" flags instead.\n" + ); + } + else luaL_checktype(L, 3, LUA_TNUMBER); } else From 933ee4e9618cfd51dccf633080b2ac6cda8b2ca7 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 29 Dec 2019 21:07:28 -0800 Subject: [PATCH 06/19] COM_LOCAL makes your commands NetXCmd free, FUCK NetXCmd --- src/command.h | 1 + src/dehacked.c | 1 + src/lua_consolelib.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/command.h b/src/command.h index 3a4260ec3..ae573a16c 100644 --- a/src/command.h +++ b/src/command.h @@ -25,6 +25,7 @@ enum { COM_ADMIN = 1, COM_SPLITSCREEN = 2, + COM_LOCAL = 4, }; typedef void (*com_func_t)(void); diff --git a/src/dehacked.c b/src/dehacked.c index ccda71625..af576554f 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8688,6 +8688,7 @@ struct { // Lua command registration flags {"COM_ADMIN",COM_ADMIN}, {"COM_SPLITSCREEN",COM_SPLITSCREEN}, + {"COM_LOCAL",COM_LOCAL}, // cvflags_t {"CV_SAVE",CV_SAVE}, diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 081a5fab7..5d45da533 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -128,7 +128,7 @@ void COM_Lua_f(void) playernum = displayplayers[1]; } - if (netgame) + if (netgame && !( flags & COM_LOCAL ))/* don't send local commands */ { // Send the command through the network UINT8 argc; lua_pop(gL, 1); // pop command info table From 9f54ad4ea3d5137bbcaf0bdc387c58713ac6d032 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 29 Dec 2019 21:09:07 -0800 Subject: [PATCH 07/19] Improve COM_AddCommand boolean deprecated warning --- src/lua_consolelib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 5d45da533..49ef6752b 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -190,8 +190,9 @@ static int lib_comAddCommand(lua_State *L) if (lua_type(L, 3) == LUA_TBOOLEAN) { CONS_Alert(CONS_WARNING, - "Using a boolean is deprecated and will be removed.\n" - "Use \"COM_\" flags instead.\n" + "Using a boolean for admin commands is " + "deprecated and will be removed.\n" + "Use \"COM_ADMIN\" instead.\n" ); } else From ab7ccbc5d58f7ea7506dedb0cf2f8e1106a2b242 Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Sat, 27 Jun 2020 15:30:23 +0200 Subject: [PATCH 08/19] Expose "server" and "dedicated" to Lua scripts Careful! Both are local variables and are always false for clients, and therefore should obviously not be used in anything gamelogic-related. --- src/dehacked.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index af576554f..2fae84160 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -9718,12 +9718,12 @@ static inline int lib_getenum(lua_State *L) return 0; LUA_PushUserdata(L, &players[consoleplayer], META_PLAYER); return 1; - /*} else if (fastcmp(word,"admin")) { - LUA_Deprecated(L, "admin", "IsPlayerAdmin(player)"); - if (!playeringame[adminplayers[0]] || IsPlayerAdmin(serverplayer)) - return 0; - LUA_PushUserdata(L, &players[adminplayers[0]], META_PLAYER); - return 1;*/ + } else if (fastcmp(word,"isserver")) { + lua_pushboolean(L, server); + return 1; + } else if (fastcmp(word, "isdedicatedserver")) { + lua_pushboolean(L, dedicated); + return 1; } else if (fastcmp(word,"gravity")) { lua_pushinteger(L, gravity); return 1; From 3e31bc9e45e9f165616390412db210d24035351c Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 20 Oct 2020 16:08:34 -0700 Subject: [PATCH 09/19] Add CV_Set, CV_SetValue, CV_StealthSet, CV_StealthSetValue and CV_AddValue to Lua CV_SetValue merged with CV_Set (same with CV_StealthSetValue and CV_StealthSet). --- src/lua_consolelib.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 49ef6752b..3869fdc72 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -444,6 +444,45 @@ static int lib_cvFindVar(lua_State *L) return 0; } +static int CVarSetFunction +( + lua_State *L, + void (*Set)(consvar_t *, const char *), + void (*SetValue)(consvar_t *, INT32) +){ + consvar_t *cvar = (consvar_t *)luaL_checkudata(L, 1, META_CVAR); + + switch (lua_type(L, 2)) + { + case LUA_TSTRING: + (*Set)(cvar, lua_tostring(L, 2)); + break; + case LUA_TNUMBER: + (*SetValue)(cvar, (INT32)lua_tonumber(L, 2)); + break; + default: + return luaL_typerror(L, 1, "string or number"); + } + + return 0; +} + +static int lib_cvSet(lua_State *L) +{ + return CVarSetFunction(L, CV_Set, CV_SetValue); +} + +static int lib_cvStealthSet(lua_State *L) +{ + return CVarSetFunction(L, CV_StealthSet, CV_StealthSetValue); +} + +static int lib_cvAddValue(lua_State *L) +{ + consvar_t *cvar = (consvar_t *)luaL_checkudata(L, 1, META_CVAR); + CV_AddValue(cvar, (INT32)luaL_checknumber(L, 2)); + return 0; +} // CONS_Printf for a single player // Use 'print' in baselib for a global message. @@ -483,8 +522,11 @@ static luaL_Reg lib[] = { {"COM_BufAddText", lib_comBufAddText}, {"COM_BufInsertText", lib_comBufInsertText}, {"CV_RegisterVar", lib_cvRegisterVar}, - {"CONS_Printf", lib_consPrintf}, {"CV_FindVar", lib_cvFindVar}, + {"CV_Set", lib_cvSet}, + {"CV_StealthSet", lib_cvStealthSet}, + {"CV_AddValue", lib_cvAddValue}, + {"CONS_Printf", lib_consPrintf}, {NULL, NULL} }; From a5db4ca572df07f5dc33a330a14342a958309e64 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 5 Nov 2020 21:04:25 -0800 Subject: [PATCH 10/19] PreThinkFrame and PostThinkFrame hooks Changes from 58dd578b094639405d452593562e0f8cb2b482ce, a36920808b74e068d582dda5a3b75bdf64246463, 41c902b819ac8fdef173c4ba76a8c50ad8107190, 60928db0e0b08fee7ceddd5515adf2246bb655c3. --- src/lua_hook.h | 4 ++++ src/lua_hooklib.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++ src/p_tick.c | 16 ++++++++++++++++ 3 files changed, 68 insertions(+) diff --git a/src/lua_hook.h b/src/lua_hook.h index 6af3941f1..bd2afebb4 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -20,7 +20,9 @@ enum hook { hook_MapChange, hook_MapLoad, hook_PlayerJoin, + hook_PreThinkFrame, hook_ThinkFrame, + hook_PostThinkFrame, hook_MobjSpawn, hook_MobjCollide, hook_MobjMoveCollide, @@ -64,7 +66,9 @@ extern boolean hook_cmd_running; // This is used by PlayerCmd and lua_playerlib void LUAh_MapChange(INT16 mapnumber); // Hook for map change (before load) void LUAh_MapLoad(void); // Hook for map load void LUAh_PlayerJoin(int playernum); // Hook for Got_AddPlayer +void LUAh_PreThinkFrame(void); // Hook for frame (before mobj and player thinkers) void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers) +void LUAh_PostThinkFrame(void); // Hook for frame (at end of tick, ie after overlays, precipitation, specials) boolean LUAh_MobjHook(mobj_t *mo, enum hook which); boolean LUAh_PlayerHook(player_t *plr, enum hook which); #define LUAh_MobjSpawn(mo) LUAh_MobjHook(mo, hook_MobjSpawn) // Hook for P_SpawnMobj by mobj type diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 41a436e01..90a13c6fa 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -31,7 +31,9 @@ const char *const hookNames[hook_MAX+1] = { "MapChange", "MapLoad", "PlayerJoin", + "PreThinkFrame", "ThinkFrame", + "PostThinkFrame", "MobjSpawn", "MobjCollide", "MobjMoveCollide", @@ -402,6 +404,29 @@ void LUAh_PlayerJoin(int playernum) lua_settop(gL, 0); } +// Hook for frame (before mobj and player thinkers) +void LUAh_PreThinkFrame(void) +{ + hook_p hookp; + if (!gL || !(hooksAvailable[hook_PreThinkFrame/8] & (1<<(hook_PreThinkFrame%8)))) + return; + + for (hookp = roothook; hookp; hookp = hookp->next) + { + if (hookp->type != hook_PreThinkFrame) + continue; + + 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 frame (after mobj and player thinkers) void LUAh_ThinkFrame(void) { @@ -423,6 +448,29 @@ void LUAh_ThinkFrame(void) } } +// Hook for frame (at end of tick, ie after overlays, precipitation, specials) +void LUAh_PostThinkFrame(void) +{ + hook_p hookp; + if (!gL || !(hooksAvailable[hook_PostThinkFrame/8] & (1<<(hook_PostThinkFrame%8)))) + return; + + for (hookp = roothook; hookp; hookp = hookp->next) + { + if (hookp->type != hook_PostThinkFrame) + continue; + + 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 Y_Ticker void LUAh_IntermissionThinker(void) { diff --git a/src/p_tick.c b/src/p_tick.c index 4cc6c9ba4..bf0344477 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -648,6 +648,10 @@ void P_Ticker(boolean run) #endif } +#ifdef HAVE_BLUA + LUAh_PreThinkFrame(); +#endif + for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) P_PlayerThink(&players[i]); @@ -779,6 +783,10 @@ void P_Ticker(boolean run) && --mapreset <= 1 && server) // Remember: server uses it for mapchange, but EVERYONE ticks down for the animation D_MapChange(gamemap, gametype, encoremode, true, 0, false, false); + +#ifdef HAVE_BLUA + LUAh_PostThinkFrame(); +#endif } // Always move the camera. @@ -809,6 +817,10 @@ void P_PreTicker(INT32 frames) { P_MapStart(); +#ifdef HAVE_BLUA + LUAh_PreThinkFrame(); +#endif + for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) { @@ -843,6 +855,10 @@ void P_PreTicker(INT32 frames) P_UpdateSpecials(); P_RespawnSpecials(); +#ifdef HAVE_BLUA + LUAh_PostThinkFrame(); +#endif + P_MapEnd(); } } From 5921d17cc044a430fc998bd88d1f056b48a426cd Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Sat, 14 Dec 2019 15:28:24 -0600 Subject: [PATCH 11/19] Added PlayerThink hook --- src/lua_hook.h | 2 ++ src/lua_hooklib.c | 2 ++ src/p_user.c | 20 +++++++++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/lua_hook.h b/src/lua_hook.h index bd2afebb4..3f2dfd7a5 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -46,6 +46,7 @@ enum hook { hook_HurtMsg, hook_PlayerSpawn, hook_PlayerQuit, + hook_PlayerThink, hook_MusicChange, hook_ShouldSpin, //SRB2KART hook_ShouldExplode, //SRB2KART @@ -110,5 +111,6 @@ boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Allows to write to p void LUAh_IntermissionThinker(void); // Hook for Y_Ticker void LUAh_VoteThinker(void); // Hook for Y_VoteTicker +#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink #endif diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 90a13c6fa..e9a4d0b40 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -57,6 +57,7 @@ const char *const hookNames[hook_MAX+1] = { "HurtMsg", "PlayerSpawn", "PlayerQuit", + "PlayerThink", "MusicChange", "ShouldSpin", "ShouldExplode", @@ -208,6 +209,7 @@ static int lib_addHook(lua_State *L) case hook_SpinSpecial: case hook_JumpSpinSpecial: case hook_PlayerSpawn: + case hook_PlayerThink: lastp = &playerhooks; break; case hook_LinedefExecute: diff --git a/src/p_user.c b/src/p_user.c index cb6b7bd62..dc22bd940 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8244,7 +8244,12 @@ void P_PlayerThink(player_t *player) player->playerstate = PST_REBORN; } if (player->playerstate == PST_REBORN) + { +#ifdef HAVE_BLUA + LUAh_PlayerThink(player); +#endif return; + } } #ifdef SEENAMES @@ -8368,7 +8373,12 @@ void P_PlayerThink(player_t *player) P_DoTimeOver(player); if (player->playerstate == PST_DEAD) + { +#ifdef HAVE_BLUA + LUAh_PlayerThink(player); +#endif return; + } } } @@ -8432,7 +8442,9 @@ void P_PlayerThink(player_t *player) else player->mo->flags2 &= ~MF2_SHADOW; P_DeathThink(player); - +#ifdef HAVE_BLUA + LUAh_PlayerThink(player); +#endif return; } @@ -8566,6 +8578,12 @@ void P_PlayerThink(player_t *player) } else P_MovePlayer(player); + } + +#ifdef HAVE_BLUA + LUAh_PlayerThink(player); +#endif + if (!player->mo) return; // P_MovePlayer removed player->mo. From a9e851bcf50f193bdc6379a0f4a01ad62ff2fc14 Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Sat, 28 Dec 2019 17:40:47 -0600 Subject: [PATCH 12/19] Execute LUAh_PlayerThink(player) at the end if the player has a valid mobj_t object --- src/p_user.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index dc22bd940..6f00e410f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8580,13 +8580,13 @@ void P_PlayerThink(player_t *player) P_MovePlayer(player); } -#ifdef HAVE_BLUA - LUAh_PlayerThink(player); -#endif - - if (!player->mo) + { +#ifdef HAVE_BLUA + LUAh_PlayerThink(player); +#endif return; // P_MovePlayer removed player->mo. + } // Unset statis flags after moving. // In other words, if you manually set stasis via code, @@ -8782,6 +8782,10 @@ void P_PlayerThink(player_t *player) K_KartPlayerThink(player, cmd); // SRB2kart +#ifdef HAVE_BLUA + LUAh_PlayerThink(player); +#endif + /* // Colormap verification { From 130a1ccc983d23b37e6ac01c2712546014c3b818 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 5 Nov 2020 22:18:41 -0800 Subject: [PATCH 13/19] :V --- src/p_user.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 6f00e410f..8d5536338 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8578,7 +8578,6 @@ void P_PlayerThink(player_t *player) } else P_MovePlayer(player); - } if (!player->mo) { From d6c497065e246fef85aab86f1d32b217caf5f305 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 7 Nov 2020 19:47:50 -0500 Subject: [PATCH 14/19] Use FixedHypot over P_AproxDistance Not convinced that the small speed benefit from P_AproxDistance is worth the "aproximate"[sic] results it gives. Let's instead try a define to replace it with FixedHypot. In Lua, the function gives a deprecated warning. Inspired by the hyperwall fix for vanilla, except for everything. From little testing, actively improves waypoint checks, bumping, speed checks, wall collisions, Jawz targetting, Lightning Shield attacks, so on. The only way I see this as a potential downgrade is A_Look (and related functions) getting slower, which are barely used in Kart. --- src/lua_baselib.c | 3 ++- src/p_maputl.c | 13 ------------- src/p_maputl.h | 2 +- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 56b1a5a54..c50f53dfc 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -238,7 +238,8 @@ static int lib_pAproxDistance(lua_State *L) fixed_t dx = luaL_checkfixed(L, 1); fixed_t dy = luaL_checkfixed(L, 2); //HUDSAFE - lua_pushfixed(L, P_AproxDistance(dx, dy)); + LUA_Deprecated(L, "P_AproxDistance", "FixedHypot"); + lua_pushfixed(L, FixedHypot(dx, dy)); return 1; } diff --git a/src/p_maputl.c b/src/p_maputl.c index 260eb3ec6..760e45c4f 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -23,19 +23,6 @@ #include "p_slopes.h" #include "z_zone.h" -// -// P_AproxDistance -// Gives an estimation of distance (not exact) -// -fixed_t P_AproxDistance(fixed_t dx, fixed_t dy) -{ - dx = abs(dx); - dy = abs(dy); - if (dx < dy) - return dx + dy - (dx>>1); - return dx + dy - (dy>>1); -} - // // P_ClosestPointOnLine // Finds the closest point on a given line to the supplied point diff --git a/src/p_maputl.h b/src/p_maputl.h index be69e0265..ec4a4aa33 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -41,7 +41,7 @@ typedef boolean (*traverser_t)(intercept_t *in); boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2, INT32 pflags, traverser_t ptrav); -FUNCMATH fixed_t P_AproxDistance(fixed_t dx, fixed_t dy); +#define P_AproxDistance(dx, dy) FixedHypot(dx, dy) void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result); void P_ClosestPointOnLine3D(fixed_t x, fixed_t y, fixed_t z, line_t *line, vertex_t *result); INT32 P_PointOnLineSide(fixed_t x, fixed_t y, line_t *line); From 104208fc84b0f03f9f8b25a3068083cf1498e81d Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 7 Nov 2020 23:56:46 -0500 Subject: [PATCH 15/19] Use R_PointToDist2 instead Apparently overflows less often --- src/lua_baselib.c | 4 ++-- src/p_maputl.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index c50f53dfc..73295a139 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -238,8 +238,8 @@ static int lib_pAproxDistance(lua_State *L) fixed_t dx = luaL_checkfixed(L, 1); fixed_t dy = luaL_checkfixed(L, 2); //HUDSAFE - LUA_Deprecated(L, "P_AproxDistance", "FixedHypot"); - lua_pushfixed(L, FixedHypot(dx, dy)); + LUA_Deprecated(L, "P_AproxDistance", "R_PointToDist2"); + lua_pushfixed(L, R_PointToDist2(0, 0, dx, dy)); return 1; } diff --git a/src/p_maputl.h b/src/p_maputl.h index ec4a4aa33..5be618d8f 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -41,7 +41,7 @@ typedef boolean (*traverser_t)(intercept_t *in); boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2, INT32 pflags, traverser_t ptrav); -#define P_AproxDistance(dx, dy) FixedHypot(dx, dy) +#define P_AproxDistance(dx, dy) R_PointToDist2(0, 0, dx, dy) void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result); void P_ClosestPointOnLine3D(fixed_t x, fixed_t y, fixed_t z, line_t *line, vertex_t *result); INT32 P_PointOnLineSide(fixed_t x, fixed_t y, line_t *line); From c23364db1210c0ae5d37b8c23e8b943bcda1e33f Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 8 Nov 2020 00:45:16 -0500 Subject: [PATCH 16/19] Actually, lets just fix FixedHypot instead. Now FixedHypot uses the code from R_PointToDist2, and R_PointToDist2 just calls FixedHypot. Ultimately, this branch was intended to get rid of a redundant way to retrieve distance and replace it with the one that was actually good at its job. So consolidating FixedHypot and R_PointToDist2 together is just an extension of that. --- src/lua_baselib.c | 4 ++-- src/m_fixed.c | 40 ++++++++++++++++++++++++++++------------ src/p_maputl.h | 2 +- src/r_main.c | 24 +----------------------- 4 files changed, 32 insertions(+), 38 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 73295a139..c50f53dfc 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -238,8 +238,8 @@ static int lib_pAproxDistance(lua_State *L) fixed_t dx = luaL_checkfixed(L, 1); fixed_t dy = luaL_checkfixed(L, 2); //HUDSAFE - LUA_Deprecated(L, "P_AproxDistance", "R_PointToDist2"); - lua_pushfixed(L, R_PointToDist2(0, 0, dx, dy)); + LUA_Deprecated(L, "P_AproxDistance", "FixedHypot"); + lua_pushfixed(L, FixedHypot(dx, dy)); return 1; } diff --git a/src/m_fixed.c b/src/m_fixed.c index 7241be9c0..3724144f7 100644 --- a/src/m_fixed.c +++ b/src/m_fixed.c @@ -18,8 +18,10 @@ #define HAVE_SQRTF #endif #endif + #include "doomdef.h" #include "m_fixed.h" +#include "tables.h" // ANGLETOFINESHIFT #ifdef __USE_C_FIXEDMUL__ @@ -105,20 +107,34 @@ fixed_t FixedSqrt(fixed_t x) fixed_t FixedHypot(fixed_t x, fixed_t y) { - fixed_t ax, yx, yx2, yx1; - if (abs(y) > abs(x)) // |y|>|x| + // Moved the code from R_PointToDist2 to here, + // since R_PointToDist2 did the same thing, + // except less prone to overflowing. + + angle_t angle; + fixed_t dist; + + x = abs(x); + y = abs(y); + + if (y > x) { - ax = abs(y); // |y| => ax - yx = FixedDiv(x, y); // (x/y) + fixed_t temp; + + temp = x; + x = y; + y = temp; } - else // |x|>|y| - { - ax = abs(x); // |x| => ax - yx = FixedDiv(y, x); // (x/y) - } - yx2 = FixedMul(yx, yx); // (x/y)^2 - yx1 = FixedSqrt(1 * FRACUNIT + yx2); // (1 + (x/y)^2)^1/2 - return FixedMul(ax, yx1); // |x|*((1 + (x/y)^2)^1/2) + + if (!y) + return x; + + angle = (tantoangle[FixedDiv(y, x)>>DBITS] + ANGLE_90) >> ANGLETOFINESHIFT; + + // use as cosine + dist = FixedDiv(x, FINESINE(angle)); + + return dist; } vector2_t *FV2_Load(vector2_t *vec, fixed_t x, fixed_t y) diff --git a/src/p_maputl.h b/src/p_maputl.h index 5be618d8f..ec4a4aa33 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -41,7 +41,7 @@ typedef boolean (*traverser_t)(intercept_t *in); boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2, INT32 pflags, traverser_t ptrav); -#define P_AproxDistance(dx, dy) R_PointToDist2(0, 0, dx, dy) +#define P_AproxDistance(dx, dy) FixedHypot(dx, dy) void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result); void P_ClosestPointOnLine3D(fixed_t x, fixed_t y, fixed_t z, line_t *line, vertex_t *result); INT32 P_PointOnLineSide(fixed_t x, fixed_t y, line_t *line); diff --git a/src/r_main.c b/src/r_main.c index 5f3639ded..a78cd57eb 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -393,29 +393,7 @@ angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y) fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1) { - angle_t angle; - fixed_t dx, dy, dist; - - dx = abs(px1 - px2); - dy = abs(py1 - py2); - - if (dy > dx) - { - fixed_t temp; - - temp = dx; - dx = dy; - dy = temp; - } - if (!dy) - return dx; - - angle = (tantoangle[FixedDiv(dy, dx)>>DBITS] + ANGLE_90) >> ANGLETOFINESHIFT; - - // use as cosine - dist = FixedDiv(dx, FINESINE(angle)); - - return dist; + return FixedHypot(px1 - px2, py1 - py2); } // Little extra utility. Works in the same way as R_PointToAngle2 From 1a3e883b4ef657cbad3a61c9c44295176735f286 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 24 Nov 2020 19:32:01 -0800 Subject: [PATCH 17/19] Lua: "defrosting" global to tell how many tics are processing in the preticker --- src/dehacked.c | 3 +++ src/lua_hook.h | 1 + src/lua_script.c | 2 ++ src/p_tick.c | 8 ++++++-- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 39fc94144..d509cd499 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -9687,6 +9687,9 @@ static inline int lib_getenum(lua_State *L) } else if (fastcmp(word,"leveltime")) { lua_pushinteger(L, leveltime); return 1; + } else if (fastcmp(word,"defrosting")) { + lua_pushinteger(L, hook_defrosting); + return 1; } else if (fastcmp(word,"curWeather")) { lua_pushinteger(L, curWeather); return 1; diff --git a/src/lua_hook.h b/src/lua_hook.h index 3f2dfd7a5..a17a7ac78 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -63,6 +63,7 @@ enum hook { extern const char *const hookNames[]; extern boolean hook_cmd_running; // This is used by PlayerCmd and lua_playerlib to prevent anything from being wirtten to player while we run PlayerCmd. +extern int hook_defrosting; void LUAh_MapChange(INT16 mapnumber); // Hook for map change (before load) void LUAh_MapLoad(void); // Hook for map load diff --git a/src/lua_script.c b/src/lua_script.c index ee49efcc1..5aff53808 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -35,6 +35,8 @@ lua_State *gL = NULL; +int hook_defrosting; + // List of internal libraries to load from SRB2 static lua_CFunction liblist[] = { LUA_EnumLib, // global metatable for enums diff --git a/src/p_tick.c b/src/p_tick.c index bf0344477..6a85027f6 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -807,13 +807,15 @@ void P_Ticker(boolean run) // Abbreviated ticker for pre-loading, calls thinkers and assorted things void P_PreTicker(INT32 frames) { - INT32 i,framecnt; + INT32 i; ticcmd_t temptic; for (i = 0; i <= splitscreen; i++) postimgtype[i] = postimg_none; - for (framecnt = 0; framecnt < frames; ++framecnt) + hook_defrosting = frames; + + while (hook_defrosting) { P_MapStart(); @@ -860,5 +862,7 @@ void P_PreTicker(INT32 frames) #endif P_MapEnd(); + + hook_defrosting--; } } From 3be489f6dd41ea2dae76e38ed3d781ac090c8a7b Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 21 Apr 2017 23:37:14 +0100 Subject: [PATCH 18/19] Fix crash on loading level without a header. (cherry picked from commit 7556b407b247a9bfb9420781b8fa1ac4facce07d) --- src/g_game.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/g_game.c b/src/g_game.c index d9d7b7f12..c51f63cdc 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4714,6 +4714,9 @@ char *G_BuildMapTitle(INT32 mapnum) if (mapnum == 0) return Z_StrDup("Random"); + if (!mapheaderinfo[mapnum-1]) + P_AllocMapHeader(mapnum-1); + if (strcmp(mapheaderinfo[mapnum-1]->lvlttl, "")) { size_t len = 1; From 35b83ead37bd9df46973314b5fb3c287f2c5ee95 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Wed, 7 Apr 2021 03:16:27 -0400 Subject: [PATCH 19/19] Mines lost their fullbright between inception and v1 release I got so mad about this I brought the fix to v1 also --- src/info.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/info.c b/src/info.c index d639b617e..887baa85c 100644 --- a/src/info.c +++ b/src/info.c @@ -2715,14 +2715,14 @@ state_t states[NUMSTATES] = {SPR_RETI, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_NULL}, // S_PLAYERRETICULE - {SPR_SSMN, 0, 30, {NULL}, 0, 0, S_SSMINE2}, // S_SSMINE1 - {SPR_SSMN, 3, 3, {NULL}, 0, 0, S_SSMINE3}, // S_SSMINE2 - {SPR_SSMN, 2, 3, {NULL}, 0, 0, S_SSMINE4}, // S_SSMINE3 - {SPR_SSMN, 1, 3, {NULL}, 0, 0, S_SSMINE1}, // S_SSMINE4 + {SPR_SSMN, 0, 30, {NULL}, 0, 0, S_SSMINE2}, // S_SSMINE1 + {SPR_SSMN, 3|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_SSMINE3}, // S_SSMINE2 + {SPR_SSMN, 2|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_SSMINE4}, // S_SSMINE3 + {SPR_SSMN, 1|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_SSMINE1}, // S_SSMINE4 {SPR_SSMN, 4, 1, {NULL}, 0, 0, S_SSMINE_SHIELD2}, // S_SSMINE_SHIELD1 - {SPR_SSMN, 5, 1, {NULL}, 0, 0, S_SSMINE_SHIELD1}, // S_SSMINE_SHIELD2 - {SPR_SSMN, 4, 1, {NULL}, 0, 0, S_SSMINE_AIR2}, // S_SSMINE_AIR1 - {SPR_SSMN, 5, 1, {NULL}, 0, 0, S_SSMINE_AIR1}, // S_SSMINE_AIR2 + {SPR_SSMN, 5|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_SSMINE_SHIELD1}, // S_SSMINE_SHIELD2 + {SPR_SSMN, 4, 1, {NULL}, 0, 0, S_SSMINE_AIR2}, // S_SSMINE_AIR1 + {SPR_SSMN, 5, 1, {NULL}, 0, 0, S_SSMINE_AIR1}, // S_SSMINE_AIR2 {SPR_SSMN, 6, 3, {NULL}, 0, 0, S_SSMINE_DEPLOY2}, // S_SSMINE_DEPLOY1 {SPR_SSMN, 7, 5, {NULL}, 0, 0, S_SSMINE_DEPLOY3}, // S_SSMINE_DEPLOY2 {SPR_SSMN, 8, 7, {NULL}, 0, 0, S_SSMINE_DEPLOY4}, // S_SSMINE_DEPLOY3 @@ -2731,14 +2731,14 @@ state_t states[NUMSTATES] = {SPR_SSMN, 9, 1, {NULL}, 0, 0, S_SSMINE_DEPLOY7}, // S_SSMINE_DEPLOY6 {SPR_SSMN, 10, 3, {NULL}, 0, 0, S_SSMINE_DEPLOY8}, // S_SSMINE_DEPLOY7 {SPR_SSMN, 11, 1, {A_PlaySound}, sfx_cdfm39, 1, S_SSMINE_DEPLOY9}, // S_SSMINE_DEPLOY8 - {SPR_SSMN, 10, 1, {NULL}, 0, 0, S_SSMINE_DEPLOY10}, // S_SSMINE_DEPLOY9 - {SPR_SSMN, 11, 3, {NULL}, 0, 0, S_SSMINE_DEPLOY11}, // S_SSMINE_DEPLOY10 - {SPR_SSMN, 12, 3, {NULL}, 0, 0, S_SSMINE_DEPLOY12}, // S_SSMINE_DEPLOY11 - {SPR_SSMN, 13, 3, {NULL}, 0, 0, S_SSMINE_DEPLOY13}, // S_SSMINE_DEPLOY12 - {SPR_SSMN, 14, 3, {NULL}, 0, 0, S_SSMINE1}, // S_SSMINE_DEPLOY13 - {SPR_SSMN, 3, 1, {A_MineExplode}, MT_MINEEXPLOSION, 0, S_NULL}, // S_SSMINE_EXPLODE + {SPR_SSMN, 10, 1, {NULL}, 0, 0, S_SSMINE_DEPLOY10}, // S_SSMINE_DEPLOY9 + {SPR_SSMN, 11, 3, {NULL}, 0, 0, S_SSMINE_DEPLOY11}, // S_SSMINE_DEPLOY10 + {SPR_SSMN, 12, 3, {NULL}, 0, 0, S_SSMINE_DEPLOY12}, // S_SSMINE_DEPLOY11 + {SPR_SSMN, 13, 3, {NULL}, 0, 0, S_SSMINE_DEPLOY13}, // S_SSMINE_DEPLOY12 + {SPR_SSMN, 14, 3, {NULL}, 0, 0, S_SSMINE1}, // S_SSMINE_DEPLOY13 + {SPR_SSMN, 3, 1, {A_MineExplode}, MT_MINEEXPLOSION, 0, S_NULL}, // S_SSMINE_EXPLODE {SPR_NULL, 0, 6, {NULL}, 0, 0, S_MINEEXPLOSION2}, // S_MINEEXPLOSION1 - {SPR_NULL, 1, 22, {A_ForceStop}, 0, 0, S_NULL}, // S_MINEEXPLOSION2 + {SPR_NULL, 1, 22, {A_ForceStop}, 0, 0, S_NULL}, // S_MINEEXPLOSION2 {SPR_KRBM, FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_QUICKBOOM2}, // S_QUICKBOOM1 {SPR_KRBM, FF_FULLBRIGHT|1, 1, {NULL}, 0, 0, S_QUICKBOOM3}, // S_QUICKBOOM2