Make glOrtho remap coordinates to vid.width and vid.height, this makes calculating coordinates in HWR_Draw2DModel easier

This commit is contained in:
indev committed 2026-01-12 20:14:17 +03:00
1 parent 6da9e31df3
commit 381f006f31
2 files changed
+6 -6

No files matched your search

+5 -5
View File
@@ -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
+1 -1
View File
@@ -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();