From 201d0fd0233e0fbeb00731f727c27933f54b4b27 Mon Sep 17 00:00:00 2001 From: Lugent <35547583+Lugent@users.noreply.github.com> Date: Sun, 12 Jan 2025 11:23:33 -0400 Subject: [PATCH 1/4] Make chat aware of team colors on normal chat plus custom team colors --- src/hu_stuff.c | 91 +++++++++++++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 38 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 9333a61d2..319157d14 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -590,6 +590,45 @@ static void Command_CSay_f(void) UINT8 spam_tokens[MAXPLAYERS] = { 1 }; // fill the buffer with 1 so the motd can be sent. tic_t spam_tics[MAXPLAYERS]; +static char *GetChatColorFromSkinColor(INT32 skincolor) +{ + const char *textcolor = NULL; + UINT16 chatcolor = skincolors[skincolor].chatcolor; + if (!chatcolor || chatcolor%0x1000 || chatcolor>V_INVERTMAP) + textcolor = "\x80"; + else if (chatcolor == V_MAGENTAMAP) + textcolor = "\x81"; + else if (chatcolor == V_YELLOWMAP) + textcolor = "\x82"; + else if (chatcolor == V_GREENMAP) + textcolor = "\x83"; + else if (chatcolor == V_BLUEMAP) + textcolor = "\x84"; + else if (chatcolor == V_REDMAP) + textcolor = "\x85"; + else if (chatcolor == V_GRAYMAP) + textcolor = "\x86"; + else if (chatcolor == V_ORANGEMAP) + textcolor = "\x87"; + else if (chatcolor == V_SKYMAP) + textcolor = "\x88"; + else if (chatcolor == V_PURPLEMAP) + textcolor = "\x89"; + else if (chatcolor == V_AQUAMAP) + textcolor = "\x8a"; + else if (chatcolor == V_PERIDOTMAP) + textcolor = "\x8b"; + else if (chatcolor == V_AZUREMAP) + textcolor = "\x8c"; + else if (chatcolor == V_BROWNMAP) + textcolor = "\x8d"; + else if (chatcolor == V_ROSYMAP) + textcolor = "\x8e"; + else if (chatcolor == V_INVERTMAP) + textcolor = "\x8f"; + return textcolor; +} + /** Receives a message, processing an ::XD_SAY command. * \sa DoSayCommand * \author Graue @@ -709,51 +748,27 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) { if (players[playernum].ctfteam == 1) // red { - cstart = "\x85"; - textcolor = "\x85"; + cstart = textcolor = GetChatColorFromSkinColor(skincolor_redteam); } else // blue { - cstart = "\x84"; - textcolor = "\x84"; + cstart = textcolor = GetChatColorFromSkinColor(skincolor_blueteam); } } else { - UINT16 chatcolor = skincolors[players[playernum].skincolor].chatcolor; - - if (!chatcolor || chatcolor%0x1000 || chatcolor>V_INVERTMAP) - cstart = "\x80"; - else if (chatcolor == V_MAGENTAMAP) - cstart = "\x81"; - else if (chatcolor == V_YELLOWMAP) - cstart = "\x82"; - else if (chatcolor == V_GREENMAP) - cstart = "\x83"; - else if (chatcolor == V_BLUEMAP) - cstart = "\x84"; - else if (chatcolor == V_REDMAP) - cstart = "\x85"; - else if (chatcolor == V_GRAYMAP) - cstart = "\x86"; - else if (chatcolor == V_ORANGEMAP) - cstart = "\x87"; - else if (chatcolor == V_SKYMAP) - cstart = "\x88"; - else if (chatcolor == V_PURPLEMAP) - cstart = "\x89"; - else if (chatcolor == V_AQUAMAP) - cstart = "\x8a"; - else if (chatcolor == V_PERIDOTMAP) - cstart = "\x8b"; - else if (chatcolor == V_AZUREMAP) - cstart = "\x8c"; - else if (chatcolor == V_BROWNMAP) - cstart = "\x8d"; - else if (chatcolor == V_ROSYMAP) - cstart = "\x8e"; - else if (chatcolor == V_INVERTMAP) - cstart = "\x8f"; + cstart = GetChatColorFromSkinColor(players[playernum].skincolor); + if (G_GametypeHasTeams()) + { + if (players[playernum].ctfteam == 1) // red + { + cstart = GetChatColorFromSkinColor(skincolor_redteam); + } + else // blue + { + cstart = GetChatColorFromSkinColor(skincolor_blueteam); + } + } } prefix = cstart; From db606d0111f627c8638b44c00e000a70cb1510cb Mon Sep 17 00:00:00 2001 From: Lugent <35547583+Lugent@users.noreply.github.com> Date: Sun, 12 Jan 2025 11:42:11 -0400 Subject: [PATCH 2/4] Fix bruh moment --- src/hu_stuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 319157d14..33d74f614 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -590,7 +590,7 @@ static void Command_CSay_f(void) UINT8 spam_tokens[MAXPLAYERS] = { 1 }; // fill the buffer with 1 so the motd can be sent. tic_t spam_tics[MAXPLAYERS]; -static char *GetChatColorFromSkinColor(INT32 skincolor) +static const char *GetChatColorFromSkinColor(INT32 skincolor) { const char *textcolor = NULL; UINT16 chatcolor = skincolors[skincolor].chatcolor; From 52b88d63fe538249fb863f20bea3b6d0802c23bc Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 18 Jan 2025 14:57:09 -0300 Subject: [PATCH 3/4] Make v.getSprite2Patch able to fallback to non-super sprites --- src/lua_hudlib.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index d2b3d9679..c8327658a 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -613,6 +613,10 @@ static int libd_getSprite2Patch(lua_State *L) if (super) j |= SPR2F_SUPER; + // If there is no "super" variation of this sprite, try with the normal one. + if (!P_IsValidSprite2(skins[i], j)) + j &= ~SPR2F_SUPER; + sprdef = P_GetSkinSpritedef(skins[i], j); // set frame number From 8f388ef9ae775651304d0fe205546c358fe73761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 19 Jan 2025 18:03:35 +0100 Subject: [PATCH 4/4] Remove redundant P_CyclePlayerMobjState function --- src/p_mobj.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index aa846a93c..5a508e008 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -178,27 +178,6 @@ static void P_CycleMobjState(mobj_t *mobj) } } -// -// P_CycleMobjState for players. -// -static void P_CyclePlayerMobjState(mobj_t *mobj) -{ - // state animations - P_CycleStateAnimation(mobj); - - // cycle through states, - // calling action functions at transitions - if (mobj->tics != -1) - { - mobj->tics--; - - // you can cycle through multiple states in a tic - if (!mobj->tics && mobj->state) - if (!P_SetMobjState(mobj, mobj->state->nextstate)) - return; // freed itself - } -} - // // P_SetPlayerMobjState // Returns true if the mobj is still present. @@ -3803,7 +3782,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj) } animonly: - P_CyclePlayerMobjState(mobj); + P_CycleMobjState(mobj); } static void CalculatePrecipFloor(precipmobj_t *mobj) @@ -10334,10 +10313,7 @@ void P_MobjThinker(mobj_t *mobj) } // Can end up here if a player dies. - if (mobj->player) - P_CyclePlayerMobjState(mobj); - else - P_CycleMobjState(mobj); + P_CycleMobjState(mobj); if (P_MobjWasRemoved(mobj)) return;