From 7208f34e68f3dbddacac6f6ed77a695b1ea6c2de Mon Sep 17 00:00:00 2001 From: luigi budd Date: Sat, 22 Feb 2025 17:52:29 +0000 Subject: [PATCH 1/3] Update file lua_baselib.c --- src/lua_baselib.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 1ffa3968b..0422191ec 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -722,6 +722,12 @@ static int lib_pSpawnLockOn(lua_State *L) visual->flags2 |= MF2_DONTDRAW; visual->drawonlyforplayer = player; // Hide it from the other player in splitscreen, and yourself when spectating P_SetMobjStateNF(visual, state); + + // This is also handled in P_SceneryThinker, but we want to set it here + // so we dont get any weird interp. lag as it properly scales -luigi budd + P_SetScale(visual, lockon->scale, false); + visual->destscale = lockon->destscale; + visual->old_scale = lockon->old_scale; } return 0; } From 0683fb8cff146c8b5f5ea1af3781341beca45ab9 Mon Sep 17 00:00:00 2001 From: luigi budd <4997-luigi-budd@users.noreply.git.do.srb2.org> Date: Sat, 22 Mar 2025 18:59:59 +0000 Subject: [PATCH 2/3] Update file lua_baselib.c --- src/lua_baselib.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 0422191ec..1ffa3968b 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -722,12 +722,6 @@ static int lib_pSpawnLockOn(lua_State *L) visual->flags2 |= MF2_DONTDRAW; visual->drawonlyforplayer = player; // Hide it from the other player in splitscreen, and yourself when spectating P_SetMobjStateNF(visual, state); - - // This is also handled in P_SceneryThinker, but we want to set it here - // so we dont get any weird interp. lag as it properly scales -luigi budd - P_SetScale(visual, lockon->scale, false); - visual->destscale = lockon->destscale; - visual->old_scale = lockon->old_scale; } return 0; } From b3097b710939060a6f3de73e42d1945043456c67 Mon Sep 17 00:00:00 2001 From: luigi budd <4997-luigi-budd@users.noreply.git.do.srb2.org> Date: Sat, 22 Mar 2025 19:01:31 +0000 Subject: [PATCH 3/3] Fix HRW_DrawFlatFill --- src/hardware/hw_draw.c | 71 +++++++++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 19 deletions(-) diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index ab253d5c8..152501f60 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -598,43 +598,76 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, // -------------------------------------------------------------------------- // Fills a box of pixels using a flat texture as a pattern +// Fixed to properly align like the other draw functions -luigi budd // -------------------------------------------------------------------------- -void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum) +void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum) { FOutVector v[4]; const size_t len = W_LumpLength(flatlumpnum); - UINT16 flatflag = R_GetFlatSize(len) - 1; - double dflatsize = (double)(flatflag + 1); + UINT16 flatflag = R_GetFlatSize(len); + double dflatsize = (double)(flatflag); + // compilers are COOL! + float dup = (float)vid.dup; + float fx = (float)x * dup; + float fy = (float)y * dup; + float fw = (float)w * dup; + float fh = (float)h * dup; + + /* + fx *= dup; + fy *= dup; + fw *= dup; + fh *= dup; + */ + + if (fw <= 0 || fh <= 0) + return; + + if (fabsf((float)vid.width - (float)BASEVIDWIDTH * vid.dup) > 1.0E-36f) + { + fx += ((float)vid.width - ((float)BASEVIDWIDTH * vid.dup)) / 2; + } + if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * vid.dup) > 1.0E-36f) + { + fy += ((float)vid.height - ((float)BASEVIDHEIGHT * vid.dup)) / 2; + } + + if (fx >= vid.width || fy >= vid.height) + return; + + fx = -1.0f + (fx / (vid.width / 2.0f)); + fy = 1.0f - (fy / (vid.height / 2.0f)); + fw /= vid.width / 2; + fh /= vid.height / 2; + // 3--2 // | /| // |/ | // 0--1 + + // position vertices + v[0].x = v[3].x = fx; + v[2].x = v[1].x = fx + fw; - v[0].x = v[3].x = (x - 160.0f)/160.0f; - v[2].x = v[1].x = ((x+w) - 160.0f)/160.0f; - v[0].y = v[1].y = -(y - 100.0f)/100.0f; - v[2].y = v[3].y = -((y+h) - 100.0f)/100.0f; + v[0].y = v[1].y = fy; + v[2].y = v[3].y = fy - fh; v[0].z = v[1].z = v[2].z = v[3].z = 1.0f; - v[0].s = v[3].s = (float)((x & flatflag)/dflatsize); - v[2].s = v[1].s = (float)(v[0].s + w/dflatsize); - v[0].t = v[1].t = (float)((y & flatflag)/dflatsize); - v[2].t = v[3].t = (float)(v[0].t + h/dflatsize); + // sides + v[0].s = v[3].s = (float)(flatflag/dflatsize) * 2; + v[2].s = v[1].s = (float)(v[0].s + w/dflatsize) * 2; + // top/bottom + v[0].t = v[1].t = (float)(flatflag/dflatsize) * 2; + v[2].t = v[3].t = (float)(v[0].t + h/dflatsize) * 2; + + // needed to texture the poly HWR_GetRawFlat(flatlumpnum); - - //Hurdler: Boris, the same comment as above... but maybe for pics - // it not a problem since they don't have any transparent pixel - // if I'm right !? - // BTW, I see we put 0 for PFs, and If I'm right, that - // means we take the previous PFs as default - // how can we be sure they are ok? HWD.pfnDrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent); } - // -------------------------------------------------------------------------- // Fade down the screen so that the menu drawn on top of it looks brighter // --------------------------------------------------------------------------