From 381f006f31eae1cd25f05ad5ae8060fa0337a6df Mon Sep 17 00:00:00 2001 From: Indev Date: Mon, 12 Jan 2026 20:14:17 +0300 Subject: [PATCH] Make glOrtho remap coordinates to vid.width and vid.height, this makes calculating coordinates in HWR_Draw2DModel easier --- src/hardware/hw_md2.cpp | 10 +++++----- src/hardware/r_opengl/r_opengl.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hardware/hw_md2.cpp b/src/hardware/hw_md2.cpp index d6208b15e..61a9e9c10 100644 --- a/src/hardware/hw_md2.cpp +++ b/src/hardware/hw_md2.cpp @@ -1576,9 +1576,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; @@ -1595,8 +1595,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 14346b476..a48ad4249 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -3138,7 +3138,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();