From 0914d5b8e29496a5662fb318f44739ffb7aa69d4 Mon Sep 17 00:00:00 2001 From: Indev Date: Sun, 11 Jan 2026 00:49:48 +0300 Subject: [PATCH 01/15] -Wzero-as-null-pointer-constant is valid for c only since GCC 15.2 (from what i see) --- src/Makefile.d/versions.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Makefile.d/versions.mk b/src/Makefile.d/versions.mk index e57119fb9..9a1706cc7 100644 --- a/src/Makefile.d/versions.mk +++ b/src/Makefile.d/versions.mk @@ -20,7 +20,10 @@ $(foreach v,$(join $(wordlist 2,$(_n),- $(gcc_versions)),\ CXXFLAGS+= -Wno-aggregate-return # -W -Wno-unused -WFLAGS:=-Wall -Wno-trigraphs -Wnull-dereference -Wzero-as-null-pointer-constant +WFLAGS:=-Wall -Wno-trigraphs -Wnull-dereference +ifdef GCC152 +WFLAGS+-Wzero-as-null-pointer-constant +endif ifndef GCC295 #WFLAGS+=-Wno-packed endif From 310f67a06c20a8594d740b6b10a9feeaf70bc745 Mon Sep 17 00:00:00 2001 From: Indev Date: Sun, 11 Jan 2026 03:49:07 +0300 Subject: [PATCH 02/15] Fix smol mistake in strcasestr --- src/strcasestr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/strcasestr.c b/src/strcasestr.c index f50141dcf..3eb6af60f 100644 --- a/src/strcasestr.c +++ b/src/strcasestr.c @@ -73,7 +73,7 @@ nongnu_strcasestr (const char *s, const char *q) up = strchr(s, uc); lp = strchr(s, lc); - if (up == NULL || lp == NULL) + if (up == NULL && lp == NULL) return NULL; if (!lp || ( up && up < lp )) @@ -100,7 +100,7 @@ nongnu_strcasestr (const char *s, const char *q) if (trycmp(ppa, cpa, q, qn) == 0) return (*ppa); - if (up == NULL || lp == NULL) + if (up == NULL && lp == NULL) break; if (!(*ppa) || ( (*ppb) && (*ppb) < (*ppa) )) From e88773da4e81c51248666539c40d12be8b4f60aa Mon Sep 17 00:00:00 2001 From: Indev Date: Sun, 11 Jan 2026 13:08:23 +0300 Subject: [PATCH 03/15] How did i miss the = --- src/Makefile.d/versions.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.d/versions.mk b/src/Makefile.d/versions.mk index 9a1706cc7..c3989bb4f 100644 --- a/src/Makefile.d/versions.mk +++ b/src/Makefile.d/versions.mk @@ -22,7 +22,7 @@ CXXFLAGS+= -Wno-aggregate-return # -W -Wno-unused WFLAGS:=-Wall -Wno-trigraphs -Wnull-dereference ifdef GCC152 -WFLAGS+-Wzero-as-null-pointer-constant +WFLAGS+=-Wzero-as-null-pointer-constant endif ifndef GCC295 #WFLAGS+=-Wno-packed From 264c9e38ad81235f8b7855cebb43ce5d0ec44533 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 11 Jan 2026 19:46:34 +0100 Subject: [PATCH 04/15] d_netfil: dont use zone memory in CURLGetFile --- src/d_netfil.c | 11 ++++++++--- src/d_netfil.h | 1 - 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/d_netfil.c b/src/d_netfil.c index a4478fcc9..ed186bba5 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -131,6 +131,8 @@ static UINT32 curl_origtotalfilesize; static char *curl_realname = NULL; fileneeded_t *curl_curfile = NULL; HTTP_login *curl_logins = NULL; + +static void CURLGetFile(void); #endif /** Fills a serverinfo packet with information about wad files loaded. @@ -1305,6 +1307,7 @@ void CURLPrepareFile(const char* url, int dfilenum) if (!multi_handle) { cc = curl_global_init(CURL_GLOBAL_ALL); + if (cc < 0) { I_OutputMsg("libcurl: curl_global_init() returned %d\n", cc); @@ -1313,6 +1316,7 @@ void CURLPrepareFile(const char* url, int dfilenum) { multi_handle = curl_multi_init(); } + if (!multi_handle) { I_OutputMsg("libcurl: curl_multi_init() failed\n"); @@ -1441,7 +1445,7 @@ void CURLAbortFile(void) #endif } -void CURLGetFile(void) +static void CURLGetFile(void) { #ifdef HAVE_THREADS I_lock_mutex(&downloadmutex); @@ -1483,7 +1487,8 @@ void CURLGetFile(void) e = m->easy_handle; easyres = m->data.result; - char *filename = Z_StrDup(curl_realname); + char *filename = malloc(strlen(curl_realname)+1); + strcpy(filename, curl_realname); nameonly(filename); if (easyres != CURLE_OK) @@ -1521,7 +1526,7 @@ void CURLGetFile(void) } } - Z_Free(filename); + free(filename); curl_curfile->file = NULL; filedownload.remaining--; mc = curl_multi_remove_handle(multi_handle, e); diff --git a/src/d_netfil.h b/src/d_netfil.h index 3c7502451..268cd80be 100644 --- a/src/d_netfil.h +++ b/src/d_netfil.h @@ -119,7 +119,6 @@ size_t nameonlylength(const char *s); #ifdef HAVE_CURL void CURLPrepareFile(const char* url, int dfilenum); void CURLAbortFile(void); -void CURLGetFile(void); HTTP_login * CURLGetLogin (const char *url, HTTP_login ***return_prev_next); size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream); #endif From b145d7fd0e351f89371f1071c544aa125cb49991 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 12 Jan 2026 10:44:30 +0100 Subject: [PATCH 05/15] WIP: show 3d models in player setup this is incredibly ugly and hacked together theres some weird culling issues and shit doesent really "scale" with different resolutions which needs to be fixed but it kinda works --- src/hardware/hw_gl.h | 3 + src/hardware/hw_md2.c | 111 +++++++++++++++++++++++++++++++ src/hardware/hw_md2.h | 3 + src/hardware/r_opengl/r_opengl.c | 52 +++++++++++++++ src/m_menu.c | 51 +++++++++++--- 5 files changed, 212 insertions(+), 8 deletions(-) diff --git a/src/hardware/hw_gl.h b/src/hardware/hw_gl.h index 7e167485e..de5ac6338 100644 --- a/src/hardware/hw_gl.h +++ b/src/hardware/hw_gl.h @@ -80,6 +80,9 @@ UINT32 GL_CreateLightTable(RGBA_t *hw_lighttable); void GL_ClearLightTables(void); void GL_SetScreenPalette(RGBA_t *palette); +void GL_Draw2DModel(model_t *model, INT32 frameIndex, INT32 duration, INT32 tics, INT32 nextFrameIndex, + FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface); + #ifdef __cplusplus } // extern "C" #endif diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index e45a56cda..2579a3cdb 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1475,4 +1475,115 @@ void HWR_DrawMD2(gl_vissprite_t *spr) } } +// mostly copy paste of HWR_DrawMD2 +// very ugly but our model code kinda sucks +void HWR_Draw2DModel(md2_t *md2, INT32 x, INT32 y, INT32 skinnum, skincolors_t color, const UINT8 *colormap, fixed_t scale, INT32 frame, angle_t angle) +{ + patch_t *gpatch, *blendgpatch; + GLPatch_t *hwrPatch = NULL, *hwrBlendPatch = NULL; + FTransform p; + FSurfaceInfo Surf; + + if (!md2->model) + { + char filename[64]; + CONS_Debug(DBG_RENDER, "Loading model... (%s)\n", md2->filename); + sprintf(filename, "mdls/%s", md2->filename); + md2->model = md2_readModel(filename); + + if (md2->model) + { + md2_printModelInfo(md2->model); + GL_CreateModelVBOs(md2->model); + } + else + { + md2->error = true; + return; + } + } + + if (md2->model->meshes[0].numFrames > 0) + frame = frame % md2->model->meshes[0].numFrames; + else + frame = 0; + + gpatch = static_cast(md2->glpatch); + if (gpatch) + hwrPatch = ((GLPatch_t *)gpatch->hardware); + + if (!gpatch || !hwrPatch || + ((!hwrPatch->mipmap->format || !hwrPatch->mipmap->downloaded) && !md2->notexturefile)) + md2_loadTexture(md2); + + gpatch = static_cast(md2->glpatch); + if (gpatch) + hwrPatch = ((GLPatch_t *)gpatch->hardware); + + blendgpatch = static_cast(md2->blendglpatch); + if (blendgpatch) + hwrBlendPatch = ((GLPatch_t *)blendgpatch->hardware); + + if ((gpatch && hwrPatch && hwrPatch->mipmap->format) && + (!blendgpatch || !hwrBlendPatch || + ((!hwrBlendPatch->mipmap->format || !hwrBlendPatch->mipmap->downloaded) && !md2->noblendfile))) + md2_loadBlendTexture(md2); + + blendgpatch = static_cast(md2->blendglpatch); + if (blendgpatch) + hwrBlendPatch = ((GLPatch_t *)blendgpatch->hardware); + + memset(&Surf, 0x00, sizeof(FSurfaceInfo)); + Surf.PolyColor.rgba = 0xFFFFFFFF; + Surf.PolyFlags = PF_Occlude | PF_Modulated; + + Surf.LightInfo.light_level = 255; + Surf.LightInfo.fade_start = 0; + Surf.LightInfo.fade_end = 31; + + if (color != SKINCOLOR_NONE && + blendgpatch && hwrBlendPatch->mipmap->format && + gpatch->width == blendgpatch->width && gpatch->height == blendgpatch->height) + { + INT32 tcskinnum = TC_DEFAULT; + + if (color) + tcskinnum = skinnum; + + HWR_GetBlendedTexture(gpatch, blendgpatch, tcskinnum, colormap, color); + } + else if (hwrPatch && hwrPatch->mipmap->format) + { + GL_SetTexture(hwrPatch->mipmap); + } + + memset(&p, 0x00, sizeof(FTransform)); + + p.x = x; + p.y = -400.0f; // idk man, but this makes the model not cull, kinda? + p.z = y; // for whatever reason y and z are switched here + + p.angley = FixedToFloat(AngleFixed(angle)); + p.anglex = 0.0f; + p.anglez = 0.0f; + + p.roll = false; + + p.fliptype = TRANSFORM_NONE; + + GL_Draw2DModel( + md2->model, + frame, + 0.0f, + 0.0f, + -1, + &p, + FixedToFloat(scale), + FixedToFloat(scale), + true, + false, + &Surf + ); +} + #endif //HWRENDER diff --git a/src/hardware/hw_md2.h b/src/hardware/hw_md2.h index 62de1f35e..0f8bd5342 100644 --- a/src/hardware/hw_md2.h +++ b/src/hardware/hw_md2.h @@ -45,6 +45,9 @@ void HWR_InitMD2(void); void HWR_DrawMD2(gl_vissprite_t *spr); void HWR_AddPlayerMD2(INT32 skin, boolean local); void HWR_AddSpriteMD2(size_t spritenum); +void HWR_Draw2DModel(md2_t *md2, INT32 x, INT32 y, INT32 skinnum, + skincolors_t color, const UINT8 *colormap, + fixed_t scale, INT32 frame, angle_t angle); #ifdef __cplusplus } // extern "C" diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index fab0a8a6d..c4c3fc47e 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -404,6 +404,14 @@ static PFNglEnableClientState pglEnableClientState; typedef void (APIENTRY * PFNglDisableClientState) (GLenum cap); static PFNglDisableClientState pglDisableClientState; +typedef void (APIENTRY * PFNglOrtho) (GLdouble left, + GLdouble right, + GLdouble bottom, + GLdouble top, + GLdouble nearVal, + GLdouble farVal); +static PFNglOrtho pglOrtho; + /* Lighting */ typedef void (APIENTRY * PFNglShadeModel) (GLenum mode); static PFNglShadeModel pglShadeModel; @@ -858,6 +866,8 @@ void SetupGLFunc4(void) GetGLfunc(glUniform3fv); GetGLfunc(glGetUniformLocation); + GetGLfunc(glOrtho); + #ifdef GLDEBUGMESSAGE GetGLfunc(glDebugMessageCallback); #endif @@ -3090,6 +3100,48 @@ void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics pglDisable(GL_NORMALIZE); } +void GL_Draw2DModel(model_t *model, INT32 frameIndex, INT32 duration, INT32 tics, INT32 nextFrameIndex, + FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface) +{ + // save our matrix´s + pglMatrixMode(GL_PROJECTION); + pglPushMatrix(); + pglMatrixMode(GL_MODELVIEW); + pglPushMatrix(); + + pglMatrixMode(GL_PROJECTION); + pglLoadIdentity(); + + // switch to ortho mode to make our lives easier + // thisll make sure our coords will be remapped to pixel coords + // try to scale it to the base width and height + // shit still be weird, and needs accounting for diff resolutions + pglOrtho(0.0f, (float)BASEVIDWIDTH, (float)BASEVIDHEIGHT, 0.0f, ZCLIP_PLANE, FAR_ZCLIP_DEFAULT); + + pglMatrixMode(GL_MODELVIEW); + pglLoadIdentity(); + + //pglDepthRange(0.0f, 1.0f); + pglClearDepth(1.0f); //Hurdler: all that are permanen states + pglDepthRange(ZCLIP_PLANE, FAR_ZCLIP_DEFAULT); // idk man im confused here tbh + pglDepthFunc(GL_LEQUAL); + pglClear(GL_DEPTH_BUFFER_BIT); + //GL_ClearBuffer(false, true, false, NULL); + + // FIXME: theres some weird culling issues i cant wrap my head around + // so until then gotta disable depth testing until i can figure this out + //pglDisable(GL_DEPTH_TEST); + GL_DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, + pos, hscale, vscale, flipped, hflipped, Surface); + //pglEnable(GL_DEPTH_TEST); + + // restore the matrix´s + pglMatrixMode(GL_PROJECTION); + pglPopMatrix(); + pglMatrixMode(GL_MODELVIEW); + pglPopMatrix(); +} + // -----------------+ // SetTransform : // -----------------+ diff --git a/src/m_menu.c b/src/m_menu.c index 55112356b..f94407284 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -12,6 +12,8 @@ /// \file m_menu.c /// \brief XMOD's extremely revamped menu system. +#include "screen.h" +#include "tables.h" #ifdef __GNUC__ #include #endif @@ -8523,7 +8525,7 @@ static void M_DrawSetupMultiPlayerMenu(void) const INT32 skinnum = R_SkinAvailable(skins[skintodisplay].name); - if (skinnum != -1) + if (skinnum > 0 || skinnum < MAXSKINS) sprdef = &skins[skinnum].spritedef; else sprdef = &skins[0].spritedef; @@ -8549,23 +8551,56 @@ static void M_DrawSetupMultiPlayerMenu(void) // draw box around guy V_DrawFill(mx + 36 - (charw/2), my+65, charw, 84, 239); +#undef charw // draw player sprite if (setupm_fakecolor) // inverse should never happen { UINT8 *colormap = R_GetTranslationColormap(skintodisplay, setupm_fakecolor, GTC_MENUCACHE); - if (skins[skintodisplay].flags & SF_HIRES) +#ifdef HWRENDER + md2_t *md2 = NULL; + + if (skinnum > 0 || skinnum < MAXSKINS) + md2 = &md2_playermodels[skinnum]; + else + md2 = &md2_playermodels[0]; + + // if we have 3d models enabled and a model exists + // try to show it instead of the sprite + if (rendermode == render_opengl && cv_glmdls.value + && !md2->error && !md2->notfound) { - V_DrawFixedPatch((mx+36)< Date: Mon, 12 Jan 2026 18:08:22 +0300 Subject: [PATCH 06/15] Make HWR_Draw2DModel not depend on resolution, make 3d skin select use skinselectspin cvar --- src/hardware/hw_md2.c | 6 +++--- src/hardware/r_opengl/r_opengl.c | 2 +- src/m_menu.c | 13 +++---------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 2579a3cdb..00d4b955f 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1559,7 +1559,7 @@ void HWR_Draw2DModel(md2_t *md2, INT32 x, INT32 y, INT32 skinnum, skincolors_t c memset(&p, 0x00, sizeof(FTransform)); - p.x = x; + p.x = x + (vid.width/vid.dup - BASEVIDWIDTH)/4; p.y = -400.0f; // idk man, but this makes the model not cull, kinda? p.z = y; // for whatever reason y and z are switched here @@ -1578,8 +1578,8 @@ void HWR_Draw2DModel(md2_t *md2, INT32 x, INT32 y, INT32 skinnum, skincolors_t c 0.0f, -1, &p, - FixedToFloat(scale), - FixedToFloat(scale), + FixedToFloat(scale) * (BASEVIDWIDTH / ((float)vid.width/vid.dup)), + FixedToFloat(scale) * (BASEVIDHEIGHT / ((float)vid.height/vid.dup)), true, false, &Surf diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index c4c3fc47e..773d19013 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -3123,7 +3123,7 @@ void GL_Draw2DModel(model_t *model, INT32 frameIndex, INT32 duration, INT32 tics //pglDepthRange(0.0f, 1.0f); pglClearDepth(1.0f); //Hurdler: all that are permanen states - pglDepthRange(ZCLIP_PLANE, FAR_ZCLIP_DEFAULT); // idk man im confused here tbh + pglDepthRange(0.f, FAR_ZCLIP_DEFAULT); // idk man im confused here tbh pglDepthFunc(GL_LEQUAL); pglClear(GL_DEPTH_BUFFER_BIT); //GL_ClearBuffer(false, true, false, NULL); diff --git a/src/m_menu.c b/src/m_menu.c index f94407284..ea2cdc9c6 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8574,18 +8574,11 @@ static void M_DrawSetupMultiPlayerMenu(void) mx += 36; my += 131; - static angle_t angle = ANGLE_180; + const angle_t ROTATE_PER_TIC = (UINT64)ANGLE_45 * cv_skinselectspin.value / TICRATE; - // idk but those magic numbers work, gotta figure out smth proper - //x += vid.width/3; - //y += vid.height/2; - mx += BASEVIDWIDTH/8; - my -= BASEVIDHEIGHT/10; + angle_t angle = I_GetTime()*ROTATE_PER_TIC + FixedMul(cv_uncappedhud.value ? renderdeltatics : FRACUNIT, ROTATE_PER_TIC); - // just for testing - angle += FRACUNIT * 3; - - HWR_Draw2DModel(md2, mx, my, skinnum, (skincolors_t)setupm_fakecolor, colormap, 4*FRACUNIT/3, 0, angle); + HWR_Draw2DModel(md2, mx, my, skinnum, (skincolors_t)setupm_fakecolor, colormap, 8*FRACUNIT/3, frame, angle); } else #endif From e17a8a505cb3fde85bdd47572246bcac27a58ce7 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 12 Jan 2026 16:48:50 +0100 Subject: [PATCH 07/15] fix the culling issues i hope this is right....... --- src/hardware/hw_md2.c | 4 ++-- src/hardware/r_opengl/r_opengl.c | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 00d4b955f..3cf3f060c 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1559,8 +1559,8 @@ void HWR_Draw2DModel(md2_t *md2, INT32 x, INT32 y, INT32 skinnum, skincolors_t c memset(&p, 0x00, sizeof(FTransform)); - p.x = x + (vid.width/vid.dup - BASEVIDWIDTH)/4; - p.y = -400.0f; // idk man, but this makes the model not cull, kinda? + p.x = x + (vid.width/(float)vid.dup - BASEVIDWIDTH)/4; + p.y = -100.0f; // idk man, but this makes the model not cull, kinda? p.z = y; // for whatever reason y and z are switched here p.angley = FixedToFloat(AngleFixed(angle)); diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 773d19013..223cb359f 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -3116,23 +3116,22 @@ void GL_Draw2DModel(model_t *model, INT32 frameIndex, INT32 duration, INT32 tics // thisll make sure our coords will be remapped to pixel coords // try to scale it to the base width and height // shit still be weird, and needs accounting for diff resolutions - pglOrtho(0.0f, (float)BASEVIDWIDTH, (float)BASEVIDHEIGHT, 0.0f, ZCLIP_PLANE, FAR_ZCLIP_DEFAULT); + pglOrtho(0.0f, (float)BASEVIDWIDTH, (float)BASEVIDHEIGHT, 0.0f, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT); pglMatrixMode(GL_MODELVIEW); pglLoadIdentity(); - //pglDepthRange(0.0f, 1.0f); - pglClearDepth(1.0f); //Hurdler: all that are permanen states - pglDepthRange(0.f, FAR_ZCLIP_DEFAULT); // idk man im confused here tbh - pglDepthFunc(GL_LEQUAL); + pglEnable(GL_DEPTH_TEST); + pglDepthMask(GL_TRUE); pglClear(GL_DEPTH_BUFFER_BIT); - //GL_ClearBuffer(false, true, false, NULL); // FIXME: theres some weird culling issues i cant wrap my head around // so until then gotta disable depth testing until i can figure this out //pglDisable(GL_DEPTH_TEST); GL_DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface); + + //pglDepthMask(GL_TRUE); //pglEnable(GL_DEPTH_TEST); // restore the matrix´s From c01818e2e393d4932dd7be2f3e52ba9b95b00f14 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 12 Jan 2026 17:22:04 +0100 Subject: [PATCH 08/15] simplify skinnum bounds check lul --- src/m_menu.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index ea2cdc9c6..f6145d205 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -7948,6 +7948,7 @@ static void M_DrawSetupMultiPlayerMenu(void) UINT8 i; UINT8 s, w; const UINT8 *flashcol = V_GetStringColormap(highlightflags); + INT32 skinnum = 0; INT32 statx, staty; UINT32 speenframe; INT32 sltw, actw, hetw; @@ -8523,12 +8524,12 @@ static void M_DrawSetupMultiPlayerMenu(void) break; } - const INT32 skinnum = R_SkinAvailable(skins[skintodisplay].name); + skinnum = R_SkinAvailable(skins[skintodisplay].name); - if (skinnum > 0 || skinnum < MAXSKINS) - sprdef = &skins[skinnum].spritedef; - else - sprdef = &skins[0].spritedef; + if (skinnum < 0 || skinnum >= MAXSKINS) + skinnum = 0; + + sprdef = &skins[skinnum].spritedef; if (!sprdef->numframes) // No frames ?? return; // Can't render! @@ -8557,14 +8558,8 @@ static void M_DrawSetupMultiPlayerMenu(void) if (setupm_fakecolor) // inverse should never happen { UINT8 *colormap = R_GetTranslationColormap(skintodisplay, setupm_fakecolor, GTC_MENUCACHE); - #ifdef HWRENDER - md2_t *md2 = NULL; - - if (skinnum > 0 || skinnum < MAXSKINS) - md2 = &md2_playermodels[skinnum]; - else - md2 = &md2_playermodels[0]; + md2_t *md2 = &md2_playermodels[skinnum]; // if we have 3d models enabled and a model exists // try to show it instead of the sprite From 7a0fb016262f753acd745073b5cd136fb1bbf51d Mon Sep 17 00:00:00 2001 From: Indev Date: Mon, 12 Jan 2026 20:14:17 +0300 Subject: [PATCH 09/15] Make glOrtho remap coordinates to vid.width and vid.height, this makes calculating coordinates in HWR_Draw2DModel easier --- src/hardware/hw_md2.c | 10 +++++----- src/hardware/r_opengl/r_opengl.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 3cf3f060c..f971e1945 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1559,9 +1559,9 @@ void HWR_Draw2DModel(md2_t *md2, INT32 x, INT32 y, INT32 skinnum, skincolors_t c memset(&p, 0x00, sizeof(FTransform)); - p.x = x + (vid.width/(float)vid.dup - BASEVIDWIDTH)/4; - p.y = -100.0f; // idk man, but this makes the model not cull, kinda? - p.z = y; // for whatever reason y and z are switched here + p.x = x*vid.dup + (vid.width - BASEVIDWIDTH*vid.dup)/2; + p.y = -200.0f; // idk man, but this makes the model not cull, kinda? + p.z = y*vid.dup + (vid.height - BASEVIDHEIGHT*vid.dup)/2; // for whatever reason y and z are switched here p.angley = FixedToFloat(AngleFixed(angle)); p.anglex = 0.0f; @@ -1578,8 +1578,8 @@ void HWR_Draw2DModel(md2_t *md2, INT32 x, INT32 y, INT32 skinnum, skincolors_t c 0.0f, -1, &p, - FixedToFloat(scale) * (BASEVIDWIDTH / ((float)vid.width/vid.dup)), - FixedToFloat(scale) * (BASEVIDHEIGHT / ((float)vid.height/vid.dup)), + FixedToFloat(scale*vid.dup), + FixedToFloat(scale*vid.dup), true, false, &Surf diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 223cb359f..25d9c0431 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -3116,7 +3116,7 @@ void GL_Draw2DModel(model_t *model, INT32 frameIndex, INT32 duration, INT32 tics // thisll make sure our coords will be remapped to pixel coords // try to scale it to the base width and height // shit still be weird, and needs accounting for diff resolutions - pglOrtho(0.0f, (float)BASEVIDWIDTH, (float)BASEVIDHEIGHT, 0.0f, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT); + pglOrtho(0.0f, (float)vid.width, (float)vid.height, 0.0f, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT); pglMatrixMode(GL_MODELVIEW); pglLoadIdentity(); From 0c091256f40faa6634fcc8bc9831309a3bd1f714 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 12 Jan 2026 18:26:32 +0100 Subject: [PATCH 10/15] tiny cleanup + warning fix --- src/hardware/hw_md2.c | 23 ++++++++++++----------- src/hardware/r_opengl/r_opengl.c | 8 -------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index f971e1945..c00297ff8 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1559,28 +1559,29 @@ void HWR_Draw2DModel(md2_t *md2, INT32 x, INT32 y, INT32 skinnum, skincolors_t c memset(&p, 0x00, sizeof(FTransform)); - p.x = x*vid.dup + (vid.width - BASEVIDWIDTH*vid.dup)/2; - p.y = -200.0f; // idk man, but this makes the model not cull, kinda? - p.z = y*vid.dup + (vid.height - BASEVIDHEIGHT*vid.dup)/2; // for whatever reason y and z are switched here + p.x = x*vid.dup + (float)(vid.width - BASEVIDWIDTH*vid.dup)/2.f; + p.y = -200.f; // push it back to prevent wonky culling, idk lul + p.z = y*vid.dup + (float)(vid.height - BASEVIDHEIGHT*vid.dup)/2.f; p.angley = FixedToFloat(AngleFixed(angle)); - p.anglex = 0.0f; - p.anglez = 0.0f; + p.anglex = 0.f; + p.anglez = 0.f; p.roll = false; - p.fliptype = TRANSFORM_NONE; + const float fscale = FixedToFloat(scale*vid.dup); + GL_Draw2DModel( md2->model, frame, - 0.0f, - 0.0f, + 0.f, + 0.f, -1, &p, - FixedToFloat(scale*vid.dup), - FixedToFloat(scale*vid.dup), - true, + fscale, + fscale, + true, // flip it vertically lul false, &Surf ); diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 25d9c0431..2d1f8e255 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -3114,8 +3114,6 @@ void GL_Draw2DModel(model_t *model, INT32 frameIndex, INT32 duration, INT32 tics // switch to ortho mode to make our lives easier // thisll make sure our coords will be remapped to pixel coords - // try to scale it to the base width and height - // shit still be weird, and needs accounting for diff resolutions pglOrtho(0.0f, (float)vid.width, (float)vid.height, 0.0f, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT); pglMatrixMode(GL_MODELVIEW); @@ -3125,15 +3123,9 @@ void GL_Draw2DModel(model_t *model, INT32 frameIndex, INT32 duration, INT32 tics pglDepthMask(GL_TRUE); pglClear(GL_DEPTH_BUFFER_BIT); - // FIXME: theres some weird culling issues i cant wrap my head around - // so until then gotta disable depth testing until i can figure this out - //pglDisable(GL_DEPTH_TEST); GL_DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface); - //pglDepthMask(GL_TRUE); - //pglEnable(GL_DEPTH_TEST); - // restore the matrix´s pglMatrixMode(GL_PROJECTION); pglPopMatrix(); From faadd3e89fef20276833856c05479a5adc5ba657 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 12 Jan 2026 18:39:52 +0100 Subject: [PATCH 11/15] support the uhhh localskin setup with 3d models --- src/m_menu.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index f6145d205..3f0dca46d 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -9920,12 +9920,12 @@ static void M_DrawLocalSkinMenu(void) // skin 0 is default player sprite skintodisplay = R_AnySkinAvailable(cv_fakelocalskin.string); - if (skintodisplay == -1) + if (skintodisplay < 0) { // ATTEMPT TO FIND REAL SKIN skintodisplay = R_AnySkinAvailable(cv_skin.string); - if (skintodisplay == -1) // STILL NOTHIN? use sonic instead + if (skintodisplay < 0) // STILL NOTHIN? use sonic instead { skintodisplay = 0; } @@ -9958,6 +9958,7 @@ static void M_DrawLocalSkinMenu(void) // draw box around guy V_DrawFill(mx + 220 - (charw/2), my+54, charw, 84, 239); +#undef charw // draw player sprite UINT8 *colormap = R_GetLocalTranslationColormap(&skins[displayskin.localnum], (displayskin.localskin ? &localskins[displayskin.localnum] : NULL), cv_playercolor.value, GTC_MENUCACHE, displayskin.localskin); @@ -9972,13 +9973,34 @@ static void M_DrawLocalSkinMenu(void) else V_DrawString(mx+20, my+118, V_ALLOWLOWERCASE|highlightflags, displayskin.realname); - if (displayskin.flags & SF_HIRES) + // draw player sprite +#ifdef HWRENDER + md2_t *md2 = (displayskin.localskin ? &md2_localplayermodels[skintodisplay] : &md2_playermodels[skintodisplay]); + + // if we have 3d models enabled and a model exists + // try to show it instead of the sprite + if (rendermode == render_opengl && cv_glmdls.value + && !md2->error && !md2->notfound) { - V_DrawFixedPatch((mx+220)< Date: Mon, 12 Jan 2026 19:13:08 +0100 Subject: [PATCH 12/15] push back models even further bigger models still had parts being culled, hope this is generous enough idk --- src/hardware/hw_md2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index c00297ff8..0fdd62623 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1560,7 +1560,7 @@ void HWR_Draw2DModel(md2_t *md2, INT32 x, INT32 y, INT32 skinnum, skincolors_t c memset(&p, 0x00, sizeof(FTransform)); p.x = x*vid.dup + (float)(vid.width - BASEVIDWIDTH*vid.dup)/2.f; - p.y = -200.f; // push it back to prevent wonky culling, idk lul + p.y = -420.f; // push it back to prevent wonky culling, idk lul p.z = y*vid.dup + (float)(vid.height - BASEVIDHEIGHT*vid.dup)/2.f; p.angley = FixedToFloat(AngleFixed(angle)); From 6fd64383d3f9c413ea96ff7c4c80243089e2bfd5 Mon Sep 17 00:00:00 2001 From: Indev Date: Mon, 12 Jan 2026 22:33:30 +0300 Subject: [PATCH 13/15] This isn't ceepeepee rn :SmolBuncle: --- src/hardware/hw_md2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 0fdd62623..0a79ba6ec 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1508,7 +1508,7 @@ void HWR_Draw2DModel(md2_t *md2, INT32 x, INT32 y, INT32 skinnum, skincolors_t c else frame = 0; - gpatch = static_cast(md2->glpatch); + gpatch = (patch_t *)(md2->glpatch); if (gpatch) hwrPatch = ((GLPatch_t *)gpatch->hardware); @@ -1516,11 +1516,11 @@ void HWR_Draw2DModel(md2_t *md2, INT32 x, INT32 y, INT32 skinnum, skincolors_t c ((!hwrPatch->mipmap->format || !hwrPatch->mipmap->downloaded) && !md2->notexturefile)) md2_loadTexture(md2); - gpatch = static_cast(md2->glpatch); + gpatch = (patch_t*)(md2->glpatch); if (gpatch) hwrPatch = ((GLPatch_t *)gpatch->hardware); - blendgpatch = static_cast(md2->blendglpatch); + blendgpatch = (patch_t*)(md2->blendglpatch); if (blendgpatch) hwrBlendPatch = ((GLPatch_t *)blendgpatch->hardware); @@ -1529,7 +1529,7 @@ void HWR_Draw2DModel(md2_t *md2, INT32 x, INT32 y, INT32 skinnum, skincolors_t c ((!hwrBlendPatch->mipmap->format || !hwrBlendPatch->mipmap->downloaded) && !md2->noblendfile))) md2_loadBlendTexture(md2); - blendgpatch = static_cast(md2->blendglpatch); + blendgpatch = (patch_t*)(md2->blendglpatch); if (blendgpatch) hwrBlendPatch = ((GLPatch_t *)blendgpatch->hardware); From 1b8d7b1541ccab0d796043e4596812b4ee79f4f6 Mon Sep 17 00:00:00 2001 From: Indev Date: Fri, 16 Jan 2026 11:11:36 +0300 Subject: [PATCH 14/15] I_Error when dedi tries to go to main error This will not fix the issue entirely but will at least prevent server getting stuck and backtrace will show where did it try to go into menu from --- src/d_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/d_main.c b/src/d_main.c index 3e474cec3..81fd3d830 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -946,6 +946,9 @@ void D_ClearState(void) // void D_StartTitle(void) { + if (dedicated) + I_Error("D_StartTitle is called on dedicated server"); + D_ClearState(); multiplayer = netgame = false; // title menu shouldnt be a netgame or multiplayer lmao F_StartTitleScreen(); From ac3a1ad5eb841c78c0500b933bf2341b62864323 Mon Sep 17 00:00:00 2001 From: Indev Date: Fri, 16 Jan 2026 12:02:21 +0300 Subject: [PATCH 15/15] Add gcc 13.3 into list of supported versions --- src/Makefile.d/detect.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.d/detect.mk b/src/Makefile.d/detect.mk index 7ff978397..0816c5a03 100644 --- a/src/Makefile.d/detect.mk +++ b/src/Makefile.d/detect.mk @@ -66,7 +66,7 @@ endif gcc_versions:=\ 152 151 150 15\ 142 141 140 14\ - 132 131 130 13\ + 133 132 131 130 13\ 123 122 121 120 12\ 114 113 112 111 110 11\ 105 104 103 102 101 100 10\