From 7da8e2e776f16c62b842e1fa8af8e469b4f364a3 Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Tue, 19 Sep 2023 18:10:51 -0500 Subject: [PATCH 01/13] Make the Cheats Command Reflect UsedCheats --- src/netcode/d_netcmd.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/netcode/d_netcmd.c b/src/netcode/d_netcmd.c index 5afa95561..d40ffb90c 100644 --- a/src/netcode/d_netcmd.c +++ b/src/netcode/d_netcmd.c @@ -4615,15 +4615,28 @@ static void Command_Cheats_f(void) CV_ResetCheatNetVars(); return; } + else if (COM_CheckParm("on")) + { + if (!(server || (IsPlayerAdmin(consoleplayer)))) + CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n")); + else + G_SetUsedCheats(false); + return; + } + + if (usedCheats) + CONS_Printf(M_GetText("Cheats are enabled, the game cannot be saved.\n")); + else + CONS_Printf(M_GetText("Cheats are disabled, the game can be saved.\n")); if (CV_CheatsEnabled()) { - CONS_Printf(M_GetText("At least one CHEAT-marked variable has been changed -- Cheats are enabled.\n")); + CONS_Printf(M_GetText("At least one CHEAT-marked variable has been changed.\n")); if (server || (IsPlayerAdmin(consoleplayer))) CONS_Printf(M_GetText("Type CHEATS OFF to reset all cheat variables to default.\n")); } else - CONS_Printf(M_GetText("No CHEAT-marked variables are changed -- Cheats are disabled.\n")); + CONS_Printf(M_GetText("No CHEAT-marked variables are changed.\n")); } #ifdef _DEBUG From 5c2821fb107a0061889d01ad7726838accb9f5eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Tue, 29 Aug 2023 20:56:24 +0200 Subject: [PATCH 02/13] Fix faulty references when spawning mobjs --- src/p_mobj.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index 9ec667346..7a089a956 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10882,6 +10882,9 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...) // increment mobj reference, so we don't get a dangling reference in case MobjSpawn calls P_RemoveMobj mobj->thinker.references++; + if (!(mobj->flags & MF_NOTHINK)) + P_AddThinker(THINK_MOBJ, &mobj->thinker); + // DANGER! This can cause P_SpawnMobj to return NULL! // Avoid using P_RemoveMobj on the newly created mobj in "MobjSpawn" Lua hooks! status = LUA_HookMobj(mobj, MOBJ_HOOK(MobjSpawn)); From b808fde260e82f42b2706d1bfde3af540674087f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sat, 28 Oct 2023 14:25:31 +0200 Subject: [PATCH 03/13] Fix broken titlescreen for MT_ALTVIEWMAN mobjs --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 7a089a956..382e207d8 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10882,7 +10882,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...) // increment mobj reference, so we don't get a dangling reference in case MobjSpawn calls P_RemoveMobj mobj->thinker.references++; - if (!(mobj->flags & MF_NOTHINK)) + if (!(mobj->flags & MF_NOTHINK) || (titlemapinaction && mobj->type == MT_ALTVIEWMAN)) P_AddThinker(THINK_MOBJ, &mobj->thinker); // DANGER! This can cause P_SpawnMobj to return NULL! From 493a7db1ee9e4ed76eec510ba65040349507c5df Mon Sep 17 00:00:00 2001 From: Hanicef Date: Wed, 14 Feb 2024 21:54:28 +0100 Subject: [PATCH 04/13] Fix thinker being added twice to mobj --- src/p_mobj.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 382e207d8..d457847ff 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10867,9 +10867,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...) ))) mobj->flags2 |= MF2_DONTRESPAWN; - if (!(mobj->flags & MF_NOTHINK)) - P_AddThinker(THINK_MOBJ, &mobj->thinker); - if (type == MT_PLAYER) { // when spawning MT_PLAYER, set mobj->player before calling MobjSpawn hook to prevent P_RemoveMobj from succeeding on player mobj. @@ -10879,12 +10876,12 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...) va_end(args); } - // increment mobj reference, so we don't get a dangling reference in case MobjSpawn calls P_RemoveMobj - mobj->thinker.references++; - if (!(mobj->flags & MF_NOTHINK) || (titlemapinaction && mobj->type == MT_ALTVIEWMAN)) P_AddThinker(THINK_MOBJ, &mobj->thinker); + // increment mobj reference, so we don't get a dangling reference in case MobjSpawn calls P_RemoveMobj + mobj->thinker.references++; + // DANGER! This can cause P_SpawnMobj to return NULL! // Avoid using P_RemoveMobj on the newly created mobj in "MobjSpawn" Lua hooks! status = LUA_HookMobj(mobj, MOBJ_HOOK(MobjSpawn)); From 88bdc3e433476646b5c1f07cfe27c6d6e8c1ff8c Mon Sep 17 00:00:00 2001 From: Hanicef Date: Thu, 15 Feb 2024 18:36:28 +0100 Subject: [PATCH 05/13] Fix MOTD not being sent to players on first join --- 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 bb2b837fc..4b199f6b3 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -620,7 +620,7 @@ static void Command_CSay_f(void) DoSayCommand(0, 1, HU_CSAY); } -static tic_t spam_tokens[MAXPLAYERS]; +static tic_t spam_tokens[MAXPLAYERS] = { 1 }; // fill the buffer with 1 so the motd can be sent. static tic_t spam_tics[MAXPLAYERS]; /** Receives a message, processing an ::XD_SAY command. From 8f9b57df0aa0ba582e58feecdd002f24dde419c0 Mon Sep 17 00:00:00 2001 From: SteelT Date: Thu, 15 Feb 2024 15:53:42 -0500 Subject: [PATCH 06/13] Rename gr_allowclientshaders to gr_allowcustomshaders --- src/netcode/d_netcmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/netcode/d_netcmd.c b/src/netcode/d_netcmd.c index bb098e029..b1527748a 100644 --- a/src/netcode/d_netcmd.c +++ b/src/netcode/d_netcmd.c @@ -394,7 +394,7 @@ consvar_t cv_ps_descriptor = CVAR_INIT ("ps_descriptor", "Average", 0, ps_descri consvar_t cv_freedemocamera = CVAR_INIT("freedemocamera", "Off", CV_SAVE, CV_OnOff, NULL); // NOTE: this should be in hw_main.c, but we can't put it there as it breaks dedicated build -consvar_t cv_glallowshaders = CVAR_INIT ("gr_allowclientshaders", "On", CV_NETVAR, CV_OnOff, NULL); +consvar_t cv_glallowshaders = CVAR_INIT ("gr_allowcustomshaders", "On", CV_NETVAR, CV_OnOff, NULL); char timedemo_name[256]; boolean timedemo_csv; From 532abf927968f76eb0c6a887d536e27f894e1838 Mon Sep 17 00:00:00 2001 From: Arthur Date: Fri, 16 Feb 2024 12:48:28 -0500 Subject: [PATCH 07/13] dc_texheight must be (INT64) to prevent overflow and rendering softlock --- src/r_segs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_segs.c b/src/r_segs.c index 267c1d47d..453debeb6 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -441,7 +441,7 @@ static void R_DrawRepeatMaskedColumn(column_t *col, unsigned lengthcol) { while (sprtopscreen < sprbotscreen) { R_DrawMaskedColumn(col, lengthcol); - if ((INT64)sprtopscreen + dc_texheight*spryscale > (INT64)INT32_MAX) // prevent overflow + if ((INT64)sprtopscreen + (INT64)dc_texheight*spryscale > (INT64)INT32_MAX) // prevent overflow sprtopscreen = INT32_MAX; else sprtopscreen += dc_texheight*spryscale; From 7c257dc765424d8eaca52fcc00a0ecfba7f291e5 Mon Sep 17 00:00:00 2001 From: Arthur Date: Fri, 16 Feb 2024 19:47:15 -0500 Subject: [PATCH 08/13] This was nothing more crazy than a buffer wraparound. --- src/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/console.c b/src/console.c index 4143e5e06..0d296ca74 100644 --- a/src/console.c +++ b/src/console.c @@ -120,7 +120,7 @@ static void CONS_backcolor_Change(void); #ifdef macintosh #define CON_BUFFERSIZE 4096 // my compiler can't handle local vars >32k #else -#define CON_BUFFERSIZE 16384 +#define CON_BUFFERSIZE 32768 #endif static char con_buffer[CON_BUFFERSIZE]; From 6e109be0768b6f1d9b9c47dd22d6516d486f4771 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 17 Feb 2024 04:00:27 -0300 Subject: [PATCH 09/13] Fix #1193 --- src/hardware/hw_cache.c | 7 +------ src/p_setup.c | 6 +++--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 58e16d623..55a32114a 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -823,18 +823,13 @@ void HWR_GetRawFlat(lumpnum_t flatlumpnum) void HWR_GetLevelFlat(levelflat_t *levelflat) { - if (levelflat->type == LEVELFLAT_NONE) + if (levelflat->type == LEVELFLAT_NONE || levelflat->texture_id < 0) { HWR_SetCurrentTexture(NULL); return; } INT32 texturenum = texturetranslation[levelflat->texture_id]; - if (texturenum <= 0) - { - HWR_SetCurrentTexture(NULL); - return; - } GLMapTexture_t *grtex = &gl_flats[texturenum]; GLMipmap_t *grMipmap = &grtex->mipmap; diff --git a/src/p_setup.c b/src/p_setup.c index 1d985beb4..a39750003 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -585,17 +585,17 @@ Ploadflat (levelflat_t *levelflat, const char *flatname, boolean resize) // Look for a flat int texturenum = R_CheckFlatNumForName(levelflat->name); - if (texturenum <= 0) + if (texturenum < 0) { // If we can't find a flat, try looking for a texture! texturenum = R_CheckTextureNumForName(levelflat->name); - if (texturenum <= 0) + if (texturenum < 0) { // Use "not found" texture texturenum = R_CheckTextureNumForName("REDWALL"); // Give up? - if (texturenum <= 0) + if (texturenum < 0) { levelflat->type = LEVELFLAT_NONE; texturenum = -1; From 8962355d6cb654f58402156b9ab2731f51a42ab9 Mon Sep 17 00:00:00 2001 From: SteelT Date: Sat, 17 Feb 2024 13:04:29 -0500 Subject: [PATCH 10/13] Fix UPnP port mapping not working Despite UPNP_AddPortMapping returning sucess status, no port mapping would actually be added at all. And that's due to a memset call in the middle of the function. Wiping the IGDdatas struct, moving the memset to the start of the function fixes it and a port mapping is actually created/removed when a server is started/stopped. --- src/netcode/i_tcp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/netcode/i_tcp.c b/src/netcode/i_tcp.c index 6d9a2725a..96342d5c6 100644 --- a/src/netcode/i_tcp.c +++ b/src/netcode/i_tcp.c @@ -300,6 +300,10 @@ init_upnpc_once(struct upnpdata *upnpuserdata) int upnp_error = -2; int scope_id = 0; int status_code = 0; + + memset(&urls, 0, sizeof(struct UPNPUrls)); + memset(&data, 0, sizeof(struct IGDdatas)); + CONS_Printf(M_GetText("Looking for UPnP Internet Gateway Device\n")); devlist = upnpDiscoverDevices(deviceTypes, 500, NULL, NULL, 0, false, 2, &upnp_error, 0); if (devlist) @@ -327,8 +331,6 @@ init_upnpc_once(struct upnpdata *upnpuserdata) parserootdesc(descXML, descXMLsize, &data); free(descXML); descXML = NULL; - memset(&urls, 0, sizeof(struct UPNPUrls)); - memset(&data, 0, sizeof(struct IGDdatas)); GetUPNPUrls(&urls, &data, dev->descURL, status_code); I_AddExitFunc(I_ShutdownUPnP); } From 94c1ab7de267caa54ef72b42f9512fbea991e127 Mon Sep 17 00:00:00 2001 From: Arthur Date: Sat, 17 Feb 2024 14:12:39 -0500 Subject: [PATCH 11/13] Use floorz/ceilingz --- src/p_mobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 9ec667346..0fe850018 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2329,9 +2329,9 @@ boolean P_CheckDeathPitCollide(mobj_t *mo) if (mo->player && mo->player->pflags & PF_GODMODE) return false; - if (((mo->z <= mo->subsector->sector->floorheight + if (((mo->z <= mo->floorz && ((mo->subsector->sector->flags & MSF_TRIGGERSPECIAL_HEADBUMP) || !(mo->eflags & MFE_VERTICALFLIP)) && (mo->subsector->sector->flags & MSF_FLIPSPECIAL_FLOOR)) - || (mo->z + mo->height >= mo->subsector->sector->ceilingheight + || (mo->z + mo->height >= mo->ceilingz && ((mo->subsector->sector->flags & MSF_TRIGGERSPECIAL_HEADBUMP) || (mo->eflags & MFE_VERTICALFLIP)) && (mo->subsector->sector->flags & MSF_FLIPSPECIAL_CEILING))) && (mo->subsector->sector->damagetype == SD_DEATHPITTILT || mo->subsector->sector->damagetype == SD_DEATHPITNOTILT)) From 719169a625df0f9982b4528594c63c8cc1602773 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 17 Feb 2024 16:51:16 -0300 Subject: [PATCH 12/13] R_GenerateTexture: Fix translucent pixels being visible on empty pixels --- src/r_textures.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/r_textures.c b/src/r_textures.c index 0175a080e..59cc11413 100644 --- a/src/r_textures.c +++ b/src/r_textures.c @@ -193,6 +193,8 @@ static void R_DrawBlendColumnInCache(column_t *column, UINT8 *cache, texpatch_t { for (; dest < cache + position + count; source++, dest++, is_opaque++) { + if (originPatch->alpha <= ASTTextureBlendingThreshold[1] && !(*is_opaque)) + continue; *dest = ASTBlendPaletteIndexes(*dest, *source, originPatch->style, originPatch->alpha); *is_opaque = true; } @@ -237,6 +239,8 @@ static void R_DrawBlendFlippedColumnInCache(column_t *column, UINT8 *cache, texp { for (; dest < cache + position + count; --source, dest++, is_opaque++) { + if (originPatch->alpha <= ASTTextureBlendingThreshold[1] && !(*is_opaque)) + continue; *dest = ASTBlendPaletteIndexes(*dest, *source, originPatch->style, originPatch->alpha); *is_opaque = true; } From f51f9f63f035f1cc37879b2c70111e4df6ba0a69 Mon Sep 17 00:00:00 2001 From: Arthur Date: Sat, 17 Feb 2024 22:48:31 -0500 Subject: [PATCH 13/13] Update objectplace to ignore float argument and handle ZABSOLUTE --- src/m_cheat.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index e61db2c2e..36438a475 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -1098,15 +1098,23 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c fixed_t fheight = P_GetSectorFloorZAt(sec, mt->x << FRACBITS, mt->y << FRACBITS); mt->z = (UINT16)((player->mo->z - fheight)>>FRACBITS); } + mt->angle = (INT16)(FixedInt(AngleFixed(player->mo->angle))); - mt->options = (mt->z << ZSHIFT) | (UINT16)cv_opflags.value; + mt->options = (UINT16)cv_opflags.value; mt->scale = player->mo->scale; mt->spritexscale = player->mo->spritexscale; mt->spriteyscale = player->mo->spriteyscale; memset(mt->args, 0, NUMMAPTHINGARGS*sizeof(*mt->args)); memset(mt->stringargs, 0x00, NUMMAPTHINGSTRINGARGS*sizeof(*mt->stringargs)); mt->pitch = mt->roll = 0; + + // Ignore offsets + if (mt->type == MT_EMBLEM) + mt->args[1] = 1; + else + mt->args[0] = 1; + return mt; }