From 60852cab0e2a6bec29a2aa8e430bdc4d336dfd58 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Tue, 17 Sep 2024 21:15:54 +0200 Subject: [PATCH 1/8] Fix command prompt issues on dedicated build on Windows --- src/dedicated/i_system.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index 1a1db8fb3..e5e6aa2cd 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -999,20 +999,8 @@ static void I_GetConsoleEvents(void) static void I_StartupConsole(void) { HANDLE ci, co; - const INT32 ded = M_CheckParm("-dedicated"); - BOOL gotConsole = FALSE; - if (M_CheckParm("-console") || ded) - gotConsole = AllocConsole(); -#ifdef _DEBUG - else if (M_CheckParm("-noconsole") && !ded) -#else - else if (!M_CheckParm("-console") && !ded) -#endif - { - FreeConsole(); - gotConsole = FALSE; - } - + BOOL gotConsole = AllocConsole(); + consolevent = !M_CheckParm("-noconsole"); if (gotConsole) { SetConsoleTitleA("SRB2 Console"); @@ -1040,12 +1028,7 @@ static inline void I_ShutdownConsole(void){} static void I_GetConsoleEvents(void){} static inline void I_StartupConsole(void) { -#ifdef _DEBUG consolevent = !M_CheckParm("-noconsole"); -#else - consolevent = M_CheckParm("-console"); -#endif - framebuffer = M_CheckParm("-framebuffer"); if (framebuffer) From 697509bd68642053fbd64d41119ad8b850329940 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Tue, 24 Sep 2024 23:26:54 +0200 Subject: [PATCH 2/8] Fix global mobj hooks deprecation warning always triggering --- src/lua_hooklib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 51ebe3938..1bf3caf65 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -498,7 +498,9 @@ static int call_string_hooks(Hook_State *hook) static int call_mobj_type_hooks(Hook_State *hook, mobjtype_t mobj_type) { - if (mobj_type == MT_NULL && ( + int numCalls = call_mapped(hook, &mobjHookIds[mobj_type][hook->hook_type]); + + if (numCalls > 0 && mobj_type == MT_NULL && ( hook->hook_type == MOBJ_HOOK(MobjThinker ) || hook->hook_type == MOBJ_HOOK(MobjCollide ) || hook->hook_type == MOBJ_HOOK(MobjLineCollide) @@ -514,7 +516,7 @@ static int call_mobj_type_hooks(Hook_State *hook, mobjtype_t mobj_type) mobjHookNames[hook->hook_type]) ); - return call_mapped(hook, &mobjHookIds[mobj_type][hook->hook_type]); + return numCalls; } static void call_hud_hooks From 209c545743376702e763cc385044f8a17ec51d21 Mon Sep 17 00:00:00 2001 From: UnmatchedBracket Date: Wed, 25 Sep 2024 13:44:22 -0600 Subject: [PATCH 3/8] fix quake epicenter for first person and awayviews --- src/r_main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 50293341d..dcb69b662 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1152,8 +1152,14 @@ void R_SetupFrame(player_t *player) if (quake.epicenter) { // Calculate 3D distance from epicenter, using the camera. - fixed_t xydist = R_PointToDist2(thiscam->x, thiscam->y, quake.epicenter->x, quake.epicenter->y); - fixed_t dist = R_PointToDist2(0, thiscam->z, xydist, quake.epicenter->z); + fixed_t xydist, dist; + if (r_viewmobj == NULL) { + xydist = R_PointToDist2(thiscam->x, thiscam->y, quake.epicenter->x, quake.epicenter->y); + dist = R_PointToDist2(0, thiscam->z, xydist, quake.epicenter->z); + } else { + xydist = R_PointToDist2(r_viewmobj->x, r_viewmobj->y, quake.epicenter->x, quake.epicenter->y); + dist = R_PointToDist2(0, r_viewmobj->z, xydist, quake.epicenter->z); + } // More effect closer to epicenter, outside of radius = no effect if (!quake.radius || dist > quake.radius) From 491c77bd767ddfa81f47cd60e4ebd203ae5e5e3b Mon Sep 17 00:00:00 2001 From: Unmatched Bracket <2755-UnmatchedBracket@users.noreply.git.do.srb2.org> Date: Wed, 25 Sep 2024 20:40:34 +0000 Subject: [PATCH 4/8] [quake fixes] Use P_MobjWasRemoved instead of checking against NULL per Zapony's suggestion --- src/r_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_main.c b/src/r_main.c index dcb69b662..32e3138eb 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1153,7 +1153,7 @@ void R_SetupFrame(player_t *player) if (quake.epicenter) { // Calculate 3D distance from epicenter, using the camera. fixed_t xydist, dist; - if (r_viewmobj == NULL) { + if (P_MobjWasRemoved(r_viewmobj)) { xydist = R_PointToDist2(thiscam->x, thiscam->y, quake.epicenter->x, quake.epicenter->y); dist = R_PointToDist2(0, thiscam->z, xydist, quake.epicenter->z); } else { From 438de82c69185469ca86bf70c1ad3f291ceb198b Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Fri, 27 Sep 2024 19:47:54 -0300 Subject: [PATCH 5/8] Fix TRNSLATE lumps being recognized as valid sprite names --- src/r_things.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/r_things.c b/src/r_things.c index 432b5e10b..50855e2fc 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -279,6 +279,14 @@ static boolean GetFramesAndRotationsFromShortLumpName( *ret_rotation2 = R_Char2Rotation(name[7]); if (*ret_frame2 >= 64 || *ret_rotation2 == 255) return false; + + // TRNSLATE is a valid but extremely unlikely sprite name: + // * The sprite name is "TRNS" + // * The frame is L, rotation A; mirrored to frame T, rotation E + // In the very unfortunate event that TRNSLATE is found between sprite lumps, + // this name check prevents it from being added as a sprite, when it actually isn't. + if (memcmp(name, "TRNSLATE", 8) == 0) + return false; } else { From 6dbcd2ba19a103da615125190d154b5348bd8997 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 29 Sep 2024 21:40:17 +0200 Subject: [PATCH 6/8] Fix buffer overflow when registering a dedicated build server on MS --- src/dedicated/i_threads.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dedicated/i_threads.c b/src/dedicated/i_threads.c index 6902e23a5..55c0a069e 100644 --- a/src/dedicated/i_threads.c +++ b/src/dedicated/i_threads.c @@ -157,7 +157,7 @@ void I_wake_all_cond(I_cond *anchor) pthread_mutex_lock(&thread_lock); if (*anchor == NULL) { - *anchor = malloc(sizeof(pthread_t)); + *anchor = malloc(sizeof(pthread_cond_t)); pthread_cond_init(*anchor, NULL); } pthread_mutex_unlock(&thread_lock); From a71257308e8ccd005f9876d746f587aae435e962 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Tue, 1 Oct 2024 20:30:01 -0300 Subject: [PATCH 7/8] Disallow any directories named LongSprites/ --- src/w_wad.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/w_wad.c b/src/w_wad.c index 4a6900113..4a1d44548 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -2657,7 +2657,8 @@ static lumpchecklist_t folderblacklist[] = { {"Lua/", 4}, {"SOC/", 4}, - {"Sprites/", 8}, + {"Sprites/", 8}, + {"LongSprites/", 12}, {"Textures/", 9}, {"Patches/", 8}, {"Flats/", 6}, From c833d73e3225df5f27b6905383d3b8087c66a22a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sat, 5 Oct 2024 11:28:03 +0200 Subject: [PATCH 8/8] Fix potential segfault when flat images has changed on netcode --- src/p_saveg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index aad7351f0..d6f8d23c5 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1501,13 +1501,13 @@ static void UnArchiveSectors(save_t *save_p) sectors[i].ceilingheight = P_ReadFixed(save_p); if (diff & SD_FLOORPIC) { - sectors[i].floorpic = P_AddLevelFlatRuntime((char *)save_p); - save_p += 8; + sectors[i].floorpic = P_AddLevelFlatRuntime((char *)&save_p->buf[save_p->pos]); + save_p->pos += 8; } if (diff & SD_CEILPIC) { - sectors[i].ceilingpic = P_AddLevelFlatRuntime((char *)save_p); - save_p += 8; + sectors[i].ceilingpic = P_AddLevelFlatRuntime((char *)&save_p->buf[save_p->pos]); + save_p->pos += 8; } if (diff & SD_LIGHT) sectors[i].lightlevel = P_ReadINT16(save_p);