From e96f23142060526af5bedecf3c6242e7ffdae567 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 28 Jan 2017 21:02:03 +0100 Subject: [PATCH] - added Doom64 colors for sprites. --- src/fragglescript/t_func.cpp | 3 ++- src/gl/scene/gl_flats.cpp | 4 ++-- src/gl/scene/gl_sprite.cpp | 15 +++++++++++---- src/gl/scene/gl_weapon.cpp | 9 +++++++-- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index 59c82c15c..20b53c8fd 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -3891,7 +3891,8 @@ void FParser::SF_SetColor(void) for (int j = 0; j < 4; j++) level.sectors[i].SpecialColors[j] = color; // simulates 'nocoloredspritelighting' settings. int v = (color.r + color.g + color.b) / 3; - level.sectors[i].SpecialColors[sector_t::sprites] = (255 + v + v) / 3; + v = (255 + v + v) / 3; + level.sectors[i].SpecialColors[sector_t::sprites] = PalEntry(255, v, v, v); } } } diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index 1ed0fecfa..a1f5f989c 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -377,7 +377,7 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG { case GLPASS_PLAIN: // Single-pass rendering case GLPASS_ALL: // Same, but also creates the dynlight data. - gl_SetColor(lightlevel, rel, Colormap,1.0f); + gl_SetColor((sector->MoreFlags & SECF_SPECIALCOLORSABSOLUTE) ? 255 : lightlevel, rel, Colormap,1.0f); gl_SetFog(lightlevel, rel, &Colormap, false); gl_RenderState.SetObjectColor(FlatColor | 0xff000000); if (sector->special != GLSector_Skybox) @@ -404,7 +404,7 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG case GLPASS_TRANSLUCENT: if (renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE); - gl_SetColor(lightlevel, rel, Colormap, alpha); + gl_SetColor((sector->MoreFlags & SECF_SPECIALCOLORSABSOLUTE) ? 255 : lightlevel, rel, Colormap, alpha); gl_SetFog(lightlevel, rel, &Colormap, false); gl_RenderState.SetObjectColor(FlatColor | 0xff000000); if (!gltexture) diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index adbc626ed..5ddaab7e5 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -308,6 +308,7 @@ void GLSprite::Draw(int pass) gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold); gl_RenderState.SetColor(0.2f,0.2f,0.2f,fuzzalpha, Colormap.desaturation); additivefog = true; + lightlist = nullptr; // the fuzz effect does not use the sector's light level so splitting is not needed. } else if (RenderStyle.BlendOp == STYLEOP_Add && RenderStyle.DestAlpha == STYLEALPHA_One) { @@ -319,15 +320,21 @@ void GLSprite::Draw(int pass) glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1.0f, -128.0f); } - if (RenderStyle.BlendOp!=STYLEOP_Shadow) + if (RenderStyle.BlendOp != STYLEOP_Shadow) { if (gl_lights && GLRenderer->mLightCount && !gl_fixedcolormap && !fullbright) { gl_SetDynSpriteLight(gl_light_sprites ? actor : NULL, gl_light_particles ? particle : NULL); } - gl_SetColor(lightlevel, rel, Colormap, trans); + PalEntry finalcol(ThingColor.a, + ThingColor.r * actor->Sector->SpecialColors[sector_t::sprites].r / 255, + ThingColor.g * actor->Sector->SpecialColors[sector_t::sprites].g / 255, + ThingColor.b * actor->Sector->SpecialColors[sector_t::sprites].b / 255); + + gl_RenderState.SetObjectColor(finalcol); + gl_SetColor((actor->Sector->MoreFlags & SECF_SPECIALCOLORSABSOLUTE) ? 255 : lightlevel, rel, Colormap, trans); } - gl_RenderState.SetObjectColor(ThingColor); + if (gl_isBlack(Colormap.FadeColor)) foglevel=lightlevel; @@ -394,7 +401,7 @@ void GLSprite::Draw(int pass) thiscm.Decolorize(); } - gl_SetColor(thisll, rel, thiscm, trans); + gl_SetColor((actor->Sector->MoreFlags & SECF_SPECIALCOLORSABSOLUTE) ? 255 : thisll, rel, thiscm, trans); if (!foglayer) { gl_SetFog(thislight, rel, &thiscm, additivefog); diff --git a/src/gl/scene/gl_weapon.cpp b/src/gl/scene/gl_weapon.cpp index d53e252e3..6260627ba 100644 --- a/src/gl/scene/gl_weapon.cpp +++ b/src/gl/scene/gl_weapon.cpp @@ -370,7 +370,12 @@ void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep) // now draw the different layers of the weapon gl_RenderState.EnableBrightmap(true); - gl_RenderState.SetObjectColor(ThingColor); + PalEntry finalcol(ThingColor.a, + ThingColor.r * viewsector->SpecialColors[sector_t::sprites].r / 255, + ThingColor.g * viewsector->SpecialColors[sector_t::sprites].g / 255, + ThingColor.b * viewsector->SpecialColors[sector_t::sprites].b / 255); + + gl_RenderState.SetObjectColor(finalcol); gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold); // hack alert! Rather than changing everything in the underlying lighting code let's just temporarily change @@ -412,7 +417,7 @@ void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep) { gl_SetDynSpriteLight(playermo, NULL); } - gl_SetColor(ll, 0, cmc, trans, true); + gl_SetColor((viewsector->MoreFlags & SECF_SPECIALCOLORSABSOLUTE) ? 255 : ll, 0, cmc, trans, true); } if (psp->firstTic)