From 544bdae42aa85fffd68c8cce32a81d911e42dfad Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 20 May 2006 20:57:09 +0000 Subject: [PATCH] HUD model correction stuff git-svn-id: https://svn.eduke32.com/eduke32@174 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/include/build.h | 2 +- polymer/build/src/polymost.c | 30 ++++++++++++++++++++++-------- polymer/eduke32/source/config.c | 2 ++ polymer/eduke32/source/menus.c | 6 ++++-- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/polymer/build/include/build.h b/polymer/build/include/build.h index d4a4241e0..8880ffb3c 100644 --- a/polymer/build/include/build.h +++ b/polymer/build/include/build.h @@ -472,7 +472,7 @@ extern long glusetexcompr; extern long gltexfiltermode; extern long glredbluemode; extern long glusetexcache, glusetexcachecompression; -extern long glmultisample, glnvmultisamplehint, glratiocorrection; +extern long glmultisample, glnvmultisamplehint, glratiocorrection, glhudcorrect; void gltexapplyprops (void); #endif diff --git a/polymer/build/src/polymost.c b/polymer/build/src/polymost.c index 4bad0f141..ad28dcecf 100644 --- a/polymer/build/src/polymost.c +++ b/polymer/build/src/polymost.c @@ -125,6 +125,7 @@ long gltexmiplevel = 0; // discards this many mipmap levels static long lastglpolygonmode = 0; //FUK long glpolygonmode = 0; // 0:GL_FILL,1:GL_LINE,2:GL_POINT //FUK long glratiocorrection = 63; +long glhudcorrect = 0; static GLuint polymosttext = 0; extern char nofog; #endif @@ -4043,10 +4044,12 @@ void polymost_dorotatesprite (long sx, long sy, long z, short a, short picnum, if ((dastat&10) == 2) { -// ratioratio = 1.6 / (((float)(windowx2-windowx1+1)) / (windowy2-windowy1)); // computes the ratio between 16/10 and current resolution ratio -// fovcorrect = (ratioratio > 1) ? (((windowx2-windowx1+1) * ratioratio) - windowx2-windowx1+1) * ((float)glratiocorrection / 63) * 2 : 0; -// bglViewport(windowx1 - (fovcorrect / 2),yres-(windowy2+1),windowx2-windowx1+1 + fovcorrect,windowy2-windowy1+1); - bglViewport(windowx1,yres-(windowy2+1),windowx2-windowx1+1,windowy2-windowy1+1); + if(glhudcorrect) + { + ratioratio = 1.2; + fovcorrect = ((xdimen*ratioratio)-(xdimen+1)) * 2; + bglViewport(windowx1 - (fovcorrect / 2),yres-(windowy2+1),windowx2-windowx1+1 + fovcorrect,windowy2-windowy1+1); + } else bglViewport(windowx1,yres-(windowy2+1),windowx2-windowx1+1,windowy2-windowy1+1); } else { @@ -4058,10 +4061,21 @@ void polymost_dorotatesprite (long sx, long sy, long z, short a, short picnum, memset(m,0,sizeof(m)); if ((dastat&10) == 2) { - m[0][0] = (float)ydimen/* / ((ratioratio > 1)?1.2:1)*/; m[0][2] = 1.0; - m[1][1] = (float)xdimen; m[1][2] = 1.0; - m[2][2] = 1.0; m[2][3] = (float)ydimen/* / ((ratioratio > 1)?1.2:1)*/; - m[3][2] =-1.0; + if(glhudcorrect) + { + ratioratio = (float)xdimen/ydimen; + m[0][0] = (float)ydimen*(ratioratio >= 1.6?1.2:1); m[0][2] = 1.0; + m[1][1] = (float)xdimen; m[1][2] = 1.0; + m[2][2] = 1.0; m[2][3] = (float)ydimen*(ratioratio >= 1.6?1.2:1); + m[3][2] =-1.0; + } + else + { + m[0][0] = (float)ydimen; m[0][2] = 1.0; + m[1][1] = (float)xdimen; m[1][2] = 1.0; + m[2][2] = 1.0; m[2][3] = (float)ydimen; + m[3][2] =-1.0; + } } else { m[0][0] = m[2][3] = 1.0; m[1][1] = ((float)xdim)/((float)ydim); m[2][2] = 1.0001; m[3][2] = 1-m[2][2]; } bglLoadMatrixf(&m[0][0]); diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index b9f74b9a0..13f9c1720 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -603,6 +603,7 @@ void CONFIG_ReadSetup( void ) #if defined(POLYMOST) && defined(USE_OPENGL) SCRIPT_GetNumber( scripthandle, "Screen Setup", "GLTextureMode", &gltexfiltermode); SCRIPT_GetNumber( scripthandle, "Screen Setup", "GLAnisotropy", &glanisotropy); + SCRIPT_GetNumber( scripthandle, "Screen Setup", "GLHUDCorrect", &glhudcorrect); SCRIPT_GetNumber( scripthandle, "Screen Setup", "GLUseTextureCompr", &glusetexcompr); SCRIPT_GetNumber( scripthandle, "Screen Setup", "GLRatioCorrection", &glratiocorrection); @@ -743,6 +744,7 @@ void CONFIG_WriteSetup( void ) SCRIPT_PutNumber( scripthandle, "Screen Setup", "Detail",ud.detail,false,false); #if defined(POLYMOST) && defined(USE_OPENGL) SCRIPT_PutNumber( scripthandle, "Screen Setup", "GLAnisotropy",glanisotropy,false,false); + SCRIPT_PutNumber( scripthandle, "Screen Setup", "GLHUDCorrect",glhudcorrect,false,false); SCRIPT_PutNumber( scripthandle, "Screen Setup", "GLRatioCorrection",glratiocorrection,false,false); SCRIPT_PutNumber( scripthandle, "Screen Setup", "GLTextureMode",gltexfiltermode,false,false); SCRIPT_PutNumber( scripthandle, "Screen Setup", "GLUseCompressedTextureCache", glusetexcache,false,false); diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index ed35a01c6..f4a9761aa 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -2110,8 +2110,7 @@ cheat_for_port_credits: "-", "Models", "-", - "-", - "-", + "HUD model perspective", "-", "-", "-", @@ -2170,6 +2169,9 @@ cheat_for_port_credits: case 6: if (x==io) usemodels = 1-usemodels; modval(0,1,(int *)&usemodels,1,probey==io); gametextpal(d,yy, usemodels ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; + case 7: if (x==io) glhudcorrect = 1-glhudcorrect; + modval(0,1,(int *)&glhudcorrect,1,probey==io); + gametextpal(d,yy, glhudcorrect ? "Correct" : "Old", MENUHIGHLIGHT(io), 0); break; default: break; } gametextpal(c,yy, opts[ii], enabled?MENUHIGHLIGHT(io):15, 2);