From 0fad3c882b915a9eb8d03f73a0a7a5a733958ee1 Mon Sep 17 00:00:00 2001 From: Oni Date: Fri, 31 Mar 2023 09:42:17 +0000 Subject: [PATCH 01/10] Merge branch 'increase-minz' into 'master' Increase MINZ from 4 fracunits to 16 See merge request KartKrew/Kart!1122 --- src/r_things.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_things.cpp b/src/r_things.cpp index e5309cf3a..7a909f395 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -52,7 +52,7 @@ #include "k_kart.h" #include "r_fps.h" -#define MINZ (FRACUNIT*4) +#define MINZ (FRACUNIT*16) #define BASEYCENTER (BASEVIDHEIGHT/2) typedef struct From 3d188777acb53b044964333c334f26f6350efa41 Mon Sep 17 00:00:00 2001 From: Wumbo <58399748+WumboSpasm@users.noreply.github.com> Date: Fri, 3 Oct 2025 21:47:26 -0400 Subject: [PATCH 02/10] Fix player start zpos being ignored on UDMF maps --- src/p_mobj.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index b4ed6b795..73467b127 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -12600,11 +12600,13 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) if (mthing) { + fixed_t offset = udmf ? mthing->z << FRACBITS : 0; + // Setting the spawnpoint's args[0] will make the player start on the ceiling // Objectflip inverts if (!!(mthing->args[0]) ^ !!(mthing->options & MTF_OBJECTFLIP)) { - z = ceiling - mobjinfo[MT_PLAYER].height; + z = ceiling - mobjinfo[MT_PLAYER].height - offset; if (mthing->options >> ZSHIFT) z -= ((mthing->options >> ZSHIFT) << FRACBITS); if (p->respawn) @@ -12612,7 +12614,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) } else { - z = floor; + z = floor + offset; if (mthing->options >> ZSHIFT) z += ((mthing->options >> ZSHIFT) << FRACBITS); if (p->respawn) From b4be36df23e50e321bcfb814bc36a21d8ec9cc3c Mon Sep 17 00:00:00 2001 From: Wumbo <58399748+WumboSpasm@users.noreply.github.com> Date: Sat, 4 Oct 2025 00:07:12 -0400 Subject: [PATCH 03/10] Fix lap split icon position --- src/k_hud.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/k_hud.c b/src/k_hud.c index 37e5f13a3..72a8ecdbb 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -5282,7 +5282,7 @@ static void K_drawLapSplitTimestamp(void) ahead >= 0 ? "-" : "+" ); - V_DrawMappedPatch(TIME_X - 8, TIME_Y + 3, splitflags, faceprefix[skin][FACE_MINIMAP], skincolor); + V_DrawMappedPatch(TIME_X, TIME_Y + 10, splitflags, faceprefix[skin][FACE_MINIMAP], skincolor); } } @@ -5352,11 +5352,11 @@ static void K_drawLapSplitComparison(void) INT32 stwidth = V_StringWidth(buffer, splitflags) / 2; // vibes offset - V_DrawMappedPatch(row_position[0] - stwidth - 35, row_position[1], splitflags, faceprefix[skin][FACE_MINIMAP], skincolor); + V_DrawMappedPatch(row_position[0] - stwidth, row_position[1] + 4, splitflags, faceprefix[skin][FACE_MINIMAP], skincolor); if (pos > 1) { - V_DrawPingNum(row_position[0] - stwidth - 35, row_position[1], splitflags, pos, NULL); + V_DrawPingNum(row_position[0] - stwidth, row_position[1], splitflags, pos, NULL); } // vibes offset TWO From c17f5672f645919b533d7d0e0df2bf818e5f7e54 Mon Sep 17 00:00:00 2001 From: Wumbo <58399748+WumboSpasm@users.noreply.github.com> Date: Sat, 4 Oct 2025 13:30:15 -0400 Subject: [PATCH 04/10] Improve appearance of followers in player setup menu - Ground followers now animate correctly and bounce once again - Improved positioning of followers within the blue box --- src/m_menu.c | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index a853a0a15..01950b113 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -7151,12 +7151,35 @@ void MD_DrawCssCharacter(void) // draw their follower if there is one if (cv_dummyfollower.value > -1) { - // animate the follower + follower_t fl = followers[cv_dummyfollower.value]; // shortcut for our sanity + + tic_t bobspeed = fl.bobspeed; + if (fl.mode == FOLLOWERMODE_GROUND) + bobspeed = FixedDiv(bobspeed*FRACUNIT, fl.bobamp / 6); // rough approximation of bounce speed + + // smooth floating, totally not stolen from rocket sneakers. + fixed_t sine = FixedMul(fl.bobamp, FINESINE(((FixedMul(4 * M_TAU_FIXED, bobspeed) * followertimer)>>ANGLETOFINESHIFT) & FINEMASK)); follower_tics -= renderdeltatics; + + // restart the ground follower's animation when it lands on the "ground" + if (fl.mode == FOLLOWERMODE_GROUND) + { + // this sucks + fixed_t sine_next = FixedMul(fl.bobamp, FINESINE(((FixedMul(4 * M_TAU_FIXED, bobspeed) * (followertimer + 1))>>ANGLETOFINESHIFT) & FINEMASK)); + if ((sine > 0) != (sine_next > 0)) + { + st = fl.followstate; + if (st != S_NULL) + follower_state = &states[st]; + follower_tics = follower_state->tics*FRACUNIT; + follower_frame = follower_state->frame & FF_FRAMEMASK; // get spritedef + } + } + + // animate the follower if (follower_tics <= 0) { - // FF_ANIMATE; cycle through FRAMES and get back afterwards. This will be prominent amongst followers hence why it's being supported here. if (follower_state->frame & FF_ANIMATE) { @@ -7171,14 +7194,12 @@ void MD_DrawCssCharacter(void) if (st != S_NULL) follower_state = &states[st]; follower_tics = follower_state->tics*FRACUNIT; - // get spritedef: - follower_frame = follower_state->frame & FF_FRAMEMASK; + follower_frame = follower_state->frame & FF_FRAMEMASK; // get spritedef } } sprdef = &sprites[follower_state->sprite]; // draw the follower - if (follower_frame >= sprdef->numframes) follower_frame = 0; // frame doesn't exist, we went beyond it... what? sprframe = &sprdef->spriteframes[follower_frame]; @@ -7189,22 +7210,13 @@ void MD_DrawCssCharacter(void) // draw follower sprite { // Fake the follower's in game appearance by now also applying some of its variables! coolio, eh? - follower_t fl = followers[cv_dummyfollower.value]; // shortcut for our sanity - - tic_t bobspeed = fl.bobspeed; - if (fl.mode == FOLLOWERMODE_GROUND) - bobspeed = FixedDiv(bobspeed, fl.bobamp / 6); // Rough approximation of bounce speed - - // smooth floating, totally not stolen from rocket sneakers. - fixed_t sine = FixedMul(fl.bobamp, FINESINE(((FixedMul(4 * M_TAU_FIXED, bobspeed) * followertimer)>>ANGLETOFINESHIFT) & FINEMASK)); - UINT16 color = K_GetEffectiveFollowerColor(cv_followercolor[setupplayer].value, &fl, cv_dummycolor.value, &skins[skintodisplay]); colormap = R_GetTranslationColormap(TC_DEFAULT, color, 0); // why does GTC_MENUCACHE not work here...? INT32 x = (mx+65)*FRACUNIT; - INT32 y = ((my+100)*FRACUNIT); + INT32 y = ((my+105)*FRACUNIT); if (fl.mode == FOLLOWERMODE_GROUND) - y += 40*FRACUNIT - abs(sine) * 2; // Bounce animation + y += 40*FRACUNIT - FixedMul(abs(sine), max(2*FRACUNIT, (fl.bobamp*2)/3)); // bounce animation else y += sine; From 3a486311ca58dace870a4221565ebba50a0d5996 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Sun, 5 Oct 2025 13:37:50 -0400 Subject: [PATCH 05/10] Revert "Inline P_PointOnLineSide" This reverts commit 8f624e664ed841c603519e831107b5cee6a052ee. --- src/p_maputl.c | 13 ++++++++++++- src/p_maputl.h | 13 +------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index 3f318bf2e..e2d08a930 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -103,6 +103,17 @@ void P_ClosestPointOnLine3D(const vector3_t *p, const vector3_t *Line, vector3_t return; } +// +// P_PointOnLineSide +// Returns 0 or 1 +// +INT32 P_PointOnLineSide(fixed_t x, fixed_t y, const line_t *line) +{ + // use cross product to determine side quickly + INT64 v = ((INT64)y - line->v1->y) * line->dx - ((INT64)x - line->v1->x) * line->dy; + return v > 0; +} + // // P_BoxOnLineSide // Considers the line to be infinite @@ -140,7 +151,7 @@ INT32 P_BoxOnLineSide(const fixed_t *tmbox, const line_t *ld) // P_PointOnDivlineSide // Returns 0 or 1. // -FUNCMATH FUNCINLINE static ATTRINLINE INT32 P_PointOnDivlineSide(fixed_t x, fixed_t y, const divline_t *line) +static INT32 P_PointOnDivlineSide(fixed_t x, fixed_t y, const divline_t *line) { // use cross product to determine side quickly INT64 v = ((INT64)y - line->y) * line->dx - ((INT64)x - line->x) * line->dy; diff --git a/src/p_maputl.h b/src/p_maputl.h index b117b73f6..698bd878d 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -48,18 +48,7 @@ boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2, #define P_AproxDistance(dx, dy) FixedHypot(dx, dy) void P_ClosestPointOnLine(fixed_t x, fixed_t y, const line_t *line, vertex_t *result); void P_ClosestPointOnLine3D(const vector3_t *p, const vector3_t *line, vector3_t *result); - -// -// P_PointOnLineSide -// Returns 0 or 1 -// -FUNCMATH FUNCINLINE static ATTRINLINE INT32 P_PointOnLineSide(fixed_t x, fixed_t y, const line_t *line) -{ - // use cross product to determine side quickly - INT64 v = ((INT64)y - line->v1->y) * line->dx - ((INT64)x - line->v1->x) * line->dy; - return v > 0; -} - +INT32 P_PointOnLineSide(fixed_t x, fixed_t y, const line_t *line); void P_MakeDivline(const line_t *li, divline_t *dl); struct opening_t From 186fa924cf4fb575785ba8a5db8630b0f9103fd2 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Sun, 5 Oct 2025 13:37:57 -0400 Subject: [PATCH 06/10] Revert "Optimize line checks on line interception" This reverts commit bd9924b794ed5e7b89f04278d295c937a31b8afb. --- src/p_maputl.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index e2d08a930..0c03f61f1 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -107,11 +107,15 @@ void P_ClosestPointOnLine3D(const vector3_t *p, const vector3_t *Line, vector3_t // P_PointOnLineSide // Returns 0 or 1 // +// killough 5/3/98: reformatted, cleaned up +// ioanch 20151228: made line const +// INT32 P_PointOnLineSide(fixed_t x, fixed_t y, const line_t *line) { - // use cross product to determine side quickly - INT64 v = ((INT64)y - line->v1->y) * line->dx - ((INT64)x - line->v1->x) * line->dy; - return v > 0; + return + !line->dx ? x <= line->v1->x ? line->dy > 0 : line->dy < 0 : + !line->dy ? y <= line->v1->y ? line->dx < 0 : line->dx > 0 : + ((INT64)y - line->v1->y) * line->dx >= line->dy * ((INT64)x - line->v1->x); } // @@ -151,11 +155,15 @@ INT32 P_BoxOnLineSide(const fixed_t *tmbox, const line_t *ld) // P_PointOnDivlineSide // Returns 0 or 1. // +// killough 5/3/98: reformatted, cleaned up +// static INT32 P_PointOnDivlineSide(fixed_t x, fixed_t y, const divline_t *line) { - // use cross product to determine side quickly - INT64 v = ((INT64)y - line->y) * line->dx - ((INT64)x - line->x) * line->dy; - return v > 0; + return + line->dx == 0 ? x <= line->x ? line->dy > 0 : line->dy < 0 : + line->dy == 0 ? y <= line->y ? line->dx < 0 : line->dx > 0 : + (line->dy ^ line->dx ^ (x -= line->x) ^ (y -= line->y)) < 0 ? (line->dy ^ x) < 0 : + (INT64)(y) * line->dx >= (INT64)(line->dy) * x; } // From 8fc129d003d02007ff1b75fff5d11b0d701d5ddf Mon Sep 17 00:00:00 2001 From: Wumbo <58399748+WumboSpasm@users.noreply.github.com> Date: Sun, 5 Oct 2025 14:58:14 -0400 Subject: [PATCH 07/10] Fix build error if latest commit message contains double quotes --- cmake/Comptime.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/Comptime.cmake b/cmake/Comptime.cmake index dc709c248..c3c1a4cd6 100644 --- a/cmake/Comptime.cmake +++ b/cmake/Comptime.cmake @@ -12,7 +12,8 @@ git_current_branch(SRB2_COMP_BRANCH) git_working_tree_dirty(SRB2_COMP_UNCOMMITTED) git_latest_commit(SRB2_COMP_REVISION) -git_subject(SRB2_COMP_LASTCOMMIT) +git_subject(subject) +string(REGEX REPLACE "([\"\\])" "\\\\\\1" SRB2_COMP_LASTCOMMIT "${subject}") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/config.h") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/build/src/config.h") From ba1b91b3a3cbd27435bacaa12619a9c97439c9cb Mon Sep 17 00:00:00 2001 From: NepDisk Date: Sun, 5 Oct 2025 15:06:30 -0400 Subject: [PATCH 08/10] Sorry From 506631c235e368112f59d61e671b44371744b6a8 Mon Sep 17 00:00:00 2001 From: Wumbo <58399748+WumboSpasm@users.noreply.github.com> Date: Sun, 5 Oct 2025 22:45:42 -0400 Subject: [PATCH 09/10] Fix ground followers phasing through FOFs --- src/k_follower.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/k_follower.c b/src/k_follower.c index 29e2ed1a1..714f72fdb 100644 --- a/src/k_follower.c +++ b/src/k_follower.c @@ -410,10 +410,8 @@ void K_HandleFollower(player_t *player) if (fl.mode == FOLLOWERMODE_GROUND) { - sector_t *sec = R_PointInSubsector(sx, sy)->sector; - - fh = min(fh, P_GetFloorZ(player->follower, sec, sx, sy, NULL)); - ch = max(ch, P_GetCeilingZ(player->follower, sec, sx, sy, NULL) - ourheight); + fh = min(fh, P_FloorzAtPos(sx, sy, player->follower->z, ourheight)); + ch = max(ch, P_CeilingzAtPos(sx, sy, player->follower->z, ourheight) - ourheight); if (P_IsObjectOnGround(player->mo) == false) { From 6960c52e91d3bcadc187236d3f82fdb8fbad20d6 Mon Sep 17 00:00:00 2001 From: Anonimus Date: Tue, 7 Oct 2025 10:47:02 -0400 Subject: [PATCH 10/10] Rework eflags compat (closes #150) --- src/lua_mobjlib.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index 0eaeb2bc2..b929c0e9c 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -402,9 +402,16 @@ static int mobj_get(lua_State *L) } case mobj_eflags: { - UINT32 eflags = mo->eflags; // yes, not UINT16 + UINT32 eflags = mo->eflags; // yes, not UINT16 if (lua_compatmode) - eflags |= (~mo->renderflags & RF_DONTDRAW); + { + // The old eflags compat system causes rendering issues for characters like + // the MK64 cast. This system causes rendering issues in certain gameplay + // mods. At least in this case, character mods take priority, so we set + // up compatibility like so: + eflags |= + mo->renderflags & RF_DONTDRAW ? ~mo->renderflags & RF_DONTDRAW : 0; + } lua_pushinteger(L, eflags); break; }