simplify SOFTLIGHT alot
also should make sure it gets applied everywhere lul
This commit is contained in:
1 parent
61118b348c
commit
8e33d2e1b2
1 file changed
+29
-29
+29
-29
@@ -508,6 +508,8 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col
|
||||
poly_color.s.blue = (UINT8)blue;
|
||||
}
|
||||
|
||||
light_level = SOFTLIGHT(light_level);
|
||||
|
||||
// Clamp the light level, since it can sometimes go out of the 0-255 range from animations
|
||||
light_level = min(max(light_level, cv_secbright.value), 255);
|
||||
|
||||
@@ -1123,7 +1125,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
||||
{
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
lightnum = SOFTLIGHT(pfloor->master->frontsector->lightlevel);
|
||||
lightnum = pfloor->master->frontsector->lightlevel;
|
||||
colormap = pfloor->master->frontsector->extra_colormap;
|
||||
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, v1x, v1y, v2x, v2y);
|
||||
}else{
|
||||
@@ -1135,7 +1137,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
||||
{
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
lightnum = SOFTLIGHT(*list[i].lightlevel);
|
||||
lightnum = *list[i].lightlevel;
|
||||
colormap = list[i].extra_colormap;
|
||||
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, v1x, v1y, v2x, v2y);
|
||||
}else{
|
||||
@@ -1510,7 +1512,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
lightnum = SOFTLIGHT(gr_frontsector->lightlevel);
|
||||
lightnum = gr_frontsector->lightlevel;
|
||||
colormap = gr_frontsector->extra_colormap;
|
||||
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y);
|
||||
}
|
||||
@@ -2241,7 +2243,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
lightnum = SOFTLIGHT(rover->master->frontsector->lightlevel);
|
||||
lightnum = rover->master->frontsector->lightlevel;
|
||||
colormap = rover->master->frontsector->extra_colormap;
|
||||
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y);
|
||||
}else{
|
||||
@@ -2249,7 +2251,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
colormap = rover->master->frontsector->extra_colormap;
|
||||
}
|
||||
|
||||
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(SOFTLIGHT(rover->master->frontsector->lightlevel), rover->master->frontsector->extra_colormap);
|
||||
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap);
|
||||
|
||||
if (gr_frontsector->numlights)
|
||||
HWR_SplitWall(gr_frontsector, wallVerts, 0, false, &Surf, rover->flags, rover, 0);
|
||||
@@ -2380,7 +2382,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
lightnum = SOFTLIGHT(rover->master->frontsector->lightlevel);
|
||||
lightnum = rover->master->frontsector->lightlevel;
|
||||
colormap = rover->master->frontsector->extra_colormap;
|
||||
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y);
|
||||
}else{
|
||||
@@ -2388,7 +2390,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
colormap = rover->master->frontsector->extra_colormap;
|
||||
}
|
||||
|
||||
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(SOFTLIGHT(rover->master->frontsector->lightlevel), rover->master->frontsector->extra_colormap);
|
||||
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap);
|
||||
|
||||
if (gr_backsector->numlights)
|
||||
HWR_SplitWall(gr_backsector, wallVerts, 0, false, &Surf, rover->flags, rover, 0);
|
||||
@@ -3065,13 +3067,13 @@ void HWR_AddPolyObjectPlanes(void)
|
||||
FSurfaceInfo Surf;
|
||||
FBITFIELD blendmode = HWR_TranstableToAlpha(po_ptrs[i]->translucency, &Surf);
|
||||
HWR_AddTransparentPolyobjectFloor(levelflats[polyobjsector->floorpic].lumpnum, po_ptrs[i], false, polyobjsector->floorheight,
|
||||
SOFTLIGHT(polyobjsector->lightlevel), Surf.PolyColor.s.alpha, polyobjsector, blendmode, NULL);
|
||||
polyobjsector->lightlevel, Surf.PolyColor.s.alpha, polyobjsector, blendmode, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
HWR_GetFlat(levelflats[polyobjsector->floorpic].lumpnum, R_NoEncore(polyobjsector, false));
|
||||
HWR_RenderPolyObjectPlane(po_ptrs[i], false, polyobjsector->floorheight, PF_Occlude,
|
||||
SOFTLIGHT(polyobjsector->lightlevel), levelflats[polyobjsector->floorpic].lumpnum,
|
||||
polyobjsector->lightlevel, levelflats[polyobjsector->floorpic].lumpnum,
|
||||
polyobjsector, 255, NULL);
|
||||
}
|
||||
}
|
||||
@@ -3087,13 +3089,13 @@ void HWR_AddPolyObjectPlanes(void)
|
||||
memset(&Surf, 0x00, sizeof(Surf));
|
||||
blendmode = HWR_TranstableToAlpha(po_ptrs[i]->translucency, &Surf);
|
||||
HWR_AddTransparentPolyobjectFloor(levelflats[polyobjsector->ceilingpic].lumpnum, po_ptrs[i], true, polyobjsector->ceilingheight,
|
||||
SOFTLIGHT(polyobjsector->lightlevel), Surf.PolyColor.s.alpha, polyobjsector, blendmode, NULL);
|
||||
polyobjsector->lightlevel, Surf.PolyColor.s.alpha, polyobjsector, blendmode, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
HWR_GetFlat(levelflats[polyobjsector->ceilingpic].lumpnum, R_NoEncore(polyobjsector, true));
|
||||
HWR_RenderPolyObjectPlane(po_ptrs[i], true, polyobjsector->ceilingheight, PF_Occlude,
|
||||
SOFTLIGHT(polyobjsector->lightlevel), levelflats[polyobjsector->ceilingpic].lumpnum,
|
||||
polyobjsector->lightlevel, levelflats[polyobjsector->ceilingpic].lumpnum,
|
||||
polyobjsector, 255, NULL);
|
||||
}
|
||||
}
|
||||
@@ -3235,12 +3237,12 @@ static void HWR_Subsector(size_t num)
|
||||
|
||||
light = R_GetPlaneLight(gr_frontsector, locFloorHeight, false);
|
||||
if (gr_frontsector->floorlightsec == -1)
|
||||
floorlightlevel = SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel);
|
||||
floorlightlevel = *gr_frontsector->lightlist[light].lightlevel;
|
||||
floorcolormap = gr_frontsector->lightlist[light].extra_colormap;
|
||||
|
||||
light = R_GetPlaneLight(gr_frontsector, locCeilingHeight, false);
|
||||
if (gr_frontsector->ceilinglightsec == -1)
|
||||
ceilinglightlevel = SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel);
|
||||
ceilinglightlevel = *gr_frontsector->lightlist[light].lightlevel;
|
||||
ceilingcolormap = gr_frontsector->lightlist[light].extra_colormap;
|
||||
}
|
||||
|
||||
@@ -3317,13 +3319,13 @@ static void HWR_Subsector(size_t num)
|
||||
|
||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < bottomCullHeight ? true : false);
|
||||
|
||||
alpha = HWR_FogBlockAlpha(SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel), rover->master->frontsector->extra_colormap);
|
||||
alpha = HWR_FogBlockAlpha(*gr_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap);
|
||||
|
||||
HWR_AddTransparentFloor(0,
|
||||
&extrasubsectors[num],
|
||||
false,
|
||||
*rover->bottomheight,
|
||||
SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel),
|
||||
*gr_frontsector->lightlist[light].lightlevel,
|
||||
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
|
||||
true, rover->master->frontsector->extra_colormap);
|
||||
}
|
||||
@@ -3334,7 +3336,7 @@ static void HWR_Subsector(size_t num)
|
||||
&extrasubsectors[num],
|
||||
false,
|
||||
*rover->bottomheight,
|
||||
SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel),
|
||||
*gr_frontsector->lightlist[light].lightlevel,
|
||||
max(0, min(rover->alpha, 255)), rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Translucent,
|
||||
false, gr_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
@@ -3342,7 +3344,7 @@ static void HWR_Subsector(size_t num)
|
||||
{
|
||||
HWR_GetFlat(levelflats[*rover->bottompic].lumpnum, R_NoEncore(gr_frontsector, false));
|
||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < bottomCullHeight ? true : false);
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel), levelflats[*rover->bottompic].lumpnum,
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->bottompic].lumpnum,
|
||||
rover->master->frontsector, 255, gr_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
}
|
||||
@@ -3361,13 +3363,13 @@ static void HWR_Subsector(size_t num)
|
||||
|
||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < topCullHeight ? true : false);
|
||||
|
||||
alpha = HWR_FogBlockAlpha(SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel), rover->master->frontsector->extra_colormap);
|
||||
alpha = HWR_FogBlockAlpha(*gr_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap);
|
||||
|
||||
HWR_AddTransparentFloor(0,
|
||||
&extrasubsectors[num],
|
||||
true,
|
||||
*rover->topheight,
|
||||
SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel),
|
||||
*gr_frontsector->lightlist[light].lightlevel,
|
||||
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
|
||||
true, rover->master->frontsector->extra_colormap);
|
||||
}
|
||||
@@ -3378,7 +3380,7 @@ static void HWR_Subsector(size_t num)
|
||||
&extrasubsectors[num],
|
||||
true,
|
||||
*rover->topheight,
|
||||
SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel),
|
||||
*gr_frontsector->lightlist[light].lightlevel,
|
||||
max(0, min(rover->alpha, 255)), rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Translucent,
|
||||
false, gr_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
@@ -3386,7 +3388,7 @@ static void HWR_Subsector(size_t num)
|
||||
{
|
||||
HWR_GetFlat(levelflats[*rover->toppic].lumpnum, R_NoEncore(gr_frontsector, true));
|
||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < topCullHeight ? true : false);
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel), levelflats[*rover->toppic].lumpnum,
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->toppic].lumpnum,
|
||||
rover->master->frontsector, 255, gr_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
}
|
||||
@@ -4010,7 +4012,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
||||
alpha = Surf.PolyColor.s.alpha;
|
||||
|
||||
// Start with the lightlevel and colormap from the top of the sprite
|
||||
lightlevel = SOFTLIGHT(*list[sector->numlights - 1].lightlevel);
|
||||
lightlevel = *list[sector->numlights - 1].lightlevel;
|
||||
|
||||
colormap = list[sector->numlights - 1].extra_colormap;
|
||||
i = 0;
|
||||
@@ -4025,7 +4027,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
||||
if (h <= temp)
|
||||
{
|
||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||
lightlevel = *list[i-1].lightlevel > 255 ? 255 : SOFTLIGHT(*list[i-1].lightlevel);
|
||||
lightlevel = *list[i-1].lightlevel > 255 ? 255 : *list[i-1].lightlevel;
|
||||
colormap = list[i-1].extra_colormap;
|
||||
break;
|
||||
}
|
||||
@@ -4040,7 +4042,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
||||
if (!(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES))
|
||||
{
|
||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||
lightlevel = *list[i].lightlevel > 255 ? 255 : SOFTLIGHT(*list[i].lightlevel);
|
||||
lightlevel = *list[i].lightlevel > 255 ? 255 : *list[i].lightlevel;
|
||||
colormap = list[i].extra_colormap;
|
||||
}
|
||||
|
||||
@@ -4259,7 +4261,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
|
||||
extracolormap_t *colormap = sector->extra_colormap;
|
||||
|
||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||
lightlevel = sector->lightlevel > 255 ? 255 : SOFTLIGHT(sector->lightlevel);
|
||||
lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel;
|
||||
|
||||
HWR_Lighting(&Surf, lightlevel, colormap);
|
||||
}
|
||||
@@ -4360,7 +4362,7 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
|
||||
light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); // Always use the light at the top instead of whatever I was doing before
|
||||
|
||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||
lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : SOFTLIGHT(*sector->lightlist[light].lightlevel);
|
||||
lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel;
|
||||
|
||||
if (sector->lightlist[light].extra_colormap)
|
||||
colormap = sector->lightlist[light].extra_colormap;
|
||||
@@ -4368,7 +4370,7 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
|
||||
else
|
||||
{
|
||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||
lightlevel = sector->lightlevel > 255 ? 255 : SOFTLIGHT(sector->lightlevel);
|
||||
lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel;
|
||||
|
||||
if (sector->extra_colormap)
|
||||
colormap = sector->extra_colormap;
|
||||
@@ -4430,8 +4432,6 @@ static int CompareVisSprites(const void *p1, const void *p2)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#undef SOFTLIGHT
|
||||
|
||||
static void HWR_SortVisSprites(void)
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
Reference in new issue
Block a user