diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 75c2c63f3..696748a33 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -440,7 +440,7 @@ EXTERN int16_t numshades; EXTERN char *palookup[MAXPALOOKUPS]; EXTERN char parallaxtype, showinvisibility; EXTERN int32_t parallaxyoffs, parallaxyscale; -EXTERN int32_t visibility, parallaxvisibility; +EXTERN int32_t g_visibility, parallaxvisibility; EXTERN int32_t g_rotatespriteNoWidescreen; EXTERN int32_t windowx1, windowy1, windowx2, windowy2; diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index b0e3a23b3..5928928b2 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -3421,7 +3421,7 @@ static int32_t setup_globals_cf1(const sectortype *sec, int32_t pal, int32_t zd, globalshade = shade; globvis = globalcisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis, (int32_t)((uint8_t)(sec->visibility+16))); + if (sec->visibility != 0) globvis = mulscale4(globvis, (uint8_t)(sec->visibility+16)); globalorientation = stat; if ((globalorientation&64) == 0) @@ -4303,7 +4303,7 @@ static void grouscan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat) asm1 = -(globalzd>>(16-BITSOFPRECISION)); globvis = globalvisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); + if (sec->visibility != 0) globvis = mulscale4(globvis, (uint8_t)(sec->visibility+16)); globvis = mulscale13(globvis,daz); globvis = mulscale16(globvis,xdimscale); j = FP_OFF(palookup[globalpal]); @@ -4381,7 +4381,7 @@ static void parascan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat, i globalhorizbak = globalhoriz; globvis = globalpisibility; //globalorientation = 0L; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); + if (sec->visibility != 0) globvis = mulscale4(globvis, (uint8_t)(sec->visibility+16)); if (dastat == 0) { @@ -4568,7 +4568,7 @@ static void setup_globals_wall2(const walltype *wal, uint8_t secvisibility, int3 globvis = globalvisibility; if (secvisibility != 0) - globvis = mulscale4(globvis, (int32_t)((uint8_t)(secvisibility+16))); + globvis = mulscale4(globvis, (uint8_t)(secvisibility+16)); globalshiftval = logtilesizy; #if !defined CLASSIC_NONPOW2_YSIZE_WALLS @@ -5420,7 +5420,7 @@ static void setup_globals_sprite1(const spritetype *tspr, const sectortype *sec, globalypanning = 0; globvis = globalvisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); + if (sec->visibility != 0) globvis = mulscale4(globvis, (uint8_t)(sec->visibility+16)); logtilesizy = (picsiz[globalpicnum]>>4); tsizy = tilesizy[globalpicnum]; @@ -6205,7 +6205,7 @@ draw_as_face_sprite: globalbufplc = waloff[globalpicnum]; globvis = mulscale16(globalhisibility,viewingrange); - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); + if (sec->visibility != 0) globvis = mulscale4(globvis, (uint8_t)(sec->visibility+16)); x = picsiz[globalpicnum]; y = ((x>>4)&15); x &= 15; #if 0 @@ -6324,7 +6324,7 @@ draw_as_face_sprite: tspr->z -= mulscale14(yoff,nyrepeat); globvis = globalvisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); + if (sec->visibility != 0) globvis = mulscale4(globvis, (uint8_t)(sec->visibility+16)); #ifdef YAX_ENABLE if (yax_globallev==YAX_MAXDRAWS || searchit==2) @@ -8344,7 +8344,7 @@ int32_t initengine(void) // automapping = 0; totalclock = 0; - visibility = 512; + g_visibility = 512; parallaxvisibility = 512; if (loadpalette()) @@ -8491,17 +8491,17 @@ int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, // switch on renderers to make fog look almost the same everywhere case 0: - globalvisibility = mulscale16(visibility,i); + globalvisibility = mulscale16(g_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); + globalvisibility = scale(g_visibility<<2, xdimen, 1100); break; # ifdef POLYMER case 4: - globalvisibility = visibility<<2; + globalvisibility = g_visibility<<2; break; # endif #endif @@ -9190,7 +9190,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang) globalbufplc = waloff[globalpicnum]; globalshade = max(min(sec->floorshade,numshades-1),0); globvis = globalhisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); + if (sec->visibility != 0) globvis = mulscale4(globvis, (uint8_t)(sec->visibility+16)); globalpolytype = 0; if ((globalorientation&64) == 0) { @@ -9324,7 +9324,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang) globalshade = max(min(globalshade+spr->shade+6,numshades-1),0); asm3 = FP_OFF(palookup[spr->pal]+(globalshade<<8)); globvis = globalhisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); + if (sec->visibility != 0) globvis = mulscale4(globvis, (uint8_t)(sec->visibility+16)); globalpolytype = ((spr->cstat&2)>>1)+1; //relative alignment stuff diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 28328aab5..4b5a8d8ad 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -3375,24 +3375,6 @@ static void polymost_drawalls(int32_t bunch) sectnum = thesector[bunchfirst[bunch]]; sec = §or[sectnum]; -#if 0 // USE_OPENGL - if (!nofog) - { - if (rendmode >= 3) - { - float col[4]; - col[0] = (float)palookupfog[sec->floorpal].r / 63.f; - col[1] = (float)palookupfog[sec->floorpal].g / 63.f; - col[2] = (float)palookupfog[sec->floorpal].b / 63.f; - col[3] = 0; - bglFogfv(GL_FOG_COLOR,col); - bglFogf(GL_FOG_DENSITY,fogcalc(sec->floorshade,sec->visibility)); - - // bglFogf(GL_FOG_DENSITY,gvisibility*((float)((uint8_t)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); - } - } -#endif - //DRAW WALLS SECTION! for (z=bunchfirst[bunch]; z>=0; z=p2[z]) { @@ -3484,13 +3466,6 @@ static void polymost_drawalls(int32_t bunch) #ifdef USE_OPENGL if (rendmode >= 3) { - /* if (!nofog) { - bglDisable(GL_FOG); - //r = ((float)globalpisibility)*((float)((uint8_t)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))*FOGSCALE; - //r *= ((double)xdimscale*(double)viewingrange*gdo) / (65536.0*65536.0); - //bglFogf(GL_FOG_DENSITY,r); - } */ - if (!nofog) { fogcalc(sec->floorshade,sec->visibility,sec->floorpal); @@ -3732,10 +3707,7 @@ static void polymost_drawalls(int32_t bunch) { skyclamphack = 0; if (!nofog) - { bglEnable(GL_FOG); - //bglFogf(GL_FOG_DENSITY,gvisibility*((float)((uint8_t)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); - } } #endif } @@ -3775,13 +3747,6 @@ static void polymost_drawalls(int32_t bunch) #ifdef USE_OPENGL if (rendmode >= 3) { - /* if (!nofog) { - bglDisable(GL_FOG); - //r = ((float)globalpisibility)*((float)((uint8_t)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))*FOGSCALE; - //r *= ((double)xdimscale*(double)viewingrange*gdo) / (65536.0*65536.0); - //bglFogf(GL_FOG_DENSITY,r); - } - */ if (!nofog) { fogcalc(sec->ceilingshade,sec->visibility,sec->ceilingpal); @@ -4025,10 +3990,7 @@ static void polymost_drawalls(int32_t bunch) { skyclamphack = 0; if (!nofog) - { bglEnable(GL_FOG); - //bglFogf(GL_FOG_DENSITY,gvisibility*((float)((uint8_t)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); - } } #endif } diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index cba266e74..7ca3a6499 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -5477,10 +5477,10 @@ static void Keys3d(void) if (eitherCTRL) //CTRL { if (tsign==1) - visibility <<= (int)(visibility < 16384); + g_visibility <<= (int)(g_visibility < 16384); else - visibility >>= (int)(visibility > 32); - silentmessage("Global visibility %d", visibility); + g_visibility >>= (int)(g_visibility > 32); + silentmessage("Global visibility %d", g_visibility); } else { diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 9053cc586..c1152cb45 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -3429,8 +3429,8 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, i preparemirror(x,y,z,a,horiz,g_mirrorWall[i],g_mirrorSector[i],&tposx,&tposy,&tang); - j = visibility; - visibility = (j>>1) + (j>>2); + j = g_visibility; + g_visibility = (j>>1) + (j>>2); if (getrendermode()==0) { @@ -3451,7 +3451,7 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, i drawmasks(); completemirror(); //Reverse screen x-wise in this function - visibility = j; + g_visibility = j; } if (!g_fakeMultiMode) @@ -3497,7 +3497,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) else smoothratio = clamp((totalclock-ototalclock)*(65536/4), 0, 65536); - visibility = (int32_t)(p->visibility * (numplayers > 1 ? 1.f : r_ambientlightrecip)); + g_visibility = (int32_t)(p->visibility * (numplayers > 1 ? 1.f : r_ambientlightrecip)); ud.camerasect = p->cursectnum;