mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 23:32:04 +00:00
Convert r_actualextralight global to a function
This commit is contained in:
parent
40f79371f5
commit
f912b4ab8b
9 changed files with 19 additions and 23 deletions
|
@ -524,8 +524,7 @@ namespace swrenderer
|
|||
}
|
||||
else
|
||||
{
|
||||
draw_segment->shade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, curline->frontsector->lightlevel)
|
||||
+ r_actualextralight);
|
||||
draw_segment->shade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, curline->frontsector->lightlevel) + R_ActualExtraLight(foggy));
|
||||
}
|
||||
|
||||
if (draw_segment->bFogBoundary || draw_segment->maskedtexturecol != -1)
|
||||
|
@ -938,8 +937,7 @@ namespace swrenderer
|
|||
|
||||
if (fixedcolormap == NULL && fixedlightlev < 0)
|
||||
{
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, frontsector->lightlevel)
|
||||
+ r_actualextralight);
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, frontsector->lightlevel) + R_ActualExtraLight(foggy));
|
||||
double GlobVis = r_WallVisibility;
|
||||
rw_lightleft = float(GlobVis / WallC.sz1);
|
||||
rw_lightstep = float((GlobVis / WallC.sz2 - rw_lightleft) / (WallC.sx2 - WallC.sx1));
|
||||
|
|
|
@ -464,7 +464,7 @@ namespace swrenderer
|
|||
|
||||
lightlist_t *lit = &frontsector->e->XFloor.lightlist[i];
|
||||
basecolormap = lit->extra_colormap;
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(fogginess, *lit->p_lightlevel, lit->lightsource != NULL) + r_actualextralight);
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(fogginess, *lit->p_lightlevel, lit->lightsource != NULL) + R_ActualExtraLight(foggy));
|
||||
}
|
||||
|
||||
ProcessNormalWall(WallC, x1, x2, up, dwal, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep);
|
||||
|
|
|
@ -51,7 +51,6 @@ namespace swrenderer
|
|||
FSpecialColormap *realfixedcolormap;
|
||||
|
||||
bool foggy; // [RH] ignore extralight and fullbright?
|
||||
int r_actualextralight;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
|
@ -57,13 +57,14 @@ namespace swrenderer
|
|||
extern float r_TiltVisibility;
|
||||
extern double r_SpriteVisibility;
|
||||
|
||||
extern int r_actualextralight;
|
||||
extern bool foggy;
|
||||
extern int fixedlightlev;
|
||||
extern FSWColormap *fixedcolormap;
|
||||
extern FSpecialColormap *realfixedcolormap;
|
||||
extern FDynamicColormap *basecolormap; // [RH] Colormap for sector currently being drawn
|
||||
|
||||
inline int R_ActualExtraLight(bool fog) { return fog ? 0 : extralight << 4; }
|
||||
|
||||
void R_SetVisibility(double visibility);
|
||||
double R_GetVisibility();
|
||||
|
||||
|
|
|
@ -477,7 +477,6 @@ namespace swrenderer
|
|||
|
||||
// [RH] set foggy flag
|
||||
foggy = level.fadeto || frontsector->ColorMap->Fade || (level.flags & LEVEL_HASFADETABLE);
|
||||
r_actualextralight = foggy ? 0 : extralight << 4;
|
||||
|
||||
// kg3D - fake lights
|
||||
if (fixedlightlev < 0 && frontsector->e && frontsector->e->XFloor.lightlist.Size())
|
||||
|
@ -506,7 +505,7 @@ namespace swrenderer
|
|||
frontsector->heightsec->GetTexture(sector_t::floor) == skyflatnum) ?
|
||||
VisiblePlaneList::Instance()->FindPlane(frontsector->ceilingplane, // killough 3/8/98
|
||||
frontsector->GetTexture(sector_t::ceiling),
|
||||
ceilinglightlevel + r_actualextralight, // killough 4/11/98
|
||||
ceilinglightlevel + R_ActualExtraLight(foggy), // killough 4/11/98
|
||||
frontsector->GetAlpha(sector_t::ceiling),
|
||||
!!(frontsector->GetFlags(sector_t::ceiling) & PLANEF_ADDITIVE),
|
||||
frontsector->planes[sector_t::ceiling].xform,
|
||||
|
@ -546,7 +545,7 @@ namespace swrenderer
|
|||
frontsector->heightsec->GetTexture(sector_t::ceiling) == skyflatnum) ?
|
||||
VisiblePlaneList::Instance()->FindPlane(frontsector->floorplane,
|
||||
frontsector->GetTexture(sector_t::floor),
|
||||
floorlightlevel + r_actualextralight, // killough 3/16/98
|
||||
floorlightlevel + R_ActualExtraLight(foggy), // killough 3/16/98
|
||||
frontsector->GetAlpha(sector_t::floor),
|
||||
!!(frontsector->GetFlags(sector_t::floor) & PLANEF_ADDITIVE),
|
||||
frontsector->planes[sector_t::floor].xform,
|
||||
|
@ -611,7 +610,7 @@ namespace swrenderer
|
|||
ceilingplane = nullptr;
|
||||
floorplane = VisiblePlaneList::Instance()->FindPlane(frontsector->floorplane,
|
||||
frontsector->GetTexture(sector_t::floor),
|
||||
floorlightlevel + r_actualextralight, // killough 3/16/98
|
||||
floorlightlevel + R_ActualExtraLight(foggy), // killough 3/16/98
|
||||
frontsector->GetAlpha(sector_t::floor),
|
||||
!!(clip3d->fakeFloor->flags & FF_ADDITIVETRANS),
|
||||
frontsector->planes[position].xform,
|
||||
|
@ -676,7 +675,7 @@ namespace swrenderer
|
|||
floorplane = nullptr;
|
||||
ceilingplane = VisiblePlaneList::Instance()->FindPlane(frontsector->ceilingplane, // killough 3/8/98
|
||||
frontsector->GetTexture(sector_t::ceiling),
|
||||
ceilinglightlevel + r_actualextralight, // killough 4/11/98
|
||||
ceilinglightlevel + R_ActualExtraLight(foggy), // killough 4/11/98
|
||||
frontsector->GetAlpha(sector_t::ceiling),
|
||||
!!(clip3d->fakeFloor->flags & FF_ADDITIVETRANS),
|
||||
frontsector->planes[position].xform,
|
||||
|
@ -710,7 +709,7 @@ namespace swrenderer
|
|||
// [RH] Add particles
|
||||
if ((unsigned int)(sub - subsectors) < (unsigned int)numsubsectors)
|
||||
{ // Only do it for the main BSP.
|
||||
int shade = LIGHT2SHADE((floorlightlevel + ceilinglightlevel) / 2 + r_actualextralight);
|
||||
int shade = LIGHT2SHADE((floorlightlevel + ceilinglightlevel) / 2 + R_ActualExtraLight(foggy));
|
||||
for (WORD i = ParticlesInSubsec[(unsigned int)(sub - subsectors)]; i != NO_PARTICLE; i = Particles[i].snext)
|
||||
{
|
||||
RenderParticle::Project(Particles + i, subsectors[sub - subsectors].sector, shade, FakeSide);
|
||||
|
@ -825,7 +824,7 @@ namespace swrenderer
|
|||
// Well, now it will be done.
|
||||
sec->validcount = validcount;
|
||||
|
||||
int spriteshade = LIGHT2SHADE(lightlevel + r_actualextralight);
|
||||
int spriteshade = LIGHT2SHADE(lightlevel + R_ActualExtraLight(foggy));
|
||||
|
||||
// Handle all things in sector.
|
||||
for (auto p = sec->touching_renderthings; p != nullptr; p = p->m_snext)
|
||||
|
|
|
@ -240,7 +240,7 @@ namespace swrenderer
|
|||
}
|
||||
else
|
||||
{ // diminished light
|
||||
int spriteshade = LIGHT2SHADE(sec->lightlevel + r_actualextralight);
|
||||
int spriteshade = LIGHT2SHADE(sec->lightlevel + R_ActualExtraLight(foggy));
|
||||
spr->Style.BaseColormap = mybasecolormap;
|
||||
spr->Style.ColormapNum = GETPALOOKUP(r_SpriteVisibility / MAX(MINZ, (double)spr->depth), spriteshade);
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ namespace swrenderer
|
|||
{
|
||||
lightlist_t *lit = &frontsector->e->XFloor.lightlist[i];
|
||||
basecolormap = lit->extra_colormap;
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != nullptr) + r_actualextralight);
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != nullptr) + R_ActualExtraLight(foggy));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -746,7 +746,7 @@ namespace swrenderer
|
|||
{
|
||||
lightlist_t *lit = &backsector->e->XFloor.lightlist[j];
|
||||
basecolormap = lit->extra_colormap;
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != nullptr) + r_actualextralight);
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != nullptr) + R_ActualExtraLight(foggy));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -759,7 +759,7 @@ namespace swrenderer
|
|||
{
|
||||
lightlist_t *lit = &frontsector->e->XFloor.lightlist[j];
|
||||
basecolormap = lit->extra_colormap;
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != nullptr) + r_actualextralight);
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != nullptr) + R_ActualExtraLight(foggy));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -920,7 +920,7 @@ namespace swrenderer
|
|||
{
|
||||
lightlist_t *lit = &backsector->e->XFloor.lightlist[j];
|
||||
basecolormap = lit->extra_colormap;
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != nullptr) + r_actualextralight);
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != nullptr) + R_ActualExtraLight(foggy));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -933,7 +933,7 @@ namespace swrenderer
|
|||
{
|
||||
lightlist_t *lit = &frontsector->e->XFloor.lightlist[j];
|
||||
basecolormap = lit->extra_colormap;
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != nullptr) + r_actualextralight);
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != nullptr) + R_ActualExtraLight(foggy));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,10 +137,9 @@ namespace swrenderer
|
|||
|
||||
// [RH] set foggy flag
|
||||
foggy = (level.fadeto || basecolormap->Fade || (level.flags & LEVEL_HASFADETABLE));
|
||||
r_actualextralight = foggy ? 0 : extralight << 4;
|
||||
|
||||
// get light level
|
||||
lightnum = ((floorlight + ceilinglight) >> 1) + r_actualextralight;
|
||||
lightnum = ((floorlight + ceilinglight) >> 1) + R_ActualExtraLight(foggy);
|
||||
int spriteshade = LIGHT2SHADE(lightnum) - 24 * FRACUNIT;
|
||||
|
||||
if (camera->player != NULL)
|
||||
|
|
|
@ -174,7 +174,7 @@ namespace swrenderer
|
|||
rereadcolormap = false;
|
||||
}
|
||||
|
||||
int shade = LIGHT2SHADE(spr->sector->lightlevel + r_actualextralight);
|
||||
int shade = LIGHT2SHADE(spr->sector->lightlevel + R_ActualExtraLight(foggy));
|
||||
double GlobVis = r_WallVisibility;
|
||||
float lightleft = float(GlobVis / spr->wallc.sz1);
|
||||
float lightstep = float((GlobVis / spr->wallc.sz2 - lightleft) / (spr->wallc.sx2 - spr->wallc.sx1));
|
||||
|
|
Loading…
Reference in a new issue