- Fixed: Sprites drawn with the shaded render style were always fullbright.

SVN r3480 (trunk)
This commit is contained in:
Randy Heit 2012-03-24 00:52:15 +00:00
parent 45294cd3d3
commit 308f6cab9d
2 changed files with 18 additions and 6 deletions

View file

@ -327,6 +327,13 @@ void R_DrawVisSprite (vissprite_t *vis)
mode = R_SetPatchStyle (vis->Style.RenderStyle, vis->Style.alpha, vis->Translation, vis->FillColor); mode = R_SetPatchStyle (vis->Style.RenderStyle, vis->Style.alpha, vis->Translation, vis->FillColor);
if (vis->Style.RenderStyle == LegacyRenderStyles[STYLE_Shaded])
{ // For shaded sprites, R_SetPatchStyle sets a dc_colormap to an alpha table, but
// it is the brightest one. We need to get back to the proper light level for
// this sprite.
dc_colormap += vis->ColormapNum << COLORMAPSHIFT;
}
if (mode != DontDraw) if (mode != DontDraw)
{ {
if (mode == DoDraw0) if (mode == DoDraw0)
@ -768,6 +775,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
vis->Style.alpha = thing->alpha; vis->Style.alpha = thing->alpha;
vis->fakefloor = fakefloor; vis->fakefloor = fakefloor;
vis->fakeceiling = fakeceiling; vis->fakeceiling = fakeceiling;
vis->ColormapNum = 0;
if (voxel != NULL) if (voxel != NULL)
{ {
@ -832,8 +840,9 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
} }
else else
{ // diminished light { // diminished light
vis->Style.colormap = mybasecolormap->Maps + (GETPALOOKUP ( vis->ColormapNum = GETPALOOKUP(
(fixed_t)DivScale12 (r_SpriteVisibility, MAX(tz, MINZ)), spriteshade) << COLORMAPSHIFT); (fixed_t)DivScale12 (r_SpriteVisibility, MAX(tz, MINZ)), spriteshade);
vis->Style.colormap = mybasecolormap->Maps + (vis->ColormapNum << COLORMAPSHIFT);
} }
} }
} }
@ -990,6 +999,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
vis->yscale = DivScale16(pspriteyscale, tex->yScale); vis->yscale = DivScale16(pspriteyscale, tex->yScale);
vis->Translation = 0; // [RH] Use default colors vis->Translation = 0; // [RH] Use default colors
vis->pic = tex; vis->pic = tex;
vis->ColormapNum = 0;
if (flip) if (flip)
{ {
@ -2118,6 +2128,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
vis->renderflags = particle->trans; vis->renderflags = particle->trans;
vis->FakeFlatStat = fakeside; vis->FakeFlatStat = fakeside;
vis->floorclip = 0; vis->floorclip = 0;
vis->ColormapNum = 0;
if (fixedlightlev >= 0) if (fixedlightlev >= 0)
{ {
@ -2131,8 +2142,8 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
{ {
// Using MulScale15 instead of 16 makes particles slightly more visible // Using MulScale15 instead of 16 makes particles slightly more visible
// than regular sprites. // than regular sprites.
vis->Style.colormap = map + (GETPALOOKUP (MulScale15 (tiz, r_SpriteVisibility), vis->ColormapNum = GETPALOOKUP(MulScale15 (tiz, r_SpriteVisibility), shade);
shade) << COLORMAPSHIFT); vis->Style.colormap = map + (vis->ColormapNum << COLORMAPSHIFT);
} }
} }

View file

@ -55,6 +55,7 @@ struct vissprite_t
BYTE bIsVoxel:1; // [RH] Use voxel instead of pic BYTE bIsVoxel:1; // [RH] Use voxel instead of pic
BYTE bSplitSprite:1; // [RH] Sprite was split by a drawseg BYTE bSplitSprite:1; // [RH] Sprite was split by a drawseg
BYTE FakeFlatStat; // [RH] which side of fake/floor ceiling sprite is on BYTE FakeFlatStat; // [RH] which side of fake/floor ceiling sprite is on
BYTE ColormapNum; // Which colormap is rendered (needed for shaded drawer)
short renderflags; short renderflags;
DWORD Translation; // [RH] for color translation DWORD Translation; // [RH] for color translation
visstyle_t Style; visstyle_t Style;