From 13dde60ccda6469527db3ddf81c393a94186dd2e Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 24 Jul 2011 18:40:10 +0000 Subject: [PATCH] More fog/visibility tweaking. This makes Polymost's not depend on the screen width. git-svn-id: https://svn.eduke32.com/eduke32@1944 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/polymost.h | 3 +-- polymer/eduke32/build/src/engine.c | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/polymer/eduke32/build/include/polymost.h b/polymer/eduke32/build/include/polymost.h index 39e4e69d3..ae0adf943 100644 --- a/polymer/eduke32/build/include/polymost.h +++ b/polymer/eduke32/build/include/polymost.h @@ -121,8 +121,7 @@ extern double gyxscale, gxyaspect, gviewxrange, ghalfx, grhalfxdown10, grhalfxdo extern double gcosang, gsinang, gcosang2, gsinang2; extern double gchang, gshang, gctang, gstang, gvisibility; -//#define FOGSCALE 0.0000768 -#define FOGSCALE ((0.0000768+0.0000128)/(1 + 0.5f*(getrendermode()==4))) +#define FOGSCALE 0.0000768 extern float fogresult, fogcol[4], fogtable[4*MAXPALOOKUPS]; diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 3b081646c..7d329f364 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -7755,7 +7755,27 @@ void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, i = mulscale16(xdimenscale,viewingrangerecip); globalpisibility = mulscale16(parallaxvisibility,i); - globalvisibility = getrendermode()==0 ? mulscale16(visibility,i) : scale(visibility<<2,4,3); + switch (getrendermode()) + { + // switch on renderers to make fog look almost the same everywhere + + case 0: + globalvisibility = mulscale16(visibility,i); + break; +#ifdef USE_OPENGL + case 3: + // I have no idea what the significance of this constant is, + // it was found out experimentally. v v + globalvisibility = scale(visibility<<2, xdimen, 1100); + break; +# ifdef POLYMER + case 4: + globalvisibility = visibility<<2; + break; +# endif +#endif + } + globalhisibility = mulscale16(globalvisibility,xyaspect); globalcisibility = mulscale8(globalhisibility,320);