From b145d7fd0e351f89371f1071c544aa125cb49991 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 12 Jan 2026 10:44:30 +0100 Subject: [PATCH 1/7] 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 2/7] 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 3/7] 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 4/7] 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 5/7] 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 6/7] 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 7/7] 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)<