I guess this is some kind of an optimization :o

git-svn-id: https://svn.eduke32.com/eduke32@393 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-12-10 01:21:30 +00:00
parent 15ee3431f9
commit d0ef9e1133
2 changed files with 21 additions and 21 deletions

View File

@ -135,20 +135,20 @@ long fullbrightloadingpass = 0;
long fullbrightdrawingpass = 0; long fullbrightdrawingpass = 0;
long shadeforfullbrightpass; long shadeforfullbrightpass;
float fogcalc (signed char shade, char vis) float fogresult;
{
float result;
// if(vis < 16) vis = 16;
if (vis < 240) result = (float)(vis+16+(shade<0?(-(shade)*(shade))/8.f:((shade)*(shade))/8.f));
else result = (float)((vis-240+(shade<0?(-(shade)*(shade))/8.f:((shade)*(shade))/8.f))/(klabs(vis-256)));
result *= gvisibility; float fogcalc (const signed char *shade, const char *vis)
{
if (*vis < 240) fogresult = (float)(*vis+16+(*shade<0?(-(*shade)*(*shade))/8.f:((*shade)*(*shade))/8.f));
else fogresult = (float)((*vis-240+(*shade<0?(-(*shade)*(*shade))/8.f:((*shade)*(*shade))/8.f))/(klabs(*vis-256)));
fogresult *= gvisibility;
// initprintf("result: %.f\n",result); // initprintf("result: %.f\n",result);
if (result < 0.010) return (0.010); if (fogresult < 0.010) return (0.010);
else if (result > 10.000) return (10.000); else if (fogresult > 10.000) return (10.000);
else return (result); else return (fogresult);
} }
#endif #endif
@ -2509,7 +2509,7 @@ static void polymost_drawalls (long bunch)
if (globalposz >= getflorzofslope(sectnum,globalposx,globalposy)) domostpolymethod = -1; //Back-face culling if (globalposz >= getflorzofslope(sectnum,globalposx,globalposy)) domostpolymethod = -1; //Back-face culling
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (!nofog) if (!nofog)
bglFogf(GL_FOG_DENSITY,fogcalc(sec->floorshade,sec->visibility)); bglFogf(GL_FOG_DENSITY,fogcalc(&sec->floorshade,&sec->visibility));
#endif #endif
pow2xsplit = 0; domost(x0,fy0,x1,fy1); //flor pow2xsplit = 0; domost(x0,fy0,x1,fy1); //flor
domostpolymethod = 0; domostpolymethod = 0;
@ -2528,7 +2528,7 @@ static void polymost_drawalls (long bunch)
} */ } */
if (!nofog) if (!nofog)
bglFogf(GL_FOG_DENSITY,fogcalc(sec->floorshade,sec->visibility) * 0.005); bglFogf(GL_FOG_DENSITY,fogcalc(&sec->floorshade,&sec->visibility) * 0.005);
//Use clamping for tiled sky textures //Use clamping for tiled sky textures
for (i=(1<<pskybits)-1;i>0;i--) for (i=(1<<pskybits)-1;i>0;i--)
@ -2869,7 +2869,7 @@ static void polymost_drawalls (long bunch)
if (globalposz <= getceilzofslope(sectnum,globalposx,globalposy)) domostpolymethod = -1; //Back-face culling if (globalposz <= getceilzofslope(sectnum,globalposx,globalposy)) domostpolymethod = -1; //Back-face culling
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (!nofog) if (!nofog)
bglFogf(GL_FOG_DENSITY,fogcalc(sec->ceilingshade,sec->visibility)); bglFogf(GL_FOG_DENSITY,fogcalc(&sec->ceilingshade,&sec->visibility));
#endif #endif
pow2xsplit = 0; domost(x1,cy1,x0,cy0); //ceil pow2xsplit = 0; domost(x1,cy1,x0,cy0); //ceil
domostpolymethod = 0; domostpolymethod = 0;
@ -2887,7 +2887,7 @@ static void polymost_drawalls (long bunch)
} }
*/ */
if (!nofog) if (!nofog)
bglFogf(GL_FOG_DENSITY,fogcalc(sec->ceilingshade,sec->visibility) * 0.005); bglFogf(GL_FOG_DENSITY,fogcalc(&sec->ceilingshade,&sec->visibility) * 0.005);
//Use clamping for tiled sky textures //Use clamping for tiled sky textures
for (i=(1<<pskybits)-1;i>0;i--) for (i=(1<<pskybits)-1;i>0;i--)
if (pskyoff[i] != pskyoff[i-1]) if (pskyoff[i] != pskyoff[i-1])
@ -3199,7 +3199,7 @@ static void polymost_drawalls (long bunch)
if (wal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip if (wal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (!nofog) if (!nofog)
bglFogf(GL_FOG_DENSITY,fogcalc(wal->shade,sec->visibility)); bglFogf(GL_FOG_DENSITY,fogcalc(&wal->shade,&sec->visibility));
#endif #endif
pow2xsplit = 1; domost(x1,ocy1,x0,ocy0); pow2xsplit = 1; domost(x1,ocy1,x0,ocy0);
if (wal->cstat&8) { gux = ogux; guy = oguy; guo = oguo; } if (wal->cstat&8) { gux = ogux; guy = oguy; guo = oguo; }
@ -3237,7 +3237,7 @@ static void polymost_drawalls (long bunch)
if (nwal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip if (nwal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (!nofog) if (!nofog)
bglFogf(GL_FOG_DENSITY,fogcalc(nwal->shade,sec->visibility)); bglFogf(GL_FOG_DENSITY,fogcalc(&nwal->shade,&sec->visibility));
#endif #endif
pow2xsplit = 1; domost(x0,ofy0,x1,ofy1); pow2xsplit = 1; domost(x0,ofy0,x1,ofy1);
if (wal->cstat&(2+8)) { guo = oguo; gux = ogux; guy = oguy; } if (wal->cstat&(2+8)) { guo = oguo; gux = ogux; guy = oguy; }
@ -3271,7 +3271,7 @@ static void polymost_drawalls (long bunch)
if (wal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip if (wal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (!nofog) if (!nofog)
bglFogf(GL_FOG_DENSITY,fogcalc(wal->shade,sec->visibility)); bglFogf(GL_FOG_DENSITY,fogcalc(&wal->shade,&sec->visibility));
#endif #endif
pow2xsplit = 1; domost(x0,-10000,x1,-10000); pow2xsplit = 1; domost(x0,-10000,x1,-10000);
} }
@ -3726,7 +3726,7 @@ if (yp1 < SCISDIST) { t1 = (SCISDIST-oyp0)/(yp1-oyp0); xp1 = (xp1-oxp0)*t1+oxp0;
bglFogfv(GL_FOG_COLOR,col); bglFogfv(GL_FOG_COLOR,col);
if (!nofog) if (!nofog)
bglFogf(GL_FOG_DENSITY,fogcalc(wal->shade,sec->visibility)); bglFogf(GL_FOG_DENSITY,fogcalc(&wal->shade,&sec->visibility));
} }
} }
#endif #endif
@ -3834,7 +3834,7 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; }
col[3] = 0; col[3] = 0;
bglFogfv(GL_FOG_COLOR,col); //default is 0,0,0,0 bglFogfv(GL_FOG_COLOR,col); //default is 0,0,0,0
bglFogf(GL_FOG_DENSITY,fogcalc(globalshade,sector[tspr->sectnum].visibility)); bglFogf(GL_FOG_DENSITY,fogcalc((signed char *)&globalshade,&sector[tspr->sectnum].visibility));
} }
while (rendmode >= 3 && !(spriteext[tspr->owner].flags&SPREXT_NOTMD)) { while (rendmode >= 3 && !(spriteext[tspr->owner].flags&SPREXT_NOTMD)) {

View File

@ -3512,7 +3512,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
if (!appactive && fullscreen) if (!appactive && fullscreen)
{ {
realfs = fullscreen; realfs = fullscreen;
setvideomode(xdim,ydim,bpp,!fullscreen); setgamemode(!fullscreen,xdim,ydim,bpp);
ShowWindow(hWindow, SW_MINIMIZE); ShowWindow(hWindow, SW_MINIMIZE);
} }
else if (appactive && realfs) else if (appactive && realfs)
@ -3520,7 +3520,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
ShowWindow(hWindow, SW_SHOWNORMAL); ShowWindow(hWindow, SW_SHOWNORMAL);
SetForegroundWindow(hWindow); SetForegroundWindow(hWindow);
SetFocus(hWindow); SetFocus(hWindow);
setvideomode(xdim,ydim,bpp,realfs); setgamemode(realfs,xdim,ydim,bpp);
realfs = 0; realfs = 0;
} }
} }