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