Merge branch 'directional-lighting-flag' into 'master'
Directional lighting flag See merge request KartKrew/Kart!1356
This commit is contained in:
parent
99c05156f6
commit
0d70d4da5b
10 changed files with 47 additions and 27 deletions
|
|
@ -5680,9 +5680,14 @@ const char *const MSF_LIST[] = {
|
|||
"TRIGGERSPECIAL_HEADBUMP",
|
||||
"TRIGGERLINE_PLANE",
|
||||
"TRIGGERLINE_MOBJ",
|
||||
"INVERTPRECIP",
|
||||
"GRAVITYFLIP",
|
||||
"HEATWAVE",
|
||||
"NOCLIPCAMERA",
|
||||
"RIPPLE_FLOOR",
|
||||
"RIPPLE_CEILING",
|
||||
"INVERTENCORE",
|
||||
"FLATLIGHTING",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ static FUINT HWR_CalcWallLight(FUINT lightnum, seg_t *seg)
|
|||
{
|
||||
INT16 finallight = lightnum;
|
||||
|
||||
if (seg != NULL && P_ApplyLightOffsetFine(lightnum))
|
||||
if (seg != NULL && P_ApplyLightOffsetFine(lightnum, seg->frontsector->flags))
|
||||
{
|
||||
finallight += seg->hwLightOffset;
|
||||
|
||||
|
|
@ -307,11 +307,11 @@ static FUINT HWR_CalcWallLight(FUINT lightnum, seg_t *seg)
|
|||
return (FUINT)finallight;
|
||||
}
|
||||
|
||||
static FUINT HWR_CalcSlopeLight(FUINT lightnum, pslope_t *slope)
|
||||
static FUINT HWR_CalcSlopeLight(FUINT lightnum, pslope_t *slope, sectorflags_t sectorflags)
|
||||
{
|
||||
INT16 finallight = lightnum;
|
||||
|
||||
if (slope != NULL && P_ApplyLightOffsetFine(lightnum))
|
||||
if (slope != NULL && P_ApplyLightOffsetFine(lightnum, sectorflags))
|
||||
{
|
||||
finallight += slope->hwLightOffset;
|
||||
|
||||
|
|
@ -505,7 +505,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
|||
for (i = 0, v3d = planeVerts; i < nrPlaneVerts; i++,v3d++,pv++)
|
||||
SETUP3DVERT(v3d, pv->x, pv->y);
|
||||
|
||||
lightlevel = HWR_CalcSlopeLight(lightlevel, slope);
|
||||
lightlevel = HWR_CalcSlopeLight(lightlevel, slope, (FOFsector ? FOFsector : gl_frontsector)->flags);
|
||||
HWR_Lighting(&Surf, lightlevel, planecolormap);
|
||||
|
||||
if (PolyFlags & PF_EnvironmentTrans)
|
||||
|
|
|
|||
|
|
@ -1712,6 +1712,8 @@ static void ParseTextmapSectorParameter(UINT32 i, const char *param, const char
|
|||
sectors[i].flags |= MSF_RIPPLE_CEILING;
|
||||
else if (fastcmp(param, "invertencore") && fastcmp("true", val))
|
||||
sectors[i].flags |= MSF_INVERTENCORE;
|
||||
else if (fastcmp(param, "flatlighting") && fastcmp("true", val))
|
||||
sectors[i].flags |= MSF_FLATLIGHTING;
|
||||
else if (fastcmp(param, "nostepup") && fastcmp("true", val))
|
||||
sectors[i].specialflags |= SSF_NOSTEPUP;
|
||||
else if (fastcmp(param, "doublestepup") && fastcmp("true", val))
|
||||
|
|
@ -3365,15 +3367,25 @@ void P_UpdateSegLightOffset(seg_t *li)
|
|||
#endif
|
||||
}
|
||||
|
||||
boolean P_ApplyLightOffset(UINT8 baselightnum)
|
||||
boolean P_ApplyLightOffset(UINT8 baselightnum, sectorflags_t sectorflags)
|
||||
{
|
||||
if (sectorflags & MSF_FLATLIGHTING)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't apply light offsets at full bright or full dark.
|
||||
// Is in steps of light num .
|
||||
return (baselightnum < LIGHTLEVELS-1 && baselightnum > 0);
|
||||
}
|
||||
|
||||
boolean P_ApplyLightOffsetFine(UINT8 baselightlevel)
|
||||
boolean P_ApplyLightOffsetFine(UINT8 baselightlevel, sectorflags_t sectorflags)
|
||||
{
|
||||
if (sectorflags & MSF_FLATLIGHTING)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't apply light offsets at full bright or full dark.
|
||||
// Uses exact light levels for more smoothness.
|
||||
return (baselightlevel < 255 && baselightlevel > 0);
|
||||
|
|
|
|||
|
|
@ -132,8 +132,8 @@ void P_LoadSoundsRange(UINT16 wadnum, UINT16 first, UINT16 num);
|
|||
void P_LoadMusicsRange(UINT16 wadnum, UINT16 first, UINT16 num);
|
||||
//void P_WriteThings(void);
|
||||
void P_UpdateSegLightOffset(seg_t *li);
|
||||
boolean P_ApplyLightOffset(UINT8 baselightnum);
|
||||
boolean P_ApplyLightOffsetFine(UINT8 baselightlevel);
|
||||
boolean P_ApplyLightOffset(UINT8 baselightnum, sectorflags_t sectorflags);
|
||||
boolean P_ApplyLightOffsetFine(UINT8 baselightlevel, sectorflags_t sectorflags);
|
||||
size_t P_PrecacheLevelFlats(void);
|
||||
void P_AllocMapHeader(INT16 i);
|
||||
|
||||
|
|
|
|||
12
src/r_bsp.c
12
src/r_bsp.c
|
|
@ -962,7 +962,7 @@ static void R_Subsector(size_t num)
|
|||
floorcolormap, NULL, NULL, frontsector->f_slope,
|
||||
R_NoEncore(frontsector, &levelflats[frontsector->floorpic], false),
|
||||
R_IsRipplePlane(frontsector, NULL, false),
|
||||
false
|
||||
false, frontsector->flags
|
||||
);
|
||||
}
|
||||
else
|
||||
|
|
@ -978,7 +978,7 @@ static void R_Subsector(size_t num)
|
|||
ceilingcolormap, NULL, NULL, frontsector->c_slope,
|
||||
R_NoEncore(frontsector, &levelflats[frontsector->ceilingpic], true),
|
||||
R_IsRipplePlane(frontsector, NULL, true),
|
||||
true
|
||||
true, frontsector->flags
|
||||
);
|
||||
}
|
||||
else
|
||||
|
|
@ -1026,7 +1026,7 @@ static void R_Subsector(size_t num)
|
|||
*rover->bottomyoffs, *rover->bottomangle, *frontsector->lightlist[light].extra_colormap, rover, NULL, *rover->b_slope,
|
||||
R_NoEncore(rover->master->frontsector, &levelflats[*rover->bottompic], true),
|
||||
R_IsRipplePlane(rover->master->frontsector, rover, true),
|
||||
true
|
||||
true, rover->master->frontsector->flags
|
||||
);
|
||||
|
||||
ffloor[numffloors].slope = *rover->b_slope;
|
||||
|
|
@ -1060,7 +1060,7 @@ static void R_Subsector(size_t num)
|
|||
*frontsector->lightlist[light].extra_colormap, rover, NULL, *rover->t_slope,
|
||||
R_NoEncore(rover->master->frontsector, &levelflats[*rover->toppic], false),
|
||||
R_IsRipplePlane(rover->master->frontsector, rover, false),
|
||||
false
|
||||
false, rover->master->frontsector->flags
|
||||
);
|
||||
|
||||
ffloor[numffloors].slope = *rover->t_slope;
|
||||
|
|
@ -1110,7 +1110,7 @@ static void R_Subsector(size_t num)
|
|||
NULL, // will ffloors be slopable eventually?
|
||||
R_NoEncore(polysec, &levelflats[polysec->floorpic], false),
|
||||
false, /* TODO: wet polyobjects? */
|
||||
true
|
||||
true, polysec->flags
|
||||
);
|
||||
|
||||
ffloor[numffloors].height = polysec->floorheight;
|
||||
|
|
@ -1139,7 +1139,7 @@ static void R_Subsector(size_t num)
|
|||
NULL, // will ffloors be slopable eventually?
|
||||
R_NoEncore(polysec, &levelflats[polysec->ceilingpic], true),
|
||||
false, /* TODO: wet polyobjects? */
|
||||
false
|
||||
false, polysec->flags
|
||||
);
|
||||
|
||||
ffloor[numffloors].polyobj = po;
|
||||
|
|
|
|||
|
|
@ -350,6 +350,8 @@ typedef enum
|
|||
MSF_RIPPLE_CEILING = 1<<11,
|
||||
// invert encore color remap status
|
||||
MSF_INVERTENCORE = 1<<12,
|
||||
// turn off directional lighting
|
||||
MSF_FLATLIGHTING = 1<<13,
|
||||
} sectorflags_t;
|
||||
|
||||
typedef enum
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ static visplane_t *new_visplane(unsigned hash)
|
|||
visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
|
||||
fixed_t xoff, fixed_t yoff, angle_t plangle, extracolormap_t *planecolormap,
|
||||
ffloor_t *pfloor, polyobj_t *polyobj, pslope_t *slope, boolean noencore,
|
||||
boolean ripple, boolean reverseLight)
|
||||
boolean ripple, boolean reverseLight, sectorflags_t sectorflags)
|
||||
{
|
||||
visplane_t *check;
|
||||
unsigned hash;
|
||||
|
|
@ -404,7 +404,7 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
|
|||
}
|
||||
}
|
||||
|
||||
if (slope != NULL && P_ApplyLightOffset(lightlevel >> LIGHTSEGSHIFT))
|
||||
if (slope != NULL && P_ApplyLightOffset(lightlevel >> LIGHTSEGSHIFT, sectorflags))
|
||||
{
|
||||
if (reverseLight && maplighting.directional == true)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ void R_ClearFFloorClips (void);
|
|||
void R_DrawPlanes(void);
|
||||
visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, fixed_t xoff, fixed_t yoff, angle_t plangle,
|
||||
extracolormap_t *planecolormap, ffloor_t *ffloor, polyobj_t *polyobj, pslope_t *slope, boolean noencore,
|
||||
boolean ripple, boolean reverseLight);
|
||||
boolean ripple, boolean reverseLight, sectorflags_t sectorflags);
|
||||
visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop);
|
||||
void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop);
|
||||
void R_PlaneBounds(visplane_t *plane);
|
||||
|
|
|
|||
19
src/r_segs.c
19
src/r_segs.c
|
|
@ -280,7 +280,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
|||
|
||||
if (rlight->extra_colormap && (rlight->extra_colormap->flags & CMF_FOG))
|
||||
;
|
||||
else if (P_ApplyLightOffset(lightnum))
|
||||
else if (P_ApplyLightOffset(lightnum, frontsector->flags))
|
||||
lightnum += curline->lightOffset;
|
||||
|
||||
rlight->lightnum = lightnum;
|
||||
|
|
@ -303,10 +303,11 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
|||
{
|
||||
lightnum = LIGHTLEVELS - 1;
|
||||
|
||||
if (P_ApplyLightOffset(lightnum))
|
||||
{
|
||||
lightnum += curline->lightOffset;
|
||||
}
|
||||
if ((R_CheckColumnFunc(COLDRAWFUNC_FOG) == true)
|
||||
|| (frontsector->extra_colormap && (frontsector->extra_colormap->flags & CMF_FOG)))
|
||||
;
|
||||
else if (P_ApplyLightOffset(lightnum, frontsector->flags))
|
||||
lightnum += curline->lightOffset;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -775,7 +776,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
|||
|
||||
if (pfloor->fofflags & FOF_FOG || rlight->flags & FOF_FOG || (rlight->extra_colormap && (rlight->extra_colormap->flags & CMF_FOG)))
|
||||
;
|
||||
else if (P_ApplyLightOffset(rlight->lightnum))
|
||||
else if (P_ApplyLightOffset(rlight->lightnum, pfloor->master->frontsector->flags))
|
||||
rlight->lightnum += curline->lightOffset;
|
||||
|
||||
p++;
|
||||
|
|
@ -798,7 +799,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
|||
|
||||
if (pfloor->fofflags & FOF_FOG || (frontsector->extra_colormap && (frontsector->extra_colormap->flags & CMF_FOG)))
|
||||
;
|
||||
else if (P_ApplyLightOffset(lightnum))
|
||||
else if (P_ApplyLightOffset(lightnum, pfloor->master->frontsector->flags))
|
||||
lightnum += curline->lightOffset;
|
||||
|
||||
if (lightnum < 0)
|
||||
|
|
@ -1400,7 +1401,7 @@ static void R_RenderSegLoop (void)
|
|||
|
||||
if (dc_lightlist[i].extra_colormap)
|
||||
;
|
||||
else if (P_ApplyLightOffset(lightnum))
|
||||
else if (P_ApplyLightOffset(lightnum, curline->frontsector->flags))
|
||||
lightnum += curline->lightOffset;
|
||||
|
||||
if (lightnum < 0)
|
||||
|
|
@ -2410,7 +2411,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||
// OPTIMIZE: get rid of LIGHTSEGSHIFT globally
|
||||
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
|
||||
|
||||
if (P_ApplyLightOffset(lightnum))
|
||||
if (P_ApplyLightOffset(lightnum, frontsector->flags))
|
||||
lightnum += curline->lightOffset;
|
||||
|
||||
if (lightnum < 0)
|
||||
|
|
|
|||
|
|
@ -2154,7 +2154,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
//light = R_GetPlaneLight(thing->subsector->sector, gzt, false);
|
||||
lightnum = (*thing->subsector->sector->lightlist[light].lightlevel >> LIGHTSEGSHIFT);
|
||||
|
||||
if (maplighting.directional == true)
|
||||
if (maplighting.directional == true && !(thing->subsector->sector->flags & MSF_FLATLIGHTING))
|
||||
{
|
||||
fixed_t extralight = R_GetSpriteDirectionalLighting(papersprite
|
||||
? interp.angle + (ang >= ANGLE_180 ? -ANGLE_90 : ANGLE_90)
|
||||
|
|
|
|||
Loading…
Reference in a new issue