mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 11:10:39 +00:00
Rename global visibility to g_visibility, remove useless casts & old fog code.
git-svn-id: https://svn.eduke32.com/eduke32@3287 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
884302bea1
commit
92dabb3694
5 changed files with 21 additions and 59 deletions
|
@ -440,7 +440,7 @@ EXTERN int16_t numshades;
|
||||||
EXTERN char *palookup[MAXPALOOKUPS];
|
EXTERN char *palookup[MAXPALOOKUPS];
|
||||||
EXTERN char parallaxtype, showinvisibility;
|
EXTERN char parallaxtype, showinvisibility;
|
||||||
EXTERN int32_t parallaxyoffs, parallaxyscale;
|
EXTERN int32_t parallaxyoffs, parallaxyscale;
|
||||||
EXTERN int32_t visibility, parallaxvisibility;
|
EXTERN int32_t g_visibility, parallaxvisibility;
|
||||||
EXTERN int32_t g_rotatespriteNoWidescreen;
|
EXTERN int32_t g_rotatespriteNoWidescreen;
|
||||||
|
|
||||||
EXTERN int32_t windowx1, windowy1, windowx2, windowy2;
|
EXTERN int32_t windowx1, windowy1, windowx2, windowy2;
|
||||||
|
|
|
@ -3421,7 +3421,7 @@ static int32_t setup_globals_cf1(const sectortype *sec, int32_t pal, int32_t zd,
|
||||||
|
|
||||||
globalshade = shade;
|
globalshade = shade;
|
||||||
globvis = globalcisibility;
|
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;
|
globalorientation = stat;
|
||||||
|
|
||||||
if ((globalorientation&64) == 0)
|
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));
|
asm1 = -(globalzd>>(16-BITSOFPRECISION));
|
||||||
|
|
||||||
globvis = globalvisibility;
|
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 = mulscale13(globvis,daz);
|
||||||
globvis = mulscale16(globvis,xdimscale);
|
globvis = mulscale16(globvis,xdimscale);
|
||||||
j = FP_OFF(palookup[globalpal]);
|
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;
|
globalhorizbak = globalhoriz;
|
||||||
globvis = globalpisibility;
|
globvis = globalpisibility;
|
||||||
//globalorientation = 0L;
|
//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)
|
if (dastat == 0)
|
||||||
{
|
{
|
||||||
|
@ -4568,7 +4568,7 @@ static void setup_globals_wall2(const walltype *wal, uint8_t secvisibility, int3
|
||||||
|
|
||||||
globvis = globalvisibility;
|
globvis = globalvisibility;
|
||||||
if (secvisibility != 0)
|
if (secvisibility != 0)
|
||||||
globvis = mulscale4(globvis, (int32_t)((uint8_t)(secvisibility+16)));
|
globvis = mulscale4(globvis, (uint8_t)(secvisibility+16));
|
||||||
|
|
||||||
globalshiftval = logtilesizy;
|
globalshiftval = logtilesizy;
|
||||||
#if !defined CLASSIC_NONPOW2_YSIZE_WALLS
|
#if !defined CLASSIC_NONPOW2_YSIZE_WALLS
|
||||||
|
@ -5420,7 +5420,7 @@ static void setup_globals_sprite1(const spritetype *tspr, const sectortype *sec,
|
||||||
globalypanning = 0;
|
globalypanning = 0;
|
||||||
|
|
||||||
globvis = globalvisibility;
|
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);
|
logtilesizy = (picsiz[globalpicnum]>>4);
|
||||||
tsizy = tilesizy[globalpicnum];
|
tsizy = tilesizy[globalpicnum];
|
||||||
|
@ -6205,7 +6205,7 @@ draw_as_face_sprite:
|
||||||
globalbufplc = waloff[globalpicnum];
|
globalbufplc = waloff[globalpicnum];
|
||||||
|
|
||||||
globvis = mulscale16(globalhisibility,viewingrange);
|
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;
|
x = picsiz[globalpicnum]; y = ((x>>4)&15); x &= 15;
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -6324,7 +6324,7 @@ draw_as_face_sprite:
|
||||||
tspr->z -= mulscale14(yoff,nyrepeat);
|
tspr->z -= mulscale14(yoff,nyrepeat);
|
||||||
|
|
||||||
globvis = globalvisibility;
|
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
|
#ifdef YAX_ENABLE
|
||||||
if (yax_globallev==YAX_MAXDRAWS || searchit==2)
|
if (yax_globallev==YAX_MAXDRAWS || searchit==2)
|
||||||
|
@ -8344,7 +8344,7 @@ int32_t initengine(void)
|
||||||
// automapping = 0;
|
// automapping = 0;
|
||||||
|
|
||||||
totalclock = 0;
|
totalclock = 0;
|
||||||
visibility = 512;
|
g_visibility = 512;
|
||||||
parallaxvisibility = 512;
|
parallaxvisibility = 512;
|
||||||
|
|
||||||
if (loadpalette())
|
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
|
// switch on renderers to make fog look almost the same everywhere
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
globalvisibility = mulscale16(visibility,i);
|
globalvisibility = mulscale16(g_visibility,i);
|
||||||
break;
|
break;
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
case 3:
|
case 3:
|
||||||
// I have no idea what the significance of this constant is,
|
// I have no idea what the significance of this constant is,
|
||||||
// it was found out experimentally. v v
|
// it was found out experimentally. v v
|
||||||
globalvisibility = scale(visibility<<2, xdimen, 1100);
|
globalvisibility = scale(g_visibility<<2, xdimen, 1100);
|
||||||
break;
|
break;
|
||||||
# ifdef POLYMER
|
# ifdef POLYMER
|
||||||
case 4:
|
case 4:
|
||||||
globalvisibility = visibility<<2;
|
globalvisibility = g_visibility<<2;
|
||||||
break;
|
break;
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -9190,7 +9190,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
|
||||||
globalbufplc = waloff[globalpicnum];
|
globalbufplc = waloff[globalpicnum];
|
||||||
globalshade = max(min(sec->floorshade,numshades-1),0);
|
globalshade = max(min(sec->floorshade,numshades-1),0);
|
||||||
globvis = globalhisibility;
|
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;
|
globalpolytype = 0;
|
||||||
if ((globalorientation&64) == 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);
|
globalshade = max(min(globalshade+spr->shade+6,numshades-1),0);
|
||||||
asm3 = FP_OFF(palookup[spr->pal]+(globalshade<<8));
|
asm3 = FP_OFF(palookup[spr->pal]+(globalshade<<8));
|
||||||
globvis = globalhisibility;
|
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;
|
globalpolytype = ((spr->cstat&2)>>1)+1;
|
||||||
|
|
||||||
//relative alignment stuff
|
//relative alignment stuff
|
||||||
|
|
|
@ -3375,24 +3375,6 @@ static void polymost_drawalls(int32_t bunch)
|
||||||
|
|
||||||
sectnum = thesector[bunchfirst[bunch]]; sec = §or[sectnum];
|
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!
|
//DRAW WALLS SECTION!
|
||||||
for (z=bunchfirst[bunch]; z>=0; z=p2[z])
|
for (z=bunchfirst[bunch]; z>=0; z=p2[z])
|
||||||
{
|
{
|
||||||
|
@ -3484,13 +3466,6 @@ static void polymost_drawalls(int32_t bunch)
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
if (rendmode >= 3)
|
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)
|
if (!nofog)
|
||||||
{
|
{
|
||||||
fogcalc(sec->floorshade,sec->visibility,sec->floorpal);
|
fogcalc(sec->floorshade,sec->visibility,sec->floorpal);
|
||||||
|
@ -3732,10 +3707,7 @@ static void polymost_drawalls(int32_t bunch)
|
||||||
{
|
{
|
||||||
skyclamphack = 0;
|
skyclamphack = 0;
|
||||||
if (!nofog)
|
if (!nofog)
|
||||||
{
|
|
||||||
bglEnable(GL_FOG);
|
bglEnable(GL_FOG);
|
||||||
//bglFogf(GL_FOG_DENSITY,gvisibility*((float)((uint8_t)(sec->visibility<240?sec->visibility+16:sec->visibility-239))));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -3775,13 +3747,6 @@ static void polymost_drawalls(int32_t bunch)
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
if (rendmode >= 3)
|
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)
|
if (!nofog)
|
||||||
{
|
{
|
||||||
fogcalc(sec->ceilingshade,sec->visibility,sec->ceilingpal);
|
fogcalc(sec->ceilingshade,sec->visibility,sec->ceilingpal);
|
||||||
|
@ -4025,10 +3990,7 @@ static void polymost_drawalls(int32_t bunch)
|
||||||
{
|
{
|
||||||
skyclamphack = 0;
|
skyclamphack = 0;
|
||||||
if (!nofog)
|
if (!nofog)
|
||||||
{
|
|
||||||
bglEnable(GL_FOG);
|
bglEnable(GL_FOG);
|
||||||
//bglFogf(GL_FOG_DENSITY,gvisibility*((float)((uint8_t)(sec->visibility<240?sec->visibility+16:sec->visibility-239))));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -5477,10 +5477,10 @@ static void Keys3d(void)
|
||||||
if (eitherCTRL) //CTRL
|
if (eitherCTRL) //CTRL
|
||||||
{
|
{
|
||||||
if (tsign==1)
|
if (tsign==1)
|
||||||
visibility <<= (int)(visibility < 16384);
|
g_visibility <<= (int)(g_visibility < 16384);
|
||||||
else
|
else
|
||||||
visibility >>= (int)(visibility > 32);
|
g_visibility >>= (int)(g_visibility > 32);
|
||||||
silentmessage("Global visibility %d", visibility);
|
silentmessage("Global visibility %d", g_visibility);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -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);
|
preparemirror(x,y,z,a,horiz,g_mirrorWall[i],g_mirrorSector[i],&tposx,&tposy,&tang);
|
||||||
|
|
||||||
j = visibility;
|
j = g_visibility;
|
||||||
visibility = (j>>1) + (j>>2);
|
g_visibility = (j>>1) + (j>>2);
|
||||||
|
|
||||||
if (getrendermode()==0)
|
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();
|
drawmasks();
|
||||||
completemirror(); //Reverse screen x-wise in this function
|
completemirror(); //Reverse screen x-wise in this function
|
||||||
visibility = j;
|
g_visibility = j;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_fakeMultiMode)
|
if (!g_fakeMultiMode)
|
||||||
|
@ -3497,7 +3497,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
|
||||||
else
|
else
|
||||||
smoothratio = clamp((totalclock-ototalclock)*(65536/4), 0, 65536);
|
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;
|
ud.camerasect = p->cursectnum;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue