From 2eaf02d234ab0287af9fbd41b50ca2015121cca7 Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Mon, 3 Feb 2020 19:42:37 +0100 Subject: [PATCH 01/11] Let Lua access spectators mobjs --- src/lua_playerlib.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 1dd4c45b5..9ce1fed9b 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -97,6 +97,10 @@ static int player_get(lua_State *L) lua_pushboolean(L, true); else if (fastcmp(field,"name")) lua_pushstring(L, player_names[plr-players]); + else if (fastcmp(field,"realmo")) + LUA_PushUserdata(L, plr->mo, META_MOBJ); + // Kept for backward-compatibility + // Should be fixed to work like "realmo" later else if (fastcmp(field,"mo")) { if (plr->spectator) @@ -396,7 +400,7 @@ static int player_set(lua_State *L) if (hud_running) return luaL_error(L, "Do not alter player_t in HUD rendering code!"); - if (fastcmp(field,"mo")) { + if (fastcmp(field,"mo") || fastcmp(field,"realmo")) { mobj_t *newmo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)); plr->mo->player = NULL; // remove player pointer from old mobj (newmo->player = plr)->mo = newmo; // set player pointer for new mobj, and set new mobj as the player's mobj From a9a0601c84bcddbef577a458ced27e652b4df44c Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 17 Feb 2020 16:37:13 -0800 Subject: [PATCH 02/11] Revert "Revert "Let the console open in menus"" This reverts commit 705cf9fd4078ce34857d98043023612e9205773c. --- src/console.c | 11 +---------- src/d_main.c | 15 +++++++-------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/console.c b/src/console.c index 59d2b3e6c..8746bf036 100644 --- a/src/console.c +++ b/src/console.c @@ -613,15 +613,6 @@ void CON_Ticker(void) con_tick++; con_tick &= 7; - // if the menu is open then close the console. - if (menuactive && con_destlines) - { - consoletoggle = false; - con_destlines = 0; - CON_ClearHUD(); - I_UpdateMouseGrab(); - } - // console key was pushed if (consoletoggle) { @@ -793,7 +784,7 @@ boolean CON_Responder(event_t *ev) // check other keys only if console prompt is active if (!consoleready && key < NUMINPUTS) // metzgermeister: boundary check!! { - if (bindtable[key]) + if (! menuactive && bindtable[key]) { COM_BufAddText(bindtable[key]); COM_BufAddText("\n"); diff --git a/src/d_main.c b/src/d_main.c index 2ff0042fd..149fb3071 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -188,14 +188,14 @@ void D_ProcessEvents(void) continue; } - // Menu input - if (M_Responder(ev)) - continue; // menu ate the event - // console input if (CON_Responder(ev)) continue; // ate the event + // Menu input + if (M_Responder(ev)) + continue; // menu ate the event + G_Responder(ev); } } @@ -502,13 +502,12 @@ static void D_Display(void) // vid size change is now finished if it was on... vid.recalc = 0; - // FIXME: draw either console or menu, not the two - if (gamestate != GS_TIMEATTACK) - CON_Drawer(); - M_Drawer(); // menu is drawn even on top of everything // focus lost moved to M_Drawer + if (gamestate != GS_TIMEATTACK) + CON_Drawer(); + // // wipe update // From b2733eba73146c9b87ebdcff26cc0e10d4107408 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 15 Feb 2020 17:08:07 -0800 Subject: [PATCH 03/11] Draw console in the Record/NiGHTS Attack menus (cherry picked from commit 4efd915d28d0f193528d141b04c5f88b84877f97) --- src/d_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 149fb3071..6b5164894 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -505,8 +505,7 @@ static void D_Display(void) M_Drawer(); // menu is drawn even on top of everything // focus lost moved to M_Drawer - if (gamestate != GS_TIMEATTACK) - CON_Drawer(); + CON_Drawer(); // // wipe update From b78fc670d0824e2054d102706813087d0086c331 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 17 Feb 2020 17:10:29 -0800 Subject: [PATCH 04/11] Don't let console open with menu keys while the menu is open --- src/d_main.c | 8 ++++---- src/m_menu.c | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 6b5164894..cff6b8805 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -188,14 +188,14 @@ void D_ProcessEvents(void) continue; } - // console input - if (CON_Responder(ev)) - continue; // ate the event - // Menu input if (M_Responder(ev)) continue; // menu ate the event + // console input + if (CON_Responder(ev)) + continue; // ate the event + G_Responder(ev); } } diff --git a/src/m_menu.c b/src/m_menu.c index dbe5d854f..687f87051 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3150,6 +3150,9 @@ boolean M_Responder(event_t *ev) if (gamestate == GS_TITLESCREEN && finalecount < TICRATE) return false; + if (CON_Ready()) + return false; + if (noFurtherInput) { // Ignore input after enter/escape/other buttons @@ -3509,6 +3512,7 @@ boolean M_Responder(event_t *ev) return false; default: + CON_Responder(ev); break; } From 400366802c2d77a31b40da5ff57f366ca197383b Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 20 Feb 2020 16:40:39 -0500 Subject: [PATCH 05/11] Make hook_FollowMobj a mobj hook instead of a player hook Makes more logical sense, as if you have a custom follow item for a custom skin, you probably want your new thinker to only run for your new MT_ and not the vanilla ones. --- src/lua_hooklib.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index f9dad6cb7..99f41aef1 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -142,6 +142,7 @@ static int lib_addHook(lua_State *L) case hook_HurtMsg: case hook_MobjMoveBlocked: case hook_MapThingSpawn: + case hook_FollowMobj: hook.s.mt = MT_NULL; if (lua_isnumber(L, 2)) hook.s.mt = lua_tonumber(L, 2); @@ -203,6 +204,7 @@ static int lib_addHook(lua_State *L) case hook_MobjRemoved: case hook_MobjMoveBlocked: case hook_MapThingSpawn: + case hook_FollowMobj: lastp = &mobjhooks[hook.s.mt]; break; case hook_JumpSpecial: @@ -210,7 +212,6 @@ static int lib_addHook(lua_State *L) case hook_SpinSpecial: case hook_JumpSpinSpecial: case hook_PlayerSpawn: - case hook_FollowMobj: case hook_PlayerCanDamage: case hook_TeamSwitch: case hook_ViewpointSwitch: @@ -1364,7 +1365,34 @@ boolean LUAh_FollowMobj(player_t *player, mobj_t *mobj) lua_settop(gL, 0); - for (hookp = playerhooks; hookp; hookp = hookp->next) + // Look for all generic mobj follow item hooks + for (hookp = mobjhooks[MT_NULL]; hookp; hookp = hookp->next) + { + if (hookp->type != hook_FollowMobj) + continue; + + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, player, META_PLAYER); + LUA_PushUserdata(gL, mobj, META_MOBJ); + } + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -3); + lua_pushvalue(gL, -3); + if (lua_pcall(gL, 2, 1, 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; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; + lua_pop(gL, 1); + } + + for (hookp = mobjhooks[mobj->type]; hookp; hookp = hookp->next) { if (hookp->type != hook_FollowMobj) continue; From 0f2b8b8b2cfb431d46468c5a71fad9d4d51d98c6 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 21 Feb 2020 20:04:28 -0800 Subject: [PATCH 06/11] Register servername etc. under NOMD5 This fixes crashes in the menus. --- src/mserv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mserv.c b/src/mserv.c index 4ddab05b9..c02a58f99 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -18,7 +18,7 @@ #include -#if (defined (NOMD5) || defined (NOMSERV)) && !defined (NONET) +#if (defined (NOMSERV)) && !defined (NONET) #define NONET #endif From 4c00e3309647d6ee4a7f370b514f72ef1cc57027 Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Sat, 22 Feb 2020 21:14:05 -0300 Subject: [PATCH 07/11] Oopsie --- src/p_user.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index 880d932af..9417f752d 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -384,6 +384,9 @@ void P_GiveFinishFlags(player_t *player) if (!player->mo) return; + if !(netgame||multiplayer) + return; + for (i = 0; i < 3; i++) { angle_t fa = (angle >> ANGLETOFINESHIFT) & FINEMASK; From ff8a62819b6de93b32d746b6f4cb3c737b7041c2 Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Sat, 22 Feb 2020 22:36:44 -0300 Subject: [PATCH 08/11] Oopsie 2 --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 9417f752d..9167d5345 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -384,7 +384,7 @@ void P_GiveFinishFlags(player_t *player) if (!player->mo) return; - if !(netgame||multiplayer) + if (!(netgame||multiplayer)) return; for (i = 0; i < 3; i++) From 94738bfd2d18d79698f60b40b04c6ceaad846529 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sun, 23 Feb 2020 19:28:16 -0300 Subject: [PATCH 09/11] Don't get chosen as the tagger if you're a spectator --- src/p_setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_setup.c b/src/p_setup.c index 7b4c6773b..eee90e03d 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3096,7 +3096,7 @@ static void P_InitTagGametype(void) //Also, you'd never have to loop through all 32 players slots to find anything ever again. for (i = 0; i < MAXPLAYERS; i++) { - if (playeringame[i] && !(players[i].spectator && players[i].quittime)) + if (playeringame[i] && !(players[i].spectator || players[i].quittime)) { playersactive[realnumplayers] = i; //stores the player's node in the array. realnumplayers++; From ce801e1076484ba85e9c8e5ae9c02a9c2b1df8b0 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 24 Feb 2020 16:57:56 -0500 Subject: [PATCH 10/11] Fix new skin colors using default chat color --- src/hu_stuff.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 74b68ce69..98f3ca5a9 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -787,10 +787,12 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) case SKINCOLOR_RED: case SKINCOLOR_CRIMSON: case SKINCOLOR_FLAME: + case SKINCOLOR_KETCHUP: cstart = "\x85"; // V_REDMAP break; case SKINCOLOR_YOGURT: case SKINCOLOR_BROWN: + case SKINCOLOR_BRONZE: case SKINCOLOR_TAN: case SKINCOLOR_BEIGE: case SKINCOLOR_QUAIL: @@ -818,6 +820,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) cstart = "\x8e"; // V_ROSYMAP break; case SKINCOLOR_SUNSET: + case SKINCOLOR_COPPER: case SKINCOLOR_APRICOT: case SKINCOLOR_ORANGE: case SKINCOLOR_RUST: @@ -831,6 +834,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) break; case SKINCOLOR_LIME: case SKINCOLOR_PERIDOT: + case SKINCOLOR_APPLE: cstart = "\x8b"; // V_PERIDOTMAP break; case SKINCOLOR_SEAFOAM: @@ -851,12 +855,14 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) case SKINCOLOR_BLUE: case SKINCOLOR_COBALT: case SKINCOLOR_DUSK: + case SKINCOLOR_BLUEBELL: cstart = "\x84"; // V_BLUEMAP break; case SKINCOLOR_BUBBLEGUM: case SKINCOLOR_MAGENTA: case SKINCOLOR_NEON: case SKINCOLOR_VIOLET: + case SKINCOLOR_RASPBERRY: cstart = "\x81"; // V_MAGENTAMAP break; } From fe931555783c4a1d552a041faf0ae34ad0d7d532 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Mon, 24 Feb 2020 20:03:08 -0300 Subject: [PATCH 11/11] Fix Amy cameo's love hearts crashing the Software renderer due to invalid translucency tables --- src/p_mobj.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 2bb2cc028..faee245d3 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8001,8 +8001,9 @@ static void P_MobjSceneryThink(mobj_t *mobj) } if (mobj->fuse < 0) return; - if ((--mobj->fuse) < 6) + if (mobj->fuse < 6) mobj->frame = (mobj->frame & ~FF_TRANSMASK) | ((10 - (mobj->fuse*2)) << (FF_TRANSSHIFT)); + mobj->fuse--; } break; case MT_FINISHFLAG: @@ -11594,7 +11595,7 @@ void P_AfterPlayerSpawn(INT32 playernum) if (CheckForReverseGravity) P_CheckGravity(mobj, false); - + if (p->pflags & PF_FINISHED) P_GiveFinishFlags(p); }