diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index bcec1685f..1fde3d0a9 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -343,6 +343,8 @@ void HWR_ObjectLightLevelPost(gl_vissprite_t *spr, const sector_t *sector, INT32 { (void)papersprite; + *lightlevel += R_ThingLightLevel(spr->mobj); + if (maplighting.directional == false || !P_SectorUsesDirectionalLighting(sector) || model == true) return; diff --git a/src/p_mobj.h b/src/p_mobj.h index 57b4dd95d..23d19136c 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -295,6 +295,7 @@ 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,6 +450,7 @@ typedef struct precipmobj_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 diff --git a/src/r_things.c b/src/r_things.c index 8447ac502..c2c2e6375 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -109,6 +109,13 @@ 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, @@ -1617,7 +1624,7 @@ static void R_ProjectSprite(mobj_t *thing) lightnum = thing->subsector->sector->lightlevel; } - lightnum = (lightnum) >> LIGHTSEGSHIFT; + lightnum = (lightnum + R_ThingLightLevel(thing)) >> LIGHTSEGSHIFT; if (maplighting.directional == true && P_SectorUsesDirectionalLighting(thing->subsector->sector)) { diff --git a/src/r_things.h b/src/r_things.h index 78221d794..1af5d99bd 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -57,6 +57,7 @@ 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);