fix papersprite lightlevels again kek + remove shit that does nothing
This commit is contained in:
1 parent
5445be6645
commit
32c3b7761a
4 files changed
+35
-47
No files matched your search
+34
-35
@@ -341,44 +341,43 @@ boolean HWR_PalRenderFlashpal(void)
|
||||
|
||||
void HWR_ObjectLightLevelPost(gl_vissprite_t *spr, const sector_t *sector, INT32 *lightlevel, boolean model, const boolean papersprite)
|
||||
{
|
||||
*lightlevel += R_ThingLightLevel(spr->mobj);
|
||||
(void)papersprite;
|
||||
|
||||
if (maplighting.directional == true && P_SectorUsesDirectionalLighting(sector))
|
||||
if (maplighting.directional == false || !P_SectorUsesDirectionalLighting(sector) || model == true)
|
||||
return;
|
||||
|
||||
fixed_t extralight = R_GetSpriteDirectionalLighting(R_PointToAngle(spr->mobj->x, spr->mobj->y));
|
||||
|
||||
// this seems to be wrong???
|
||||
/*fixed_t extralight = R_GetSpriteDirectionalLighting(
|
||||
papersprite
|
||||
? R_PointToAngle(spr->mobj->x, spr->mobj->y) + (spr->flip ? -ANGLE_90 : ANGLE_90)
|
||||
: R_PointToAngle(spr->mobj->x, spr->mobj->y) // fixme
|
||||
);*/
|
||||
|
||||
// Less change in contrast in dark sectors
|
||||
extralight = FixedMul(extralight, min(max(0, *lightlevel), 255) * FRACUNIT / 255);
|
||||
|
||||
// NO NO BAD! WHY!?
|
||||
/*if (papersprite)
|
||||
{
|
||||
if (model == false) // this is implemented by shader
|
||||
{
|
||||
fixed_t extralight = R_GetSpriteDirectionalLighting(R_PointToAngle(spr->mobj->x, spr->mobj->y));
|
||||
|
||||
// this seems to be wrong???
|
||||
/*fixed_t extralight = R_GetSpriteDirectionalLighting(
|
||||
papersprite
|
||||
? R_PointToAngle(spr->mobj->x, spr->mobj->y) + (spr->flip ? -ANGLE_90 : ANGLE_90)
|
||||
: R_PointToAngle(spr->mobj->x, spr->mobj->y) // fixme
|
||||
);*/
|
||||
|
||||
// Less change in contrast in dark sectors
|
||||
extralight = FixedMul(extralight, min(max(0, *lightlevel), 255) * FRACUNIT / 255);
|
||||
|
||||
if (papersprite)
|
||||
{
|
||||
// Papersprite contrast should match walls
|
||||
*lightlevel += FixedFloor(extralight + (FRACUNIT / 2)) / FRACUNIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
// simple OGL approximation
|
||||
fixed_t tr = R_PointToDist(spr->mobj->x, spr->mobj->y);
|
||||
fixed_t xscale = FixedDiv((vid.width / 2) << FRACBITS, tr);
|
||||
|
||||
// Less change in contrast at further distances, to counteract DOOM diminished light
|
||||
fixed_t n = FixedDiv(FixedMul(xscale, LIGHTRESOLUTIONFIX), ((MAXLIGHTSCALE-1) << LIGHTSCALESHIFT));
|
||||
extralight = FixedMul(extralight, min(n, FRACUNIT));
|
||||
|
||||
// Contrast is stronger for normal sprites, stronger than wall lighting is at the same distance
|
||||
*lightlevel += FixedFloor((extralight * 2) + (FRACUNIT / 2)) / FRACUNIT;
|
||||
}
|
||||
}
|
||||
// Papersprite contrast should match walls
|
||||
*lightlevel += FixedFloor(extralight + (FRACUNIT / 2)) / FRACUNIT;
|
||||
}
|
||||
else*/
|
||||
{
|
||||
// simple OGL approximation
|
||||
fixed_t tr = R_PointToDist(spr->mobj->x, spr->mobj->y);
|
||||
fixed_t xscale = FixedDiv((vid.width / 2) << FRACBITS, tr);
|
||||
|
||||
// Less change in contrast at further distances, to counteract DOOM diminished light
|
||||
fixed_t n = FixedDiv(FixedMul(xscale, LIGHTRESOLUTIONFIX), ((MAXLIGHTSCALE-1) << LIGHTSCALESHIFT));
|
||||
extralight = FixedMul(extralight, min(n, FRACUNIT));
|
||||
|
||||
// Contrast is stronger for normal sprites, stronger than wall lighting is at the same distance
|
||||
*lightlevel += FixedFloor((extralight * 2) + (FRACUNIT / 2)) / FRACUNIT;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap, const boolean directional)
|
||||
|
||||
@@ -295,7 +295,6 @@ typedef struct mobj_s
|
||||
fixed_t old_spritexscale2, old_spriteyscale2;
|
||||
fixed_t old_spritexoffset, old_spriteyoffset;
|
||||
fixed_t old_spritexoffset2, old_spriteyoffset2;
|
||||
INT16 lightlevel; // Add to sector lightlevel, -255 - 255
|
||||
|
||||
fixed_t realxscale, realyscale; // funn-E streeetch
|
||||
|
||||
@@ -449,8 +448,6 @@ typedef struct precipmobj_s
|
||||
fixed_t old_spritexscale, old_spriteyscale;
|
||||
fixed_t old_spritexscale2, old_spriteyscale2;
|
||||
fixed_t old_spritexoffset, old_spriteyoffset;
|
||||
fixed_t old_spritexoffset2, old_spriteyoffset2;
|
||||
INT16 lightlevel; // Add to sector lightlevel, -255 - 255
|
||||
|
||||
fixed_t realxscale, realyscale; // funn-E streeetch
|
||||
|
||||
|
||||
+1
-8
@@ -109,13 +109,6 @@ static drawseg_xrange_item_t *drawsegs_xrange;
|
||||
static size_t drawsegs_xrange_size = 0;
|
||||
static INT32 drawsegs_xrange_count = 0;
|
||||
|
||||
INT32 R_ThingLightLevel(mobj_t* thing)
|
||||
{
|
||||
INT32 lightlevel = thing->lightlevel;
|
||||
|
||||
return lightlevel;
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
//
|
||||
// Sprite loading routines: support sprites in pwad, dehacked sprite renaming,
|
||||
@@ -1621,7 +1614,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
lightnum = thing->subsector->sector->lightlevel;
|
||||
}
|
||||
|
||||
lightnum = (lightnum + R_ThingLightLevel(thing)) >> LIGHTSEGSHIFT;
|
||||
lightnum = (lightnum) >> LIGHTSEGSHIFT;
|
||||
|
||||
if (maplighting.directional == true && P_SectorUsesDirectionalLighting(thing->subsector->sector))
|
||||
{
|
||||
|
||||
@@ -57,7 +57,6 @@ extern fixed_t windowtop;
|
||||
extern fixed_t windowbottom;
|
||||
extern INT32 lengthcol;
|
||||
|
||||
INT32 R_ThingLightLevel(mobj_t *thing);
|
||||
fixed_t R_GetSpriteDirectionalLighting(angle_t angle);
|
||||
|
||||
fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope);
|
||||
|
||||
Reference in new issue
Block a user