diff --git a/src/g_inventory/a_artifacts.cpp b/src/g_inventory/a_artifacts.cpp index 80c423b45..f8e34c9a7 100644 --- a/src/g_inventory/a_artifacts.cpp +++ b/src/g_inventory/a_artifacts.cpp @@ -791,8 +791,7 @@ int APowerInvisibility::AlterWeaponSprite (visstyle_t *vis) if ((vis->Alpha < 0.25f && special1 > 0) || (vis->Alpha == 0)) { vis->Alpha = clamp((1.f - float(Strength/100)), 0.f, 1.f); - vis->BaseColormap = &SpecialColormaps[INVERSECOLORMAP]; - vis->ColormapNum = 0; + vis->colormap = SpecialColormaps[INVERSECOLORMAP].Colormap; } return -1; // This item is valid so another one shouldn't reset the translucency } diff --git a/src/polyrenderer/scene/poly_playersprite.cpp b/src/polyrenderer/scene/poly_playersprite.cpp index e9665c857..640d90252 100644 --- a/src/polyrenderer/scene/poly_playersprite.cpp +++ b/src/polyrenderer/scene/poly_playersprite.cpp @@ -213,36 +213,36 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa FDynamicColormap *basecolormap = viewsector->ColorMap; FDynamicColormap *colormap_to_use = basecolormap; - visstyle_t visstyle; - visstyle.ColormapNum = 0; - visstyle.BaseColormap = basecolormap; - visstyle.Alpha = 0; - visstyle.RenderStyle = STYLE_Normal; + int ColormapNum = 0; + FSWColormap *BaseColormap = basecolormap; + float Alpha = 0; + FRenderStyle RenderStyle; + RenderStyle = STYLE_Normal; bool foggy = false; int actualextralight = foggy ? 0 : extralight << 4; int spriteshade = LIGHT2SHADE(owner->Sector->lightlevel + actualextralight); double minz = double((2048 * 4) / double(1 << 20)); - visstyle.ColormapNum = GETPALOOKUP(swrenderer::r_SpriteVisibility / minz, spriteshade); + ColormapNum = GETPALOOKUP(swrenderer::r_SpriteVisibility / minz, spriteshade); if (sprite->GetID() < PSP_TARGETCENTER) { - visstyle.Alpha = float(owner->Alpha); - visstyle.RenderStyle = owner->RenderStyle; + Alpha = float(owner->Alpha); + RenderStyle = owner->RenderStyle; // The software renderer cannot invert the source without inverting the overlay // too. That means if the source is inverted, we need to do the reverse of what // the invert overlay flag says to do. - INTBOOL invertcolormap = (visstyle.RenderStyle.Flags & STYLEF_InvertOverlay); + INTBOOL invertcolormap = (RenderStyle.Flags & STYLEF_InvertOverlay); - if (visstyle.RenderStyle.Flags & STYLEF_InvertSource) + if (RenderStyle.Flags & STYLEF_InvertSource) { invertcolormap = !invertcolormap; } FDynamicColormap *mybasecolormap = basecolormap; - if (visstyle.RenderStyle.Flags & STYLEF_FadeToBlack) + if (RenderStyle.Flags & STYLEF_FadeToBlack) { if (invertcolormap) { // Fade to white @@ -258,8 +258,8 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa /* if (swrenderer::realfixedcolormap != nullptr && (!swrenderer::r_swtruecolor || (r_shadercolormaps && screen->Accel2D))) { // fixed color - visstyle.BaseColormap = swrenderer::realfixedcolormap; - visstyle.ColormapNum = 0; + BaseColormap = swrenderer::realfixedcolormap; + ColormapNum = 0; } else { @@ -269,49 +269,46 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa } if (swrenderer::fixedlightlev >= 0) { - visstyle.BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; - visstyle.ColormapNum = swrenderer::fixedlightlev >> COLORMAPSHIFT; + BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; + ColormapNum = swrenderer::fixedlightlev >> COLORMAPSHIFT; } else if (!foggy && sprite->GetState()->GetFullbright()) { // full bright - visstyle.BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; // [RH] use basecolormap - visstyle.ColormapNum = 0; + BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; // [RH] use basecolormap + ColormapNum = 0; } else { // local light - visstyle.BaseColormap = mybasecolormap; - visstyle.ColormapNum = GETPALOOKUP(0, spriteshade); + BaseColormap = mybasecolormap; + ColormapNum = GETPALOOKUP(0, spriteshade); } } */ if (camera->Inventory != nullptr) { - BYTE oldcolormapnum = visstyle.ColormapNum; - FSWColormap *oldcolormap = visstyle.BaseColormap; + visstyle_t visstyle; + visstyle.Alpha = Alpha; + visstyle.RenderStyle = RenderStyle; + visstyle.colormap = nullptr; // Same as the GL render is doing. + camera->Inventory->AlterWeaponSprite(&visstyle); - if (visstyle.BaseColormap != oldcolormap || visstyle.ColormapNum != oldcolormapnum) + + RenderStyle = visstyle.RenderStyle; + Alpha = visstyle.Alpha; + + // Only bother checking for the one type it changes it to until this has been ZScript'ed.. + if (visstyle.colormap == SpecialColormaps[INVERSECOLORMAP].Colormap) { - // The colormap has changed. Is it one we can easily identify? - // If not, then don't bother trying to identify it for - // hardware accelerated drawing. - if (visstyle.BaseColormap < &SpecialColormaps[0] || - visstyle.BaseColormap > &SpecialColormaps.Last()) - { - noaccel = true; - } - // Has the basecolormap changed? If so, we can't hardware accelerate it, - // since we don't know what it is anymore. - else if (visstyle.BaseColormap != mybasecolormap) - { - noaccel = true; - } + BaseColormap = &SpecialColormaps[INVERSECOLORMAP]; + ColormapNum = 0; } } + // If we're drawing with a special colormap, but shaders for them are disabled, do // not accelerate. - if (!r_shadercolormaps && (visstyle.BaseColormap >= &SpecialColormaps[0] && - visstyle.BaseColormap <= &SpecialColormaps.Last())) + if (!r_shadercolormaps && (BaseColormap >= &SpecialColormaps[0] && + BaseColormap <= &SpecialColormaps.Last())) { noaccel = true; } @@ -340,7 +337,7 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa // fuzzy, don't draw it until after the switch to 2D mode. if (!noaccel && swrenderer::RenderTarget == screen && (DFrameBuffer *)screen->Accel2D) { - FRenderStyle style = visstyle.RenderStyle; + FRenderStyle style = RenderStyle; style.CheckFuzz(); if (style.BlendOp != STYLEOP_Fuzz) { @@ -352,7 +349,10 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa screenSprite.Height = tex->GetHeight() * yscale; screenSprite.Translation = TranslationToTable(translation); screenSprite.Flip = xiscale < 0; - screenSprite.visstyle = visstyle; + screenSprite.Alpha = Alpha; + screenSprite.RenderStyle = RenderStyle; + screenSprite.BaseColormap = BaseColormap; + screenSprite.ColormapNum = ColormapNum; screenSprite.Colormap = colormap_to_use; ScreenSprites.push_back(screenSprite); return; @@ -362,11 +362,11 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa // To do: draw sprite same way as R_DrawVisSprite(vis) here // Draw the fuzzy weapon: - FRenderStyle style = visstyle.RenderStyle; + FRenderStyle style = RenderStyle; style.CheckFuzz(); if (style.BlendOp == STYLEOP_Fuzz) { - visstyle.RenderStyle = LegacyRenderStyles[STYLE_Shadow]; + RenderStyle = LegacyRenderStyles[STYLE_Shadow]; PolyScreenSprite screenSprite; screenSprite.Pic = tex; @@ -376,7 +376,10 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa screenSprite.Height = tex->GetHeight() * yscale; screenSprite.Translation = TranslationToTable(translation); screenSprite.Flip = xiscale < 0; - screenSprite.visstyle = visstyle; + screenSprite.Alpha = Alpha; + screenSprite.RenderStyle = RenderStyle; + screenSprite.BaseColormap = BaseColormap; + screenSprite.ColormapNum = ColormapNum; screenSprite.Colormap = colormap_to_use; ScreenSprites.push_back(screenSprite); } @@ -388,16 +391,16 @@ void PolyScreenSprite::Render() FColormapStyle colormapstyle; PalEntry overlay = 0; bool usecolormapstyle = false; - if (visstyle.BaseColormap >= &SpecialColormaps[0] && - visstyle.BaseColormap < &SpecialColormaps[SpecialColormaps.Size()]) + if (BaseColormap >= &SpecialColormaps[0] && + BaseColormap < &SpecialColormaps[SpecialColormaps.Size()]) { - special = static_cast(visstyle.BaseColormap); + special = static_cast(BaseColormap); } else if (Colormap->Color == PalEntry(255, 255, 255) && Colormap->Desaturate == 0) { overlay = Colormap->Fade; - overlay.a = BYTE(visstyle.ColormapNum * 255 / NUMCOLORMAPS); + overlay.a = BYTE(ColormapNum * 255 / NUMCOLORMAPS); } else { @@ -405,7 +408,7 @@ void PolyScreenSprite::Render() colormapstyle.Color = Colormap->Color; colormapstyle.Fade = Colormap->Fade; colormapstyle.Desaturate = Colormap->Desaturate; - colormapstyle.FadeLevel = visstyle.ColormapNum / float(NUMCOLORMAPS); + colormapstyle.FadeLevel = ColormapNum / float(NUMCOLORMAPS); } screen->DrawTexture(Pic, @@ -421,8 +424,8 @@ void PolyScreenSprite::Render() DTA_ClipTop, viewwindowy, DTA_ClipRight, viewwindowx + viewwidth, DTA_ClipBottom, viewwindowy + viewheight, - DTA_AlphaF, visstyle.Alpha, - DTA_RenderStyle, visstyle.RenderStyle, + DTA_AlphaF, Alpha, + DTA_RenderStyle, RenderStyle, DTA_FillColor, FillColor, DTA_SpecialColormap, special, DTA_ColorOverlay, overlay.d, diff --git a/src/polyrenderer/scene/poly_playersprite.h b/src/polyrenderer/scene/poly_playersprite.h index e7384e200..97c6e6118 100644 --- a/src/polyrenderer/scene/poly_playersprite.h +++ b/src/polyrenderer/scene/poly_playersprite.h @@ -22,8 +22,11 @@ #pragma once +#include "r_defs.h" + class PolyScreenSprite; class DPSprite; +struct FSWColormap; class RenderPolyPlayerSprites { @@ -53,7 +56,10 @@ public: double Height = 0.0; FRemapTable *Translation = nullptr; bool Flip = false; - visstyle_t visstyle; + float Alpha = 1; + FRenderStyle RenderStyle; + FSWColormap *BaseColormap = nullptr; + int ColormapNum = 0; uint32_t FillColor = 0; FDynamicColormap *Colormap = nullptr; }; diff --git a/src/polyrenderer/scene/poly_sprite.cpp b/src/polyrenderer/scene/poly_sprite.cpp index c6cf88ee1..91e35765c 100644 --- a/src/polyrenderer/scene/poly_sprite.cpp +++ b/src/polyrenderer/scene/poly_sprite.cpp @@ -290,6 +290,7 @@ bool RenderPolySprite::IsThingCulled(AActor *thing) return false; } +#if 0 visstyle_t RenderPolySprite::GetSpriteVisStyle(AActor *thing, double z) { visstyle_t visstyle; @@ -298,16 +299,17 @@ visstyle_t RenderPolySprite::GetSpriteVisStyle(AActor *thing, double z) int actualextralight = foggy ? 0 : extralight << 4; int spriteshade = LIGHT2SHADE(thing->Sector->lightlevel + actualextralight); - visstyle.RenderStyle = thing->RenderStyle; - visstyle.Alpha = float(thing->Alpha); - visstyle.ColormapNum = 0; + FRenderStyle RenderStyle; + RenderStyle = thing->RenderStyle; + float Alpha = float(thing->Alpha); + int ColormapNum = 0; // The software renderer cannot invert the source without inverting the overlay // too. That means if the source is inverted, we need to do the reverse of what // the invert overlay flag says to do. - bool invertcolormap = (visstyle.RenderStyle.Flags & STYLEF_InvertOverlay) != 0; + bool invertcolormap = (RenderStyle.Flags & STYLEF_InvertOverlay) != 0; - if (visstyle.RenderStyle.Flags & STYLEF_InvertSource) + if (RenderStyle.Flags & STYLEF_InvertSource) { invertcolormap = !invertcolormap; } @@ -315,12 +317,12 @@ visstyle_t RenderPolySprite::GetSpriteVisStyle(AActor *thing, double z) FDynamicColormap *mybasecolormap = thing->Sector->ColorMap; // Sprites that are added to the scene must fade to black. - if (visstyle.RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0) + if (RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0) { mybasecolormap = GetSpecialLights(mybasecolormap->Color, 0, mybasecolormap->Desaturate); } - if (visstyle.RenderStyle.Flags & STYLEF_FadeToBlack) + if (RenderStyle.Flags & STYLEF_FadeToBlack) { if (invertcolormap) { // Fade to white @@ -336,8 +338,8 @@ visstyle_t RenderPolySprite::GetSpriteVisStyle(AActor *thing, double z) // get light level if (swrenderer::fixedcolormap != nullptr) { // fixed map - visstyle.BaseColormap = swrenderer::fixedcolormap; - visstyle.ColormapNum = 0; + BaseColormap = swrenderer::fixedcolormap; + ColormapNum = 0; } else { @@ -347,24 +349,25 @@ visstyle_t RenderPolySprite::GetSpriteVisStyle(AActor *thing, double z) } if (swrenderer::fixedlightlev >= 0) { - visstyle.BaseColormap = mybasecolormap; - visstyle.ColormapNum = swrenderer::fixedlightlev >> COLORMAPSHIFT; + BaseColormap = mybasecolormap; + ColormapNum = swrenderer::fixedlightlev >> COLORMAPSHIFT; } else if (!foggy && ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT))) { // full bright - visstyle.BaseColormap = mybasecolormap; - visstyle.ColormapNum = 0; + BaseColormap = mybasecolormap; + ColormapNum = 0; } else { // diminished light double minz = double((2048 * 4) / double(1 << 20)); - visstyle.ColormapNum = GETPALOOKUP(swrenderer::r_SpriteVisibility / MAX(z, minz), spriteshade); - visstyle.BaseColormap = mybasecolormap; + ColormapNum = GETPALOOKUP(swrenderer::r_SpriteVisibility / MAX(z, minz), spriteshade); + BaseColormap = mybasecolormap; } } return visstyle; } +#endif FTexture *RenderPolySprite::GetSpriteTexture(AActor *thing, /*out*/ bool &flipX) { diff --git a/src/polyrenderer/scene/poly_sprite.h b/src/polyrenderer/scene/poly_sprite.h index fe38dad22..a61c7f4b5 100644 --- a/src/polyrenderer/scene/poly_sprite.h +++ b/src/polyrenderer/scene/poly_sprite.h @@ -36,5 +36,5 @@ public: static FTexture *GetSpriteTexture(AActor *thing, /*out*/ bool &flipX); private: - visstyle_t GetSpriteVisStyle(AActor *thing, double z); + //visstyle_t GetSpriteVisStyle(AActor *thing, double z); }; diff --git a/src/r_defs.h b/src/r_defs.h index 7f4026d41..81f6869f9 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -1484,14 +1484,11 @@ struct FMiniBSP // typedef BYTE lighttable_t; // This could be wider for >8 bit display. -struct FSWColormap; // This encapsulates the fields of vissprite_t that can be altered by AlterWeaponSprite struct visstyle_t { - int ColormapNum; // Which colormap is rendered - FSWColormap *BaseColormap; // Base colormap used together with ColormapNum - lighttable_t *colormap; // [SP] Restored from GZDoom - will this work? + lighttable_t *colormap; float Alpha; FRenderStyle RenderStyle; }; diff --git a/src/swrenderer/things/r_particle.cpp b/src/swrenderer/things/r_particle.cpp index 3620c916b..3174b52ea 100644 --- a/src/swrenderer/things/r_particle.cpp +++ b/src/swrenderer/things/r_particle.cpp @@ -197,29 +197,29 @@ namespace swrenderer vis->renderflags = (short)(particle->alpha * 255.0f + 0.5f); vis->FakeFlatStat = fakeside; vis->floorclip = 0; - vis->Style.ColormapNum = 0; + vis->ColormapNum = 0; vis->foggy = foggy; if (fixedlightlev >= 0) { - vis->Style.BaseColormap = map; - vis->Style.ColormapNum = fixedlightlev >> COLORMAPSHIFT; + vis->BaseColormap = map; + vis->ColormapNum = fixedlightlev >> COLORMAPSHIFT; } else if (fixedcolormap) { - vis->Style.BaseColormap = fixedcolormap; - vis->Style.ColormapNum = 0; + vis->BaseColormap = fixedcolormap; + vis->ColormapNum = 0; } else if (particle->bright) { - vis->Style.BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : map; - vis->Style.ColormapNum = 0; + vis->BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : map; + vis->ColormapNum = 0; } else { // Particles are slightly more visible than regular sprites. - vis->Style.ColormapNum = GETPALOOKUP(tiz * r_SpriteVisibility * 0.5, shade); - vis->Style.BaseColormap = map; + vis->ColormapNum = GETPALOOKUP(tiz * r_SpriteVisibility * 0.5, shade); + vis->BaseColormap = map; } VisibleSpriteList::Instance()->Push(vis); @@ -232,7 +232,7 @@ namespace swrenderer auto vis = this; int spacing; - BYTE color = vis->Style.BaseColormap->Maps[vis->startfrac]; + BYTE color = vis->BaseColormap->Maps[vis->startfrac]; int yl = vis->y1; int ycount = vis->y2 - yl + 1; int x1 = vis->x1; @@ -243,7 +243,7 @@ namespace swrenderer DrawMaskedSegsBehindParticle(); - uint32_t fg = LightBgra::shade_pal_index_simple(color, LightBgra::calc_light_multiplier(LIGHTSCALE(0, vis->Style.ColormapNum << FRACBITS))); + uint32_t fg = LightBgra::shade_pal_index_simple(color, LightBgra::calc_light_multiplier(LIGHTSCALE(0, vis->ColormapNum << FRACBITS))); // vis->renderflags holds translucency level (0-255) fixed_t fglevel = ((vis->renderflags + 1) << 8) & ~0x3ff; diff --git a/src/swrenderer/things/r_playersprite.cpp b/src/swrenderer/things/r_playersprite.cpp index 0632af074..3e9b136aa 100644 --- a/src/swrenderer/things/r_playersprite.cpp +++ b/src/swrenderer/things/r_playersprite.cpp @@ -305,7 +305,7 @@ namespace swrenderer vis->yscale = float(pspriteyscale / tex->Scale.Y); vis->Translation = 0; // [RH] Use default colors vis->pic = tex; - vis->Style.ColormapNum = 0; + vis->ColormapNum = 0; // If flip is used, provided that it's not already flipped (that would just invert itself) // (It's an XOR...) @@ -335,42 +335,42 @@ namespace swrenderer if (pspr->Flags & PSPF_FORCESTYLE) { - vis->Style.RenderStyle = LegacyRenderStyles[rs]; + vis->RenderStyle = LegacyRenderStyles[rs]; } else if (owner->RenderStyle == LegacyRenderStyles[STYLE_Fuzzy]) { - vis->Style.RenderStyle = LegacyRenderStyles[STYLE_Fuzzy]; + vis->RenderStyle = LegacyRenderStyles[STYLE_Fuzzy]; } else if (owner->RenderStyle == LegacyRenderStyles[STYLE_OptFuzzy]) { - vis->Style.RenderStyle = LegacyRenderStyles[STYLE_OptFuzzy]; - vis->Style.RenderStyle.CheckFuzz(); + vis->RenderStyle = LegacyRenderStyles[STYLE_OptFuzzy]; + vis->RenderStyle.CheckFuzz(); } else if (owner->RenderStyle == LegacyRenderStyles[STYLE_Subtract]) { - vis->Style.RenderStyle = LegacyRenderStyles[STYLE_Subtract]; + vis->RenderStyle = LegacyRenderStyles[STYLE_Subtract]; } else { - vis->Style.RenderStyle = LegacyRenderStyles[rs]; + vis->RenderStyle = LegacyRenderStyles[rs]; } } else { - vis->Style.RenderStyle = owner->RenderStyle; + vis->RenderStyle = owner->RenderStyle; } // Set the alpha based on if using the overlay's own or not. Also adjust // and override the alpha if not forced. if (pspr->Flags & PSPF_ALPHA) { - if (vis->Style.RenderStyle == LegacyRenderStyles[STYLE_Fuzzy]) + if (vis->RenderStyle == LegacyRenderStyles[STYLE_Fuzzy]) { alpha = owner->Alpha; } - else if (vis->Style.RenderStyle == LegacyRenderStyles[STYLE_OptFuzzy]) + else if (vis->RenderStyle == LegacyRenderStyles[STYLE_OptFuzzy]) { - FRenderStyle style = vis->Style.RenderStyle; + FRenderStyle style = vis->RenderStyle; style.CheckFuzz(); switch (style.BlendOp) { @@ -384,15 +384,15 @@ namespace swrenderer } } - else if (vis->Style.RenderStyle == LegacyRenderStyles[STYLE_Subtract]) + else if (vis->RenderStyle == LegacyRenderStyles[STYLE_Subtract]) { alpha = owner->Alpha; } - else if (vis->Style.RenderStyle == LegacyRenderStyles[STYLE_Add] || - vis->Style.RenderStyle == LegacyRenderStyles[STYLE_Translucent] || - vis->Style.RenderStyle == LegacyRenderStyles[STYLE_TranslucentStencil] || - vis->Style.RenderStyle == LegacyRenderStyles[STYLE_AddStencil] || - vis->Style.RenderStyle == LegacyRenderStyles[STYLE_AddShaded]) + else if (vis->RenderStyle == LegacyRenderStyles[STYLE_Add] || + vis->RenderStyle == LegacyRenderStyles[STYLE_Translucent] || + vis->RenderStyle == LegacyRenderStyles[STYLE_TranslucentStencil] || + vis->RenderStyle == LegacyRenderStyles[STYLE_AddStencil] || + vis->RenderStyle == LegacyRenderStyles[STYLE_AddShaded]) { alpha = owner->Alpha * pspr->alpha; } @@ -405,10 +405,10 @@ namespace swrenderer // Should normal renderstyle come out on top at the end and we desire alpha, // switch it to translucent. Normal never applies any sort of alpha. if ((pspr->Flags & PSPF_ALPHA) && - vis->Style.RenderStyle == LegacyRenderStyles[STYLE_Normal] && - vis->Style.Alpha < 1.0) + vis->RenderStyle == LegacyRenderStyles[STYLE_Normal] && + vis->Alpha < 1.0) { - vis->Style.RenderStyle = LegacyRenderStyles[STYLE_Translucent]; + vis->RenderStyle = LegacyRenderStyles[STYLE_Translucent]; alpha = owner->Alpha * pspr->alpha; } @@ -417,22 +417,22 @@ namespace swrenderer if (pspr->Flags & PSPF_FORCEALPHA) { //Due to lack of != operators... - if (vis->Style.RenderStyle == LegacyRenderStyles[STYLE_Fuzzy] || - vis->Style.RenderStyle == LegacyRenderStyles[STYLE_SoulTrans] || - vis->Style.RenderStyle == LegacyRenderStyles[STYLE_Stencil]) + if (vis->RenderStyle == LegacyRenderStyles[STYLE_Fuzzy] || + vis->RenderStyle == LegacyRenderStyles[STYLE_SoulTrans] || + vis->RenderStyle == LegacyRenderStyles[STYLE_Stencil]) { } else { alpha = pspr->alpha; - vis->Style.RenderStyle.Flags |= STYLEF_ForceAlpha; + vis->RenderStyle.Flags |= STYLEF_ForceAlpha; } } - vis->Style.Alpha = clamp(float(alpha), 0.f, 1.f); + vis->Alpha = clamp(float(alpha), 0.f, 1.f); // Due to how some of the effects are handled, going to 0 or less causes some // weirdness to display. There's no point rendering it anyway if it's 0. - if (vis->Style.Alpha <= 0.) + if (vis->Alpha <= 0.) return; //----------------------------------------------------------------------------- @@ -440,16 +440,16 @@ namespace swrenderer // The software renderer cannot invert the source without inverting the overlay // too. That means if the source is inverted, we need to do the reverse of what // the invert overlay flag says to do. - INTBOOL invertcolormap = (vis->Style.RenderStyle.Flags & STYLEF_InvertOverlay); + INTBOOL invertcolormap = (vis->RenderStyle.Flags & STYLEF_InvertOverlay); - if (vis->Style.RenderStyle.Flags & STYLEF_InvertSource) + if (vis->RenderStyle.Flags & STYLEF_InvertSource) { invertcolormap = !invertcolormap; } FDynamicColormap *mybasecolormap = basecolormap; - if (vis->Style.RenderStyle.Flags & STYLEF_FadeToBlack) + if (vis->RenderStyle.Flags & STYLEF_FadeToBlack) { if (invertcolormap) { // Fade to white @@ -464,8 +464,8 @@ namespace swrenderer if (realfixedcolormap != nullptr && (!r_swtruecolor || (r_shadercolormaps && screen->Accel2D))) { // fixed color - vis->Style.BaseColormap = realfixedcolormap; - vis->Style.ColormapNum = 0; + vis->BaseColormap = realfixedcolormap; + vis->ColormapNum = 0; } else { @@ -475,47 +475,43 @@ namespace swrenderer } if (fixedlightlev >= 0) { - vis->Style.BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; - vis->Style.ColormapNum = fixedlightlev >> COLORMAPSHIFT; + vis->BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; + vis->ColormapNum = fixedlightlev >> COLORMAPSHIFT; } else if (!vis->foggy && pspr->GetState()->GetFullbright()) { // full bright - vis->Style.BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; // [RH] use basecolormap - vis->Style.ColormapNum = 0; + vis->BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; // [RH] use basecolormap + vis->ColormapNum = 0; } else { // local light - vis->Style.BaseColormap = mybasecolormap; - vis->Style.ColormapNum = GETPALOOKUP(0, spriteshade); + vis->BaseColormap = mybasecolormap; + vis->ColormapNum = GETPALOOKUP(0, spriteshade); } } if (camera->Inventory != nullptr) { - BYTE oldcolormapnum = vis->Style.ColormapNum; - FSWColormap *oldcolormap = vis->Style.BaseColormap; - camera->Inventory->AlterWeaponSprite(&vis->Style); - if (vis->Style.BaseColormap != oldcolormap || vis->Style.ColormapNum != oldcolormapnum) + visstyle_t visstyle; + visstyle.Alpha = vis->Alpha; + visstyle.RenderStyle = vis->RenderStyle; + visstyle.colormap = nullptr; // Same as the GL render is doing. + + camera->Inventory->AlterWeaponSprite(&visstyle); + + vis->RenderStyle = visstyle.RenderStyle; + vis->Alpha = visstyle.Alpha; + + // Only bother checking for the one type it changes it to until this has been ZScript'ed.. + if (visstyle.colormap == SpecialColormaps[INVERSECOLORMAP].Colormap) { - // The colormap has changed. Is it one we can easily identify? - // If not, then don't bother trying to identify it for - // hardware accelerated drawing. - if (vis->Style.BaseColormap < &SpecialColormaps[0] || - vis->Style.BaseColormap > &SpecialColormaps.Last()) - { - noaccel = true; - } - // Has the basecolormap changed? If so, we can't hardware accelerate it, - // since we don't know what it is anymore. - else if (vis->Style.BaseColormap != mybasecolormap) - { - noaccel = true; - } + vis->BaseColormap = &SpecialColormaps[INVERSECOLORMAP]; + vis->ColormapNum = 0; } } // If we're drawing with a special colormap, but shaders for them are disabled, do // not accelerate. - if (!r_shadercolormaps && (vis->Style.BaseColormap >= &SpecialColormaps[0] && - vis->Style.BaseColormap <= &SpecialColormaps.Last())) + if (!r_shadercolormaps && (vis->BaseColormap >= &SpecialColormaps[0] && + vis->BaseColormap <= &SpecialColormaps.Last())) { noaccel = true; } @@ -543,15 +539,15 @@ namespace swrenderer { colormap_to_use = basecolormap; - vis->Style.BaseColormap = basecolormap; - vis->Style.ColormapNum = 0; + vis->BaseColormap = basecolormap; + vis->ColormapNum = 0; } // Check for hardware-assisted 2D. If it's available, and this sprite is not // fuzzy, don't draw it until after the switch to 2D mode. if (!noaccel && RenderTarget == screen && (DFrameBuffer *)screen->Accel2D) { - FRenderStyle style = vis->Style.RenderStyle; + FRenderStyle style = vis->RenderStyle; style.CheckFuzz(); if (style.BlendOp != STYLEOP_Fuzz) { @@ -585,16 +581,16 @@ namespace swrenderer FColormapStyle colormapstyle; bool usecolormapstyle = false; - if (vis->Style.BaseColormap >= &SpecialColormaps[0] && - vis->Style.BaseColormap < &SpecialColormaps[SpecialColormaps.Size()]) + if (vis->BaseColormap >= &SpecialColormaps[0] && + vis->BaseColormap < &SpecialColormaps[SpecialColormaps.Size()]) { - special = static_cast(vis->Style.BaseColormap); + special = static_cast(vis->BaseColormap); } else if (colormap->Color == PalEntry(255, 255, 255) && colormap->Desaturate == 0) { overlay = colormap->Fade; - overlay.a = BYTE(vis->Style.ColormapNum * 255 / NUMCOLORMAPS); + overlay.a = BYTE(vis->ColormapNum * 255 / NUMCOLORMAPS); } else { @@ -602,7 +598,7 @@ namespace swrenderer colormapstyle.Color = colormap->Color; colormapstyle.Fade = colormap->Fade; colormapstyle.Desaturate = colormap->Desaturate; - colormapstyle.FadeLevel = vis->Style.ColormapNum / float(NUMCOLORMAPS); + colormapstyle.FadeLevel = vis->ColormapNum / float(NUMCOLORMAPS); } screen->DrawTexture(vis->pic, viewwindowx + vispsprites[i].x1, @@ -617,8 +613,8 @@ namespace swrenderer DTA_ClipTop, viewwindowy, DTA_ClipRight, viewwindowx + viewwidth, DTA_ClipBottom, viewwindowy + viewheight, - DTA_AlphaF, vis->Style.Alpha, - DTA_RenderStyle, vis->Style.RenderStyle, + DTA_AlphaF, vis->Alpha, + DTA_RenderStyle, vis->RenderStyle, DTA_FillColor, vis->FillColor, DTA_SpecialColormap, special, DTA_ColorOverlay, overlay.d, diff --git a/src/swrenderer/things/r_sprite.cpp b/src/swrenderer/things/r_sprite.cpp index 95c95a208..664358698 100644 --- a/src/swrenderer/things/r_sprite.cpp +++ b/src/swrenderer/things/r_sprite.cpp @@ -194,14 +194,14 @@ namespace swrenderer vis->renderflags = renderflags; if (thing->flags5 & MF5_BRIGHT) vis->renderflags |= RF_FULLBRIGHT; // kg3D - vis->Style.RenderStyle = thing->RenderStyle; + vis->RenderStyle = thing->RenderStyle; vis->FillColor = thing->fillcolor; vis->Translation = thing->Translation; // [RH] thing translation table vis->FakeFlatStat = fakeside; - vis->Style.Alpha = float(thing->Alpha); + vis->Alpha = float(thing->Alpha); vis->fakefloor = fakefloor; vis->fakeceiling = fakeceiling; - vis->Style.ColormapNum = 0; + vis->ColormapNum = 0; //vis->bInMirror = renderportal->MirrorFlags & RF_XFLIP; //vis->bSplitSprite = false; @@ -212,9 +212,9 @@ namespace swrenderer // The software renderer cannot invert the source without inverting the overlay // too. That means if the source is inverted, we need to do the reverse of what // the invert overlay flag says to do. - INTBOOL invertcolormap = (vis->Style.RenderStyle.Flags & STYLEF_InvertOverlay); + INTBOOL invertcolormap = (vis->RenderStyle.Flags & STYLEF_InvertOverlay); - if (vis->Style.RenderStyle.Flags & STYLEF_InvertSource) + if (vis->RenderStyle.Flags & STYLEF_InvertSource) { invertcolormap = !invertcolormap; } @@ -226,12 +226,12 @@ namespace swrenderer } // Sprites that are added to the scene must fade to black. - if (vis->Style.RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0) + if (vis->RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0) { mybasecolormap = GetSpecialLights(mybasecolormap->Color, 0, mybasecolormap->Desaturate); } - if (vis->Style.RenderStyle.Flags & STYLEF_FadeToBlack) + if (vis->RenderStyle.Flags & STYLEF_FadeToBlack) { if (invertcolormap) { // Fade to white @@ -247,8 +247,8 @@ namespace swrenderer // get light level if (fixedcolormap != nullptr) { // fixed map - vis->Style.BaseColormap = fixedcolormap; - vis->Style.ColormapNum = 0; + vis->BaseColormap = fixedcolormap; + vis->ColormapNum = 0; } else { @@ -258,18 +258,18 @@ namespace swrenderer } if (fixedlightlev >= 0) { - vis->Style.BaseColormap = mybasecolormap; - vis->Style.ColormapNum = fixedlightlev >> COLORMAPSHIFT; + vis->BaseColormap = mybasecolormap; + vis->ColormapNum = fixedlightlev >> COLORMAPSHIFT; } else if (!vis->foggy && ((renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT))) { // full bright - vis->Style.BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; - vis->Style.ColormapNum = 0; + vis->BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; + vis->ColormapNum = 0; } else { // diminished light - vis->Style.ColormapNum = GETPALOOKUP(r_SpriteVisibility / MAX(tz, MINZ), spriteshade); - vis->Style.BaseColormap = mybasecolormap; + vis->ColormapNum = GETPALOOKUP(r_SpriteVisibility / MAX(tz, MINZ), spriteshade); + vis->BaseColormap = mybasecolormap; } } @@ -295,17 +295,17 @@ namespace swrenderer } fixed_t centeryfrac = FLOAT2FIXED(CenterY); - R_SetColorMapLight(vis->Style.BaseColormap, 0, vis->Style.ColormapNum << FRACBITS); + R_SetColorMapLight(vis->BaseColormap, 0, vis->ColormapNum << FRACBITS); - FDynamicColormap *basecolormap = static_cast(vis->Style.BaseColormap); + FDynamicColormap *basecolormap = static_cast(vis->BaseColormap); - bool visible = R_SetPatchStyle(vis->Style.RenderStyle, vis->Style.Alpha, vis->Translation, vis->FillColor, basecolormap); + bool visible = R_SetPatchStyle(vis->RenderStyle, vis->Alpha, vis->Translation, vis->FillColor, basecolormap); - if (vis->Style.RenderStyle == LegacyRenderStyles[STYLE_Shaded]) + if (vis->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. - R_SetColorMapLight(drawerargs::dc_fcolormap, 0, vis->Style.ColormapNum << FRACBITS); + R_SetColorMapLight(drawerargs::dc_fcolormap, 0, vis->ColormapNum << FRACBITS); } if (visible) diff --git a/src/swrenderer/things/r_visiblesprite.cpp b/src/swrenderer/things/r_visiblesprite.cpp index d0551377c..a350cda64 100644 --- a/src/swrenderer/things/r_visiblesprite.cpp +++ b/src/swrenderer/things/r_visiblesprite.cpp @@ -52,8 +52,8 @@ namespace swrenderer int r1, r2; short topclip, botclip; short *clip1, *clip2; - FSWColormap *colormap = spr->Style.BaseColormap; - int colormapnum = spr->Style.ColormapNum; + FSWColormap *colormap = spr->BaseColormap; + int colormapnum = spr->ColormapNum; F3DFloor *rover; FDynamicColormap *mybasecolormap; @@ -120,20 +120,20 @@ namespace swrenderer // found new values, recalculate if (sec) { - INTBOOL invertcolormap = (spr->Style.RenderStyle.Flags & STYLEF_InvertOverlay); + INTBOOL invertcolormap = (spr->RenderStyle.Flags & STYLEF_InvertOverlay); - if (spr->Style.RenderStyle.Flags & STYLEF_InvertSource) + if (spr->RenderStyle.Flags & STYLEF_InvertSource) { invertcolormap = !invertcolormap; } // Sprites that are added to the scene must fade to black. - if (spr->Style.RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0) + if (spr->RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0) { mybasecolormap = GetSpecialLights(mybasecolormap->Color, 0, mybasecolormap->Desaturate); } - if (spr->Style.RenderStyle.Flags & STYLEF_FadeToBlack) + if (spr->RenderStyle.Flags & STYLEF_FadeToBlack) { if (invertcolormap) { // Fade to white @@ -153,19 +153,19 @@ namespace swrenderer } if (fixedlightlev >= 0) { - spr->Style.BaseColormap = mybasecolormap; - spr->Style.ColormapNum = fixedlightlev >> COLORMAPSHIFT; + spr->BaseColormap = mybasecolormap; + spr->ColormapNum = fixedlightlev >> COLORMAPSHIFT; } else if (!spr->foggy && (spr->renderflags & RF_FULLBRIGHT)) { // full bright - spr->Style.BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; - spr->Style.ColormapNum = 0; + spr->BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; + spr->ColormapNum = 0; } else { // diminished light int spriteshade = LIGHT2SHADE(sec->lightlevel + R_ActualExtraLight(spr->foggy)); - spr->Style.BaseColormap = mybasecolormap; - spr->Style.ColormapNum = GETPALOOKUP(r_SpriteVisibility / MAX(MINZ, (double)spr->depth), spriteshade); + spr->BaseColormap = mybasecolormap; + spr->ColormapNum = GETPALOOKUP(r_SpriteVisibility / MAX(MINZ, (double)spr->depth), spriteshade); } } } @@ -291,8 +291,8 @@ namespace swrenderer if (topclip >= botclip) { - spr->Style.BaseColormap = colormap; - spr->Style.ColormapNum = colormapnum; + spr->BaseColormap = colormap; + spr->ColormapNum = colormapnum; return; } @@ -418,8 +418,8 @@ namespace swrenderer } if (i == x2) { - spr->Style.BaseColormap = colormap; - spr->Style.ColormapNum = colormapnum; + spr->BaseColormap = colormap; + spr->ColormapNum = colormapnum; return; } } @@ -437,7 +437,7 @@ namespace swrenderer int maxvoxely = spr->gzb > hzb ? INT_MAX : xs_RoundToInt((spr->gzt - hzb) / spr->yscale); spr->Render(cliptop, clipbot, minvoxely, maxvoxely); } - spr->Style.BaseColormap = colormap; - spr->Style.ColormapNum = colormapnum; + spr->BaseColormap = colormap; + spr->ColormapNum = colormapnum; } } diff --git a/src/swrenderer/things/r_visiblesprite.h b/src/swrenderer/things/r_visiblesprite.h index 41d50aff1..2339ca382 100644 --- a/src/swrenderer/things/r_visiblesprite.h +++ b/src/swrenderer/things/r_visiblesprite.h @@ -19,11 +19,15 @@ #define MINZ double((2048*4) / double(1 << 20)) +struct FSWColormap; + namespace swrenderer { class VisibleSprite { public: + virtual ~VisibleSprite() { } + void Render(); bool IsCurrentPortalUniq(int portalUniq) const { return CurrentPortalUniq == portalUniq; } @@ -59,7 +63,10 @@ namespace swrenderer sector_t *sector; // sector this sprite is in // Light shared calculation? - visstyle_t Style; + int ColormapNum; // Which colormap is rendered + FSWColormap *BaseColormap; // Base colormap used together with ColormapNum + float Alpha; + FRenderStyle RenderStyle; bool foggy; short renderflags; diff --git a/src/swrenderer/things/r_voxel.cpp b/src/swrenderer/things/r_voxel.cpp index 7ff15c7be..fa6f35e85 100644 --- a/src/swrenderer/things/r_voxel.cpp +++ b/src/swrenderer/things/r_voxel.cpp @@ -142,14 +142,14 @@ namespace swrenderer vis->renderflags = renderflags; if (thing->flags5 & MF5_BRIGHT) vis->renderflags |= RF_FULLBRIGHT; // kg3D - vis->Style.RenderStyle = thing->RenderStyle; + vis->RenderStyle = thing->RenderStyle; vis->FillColor = thing->fillcolor; vis->Translation = thing->Translation; // [RH] thing translation table vis->FakeFlatStat = fakeside; - vis->Style.Alpha = float(thing->Alpha); + vis->Alpha = float(thing->Alpha); vis->fakefloor = fakefloor; vis->fakeceiling = fakeceiling; - vis->Style.ColormapNum = 0; + vis->ColormapNum = 0; //vis->bInMirror = renderportal->MirrorFlags & RF_XFLIP; //vis->bSplitSprite = false; @@ -159,9 +159,9 @@ namespace swrenderer // The software renderer cannot invert the source without inverting the overlay // too. That means if the source is inverted, we need to do the reverse of what // the invert overlay flag says to do. - INTBOOL invertcolormap = (vis->Style.RenderStyle.Flags & STYLEF_InvertOverlay); + INTBOOL invertcolormap = (vis->RenderStyle.Flags & STYLEF_InvertOverlay); - if (vis->Style.RenderStyle.Flags & STYLEF_InvertSource) + if (vis->RenderStyle.Flags & STYLEF_InvertSource) { invertcolormap = !invertcolormap; } @@ -173,12 +173,12 @@ namespace swrenderer } // Sprites that are added to the scene must fade to black. - if (vis->Style.RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0) + if (vis->RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0) { mybasecolormap = GetSpecialLights(mybasecolormap->Color, 0, mybasecolormap->Desaturate); } - if (vis->Style.RenderStyle.Flags & STYLEF_FadeToBlack) + if (vis->RenderStyle.Flags & STYLEF_FadeToBlack) { if (invertcolormap) { // Fade to white @@ -194,8 +194,8 @@ namespace swrenderer // get light level if (fixedcolormap != nullptr) { // fixed map - vis->Style.BaseColormap = fixedcolormap; - vis->Style.ColormapNum = 0; + vis->BaseColormap = fixedcolormap; + vis->ColormapNum = 0; } else { @@ -206,18 +206,18 @@ namespace swrenderer if (fixedlightlev >= 0) { - vis->Style.BaseColormap = mybasecolormap; - vis->Style.ColormapNum = fixedlightlev >> COLORMAPSHIFT; + vis->BaseColormap = mybasecolormap; + vis->ColormapNum = fixedlightlev >> COLORMAPSHIFT; } else if (!vis->foggy && ((renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT))) { // full bright - vis->Style.BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; - vis->Style.ColormapNum = 0; + vis->BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; + vis->ColormapNum = 0; } else { // diminished light - vis->Style.ColormapNum = GETPALOOKUP(r_SpriteVisibility / MAX(tz, MINZ), spriteshade); - vis->Style.BaseColormap = mybasecolormap; + vis->ColormapNum = GETPALOOKUP(r_SpriteVisibility / MAX(tz, MINZ), spriteshade); + vis->BaseColormap = mybasecolormap; } } @@ -229,11 +229,11 @@ namespace swrenderer { auto sprite = this; - FDynamicColormap *basecolormap = static_cast(sprite->Style.BaseColormap); + FDynamicColormap *basecolormap = static_cast(sprite->BaseColormap); - R_SetColorMapLight(sprite->Style.BaseColormap, 0, sprite->Style.ColormapNum << FRACBITS); + R_SetColorMapLight(sprite->BaseColormap, 0, sprite->ColormapNum << FRACBITS); - bool visible = R_SetPatchStyle(sprite->Style.RenderStyle, sprite->Style.Alpha, sprite->Translation, sprite->FillColor, basecolormap); + bool visible = R_SetPatchStyle(sprite->RenderStyle, sprite->Alpha, sprite->Translation, sprite->FillColor, basecolormap); if (!visible) return; @@ -620,8 +620,8 @@ namespace swrenderer int flags = 0; // Do setup for blending. - R_SetColorMapLight(spr->Style.BaseColormap, 0, spr->Style.ColormapNum << FRACBITS); - bool visible = R_SetPatchStyle(spr->Style.RenderStyle, spr->Style.Alpha, spr->Translation, spr->FillColor); + R_SetColorMapLight(spr->BaseColormap, 0, spr->ColormapNum << FRACBITS); + bool visible = R_SetPatchStyle(spr->RenderStyle, spr->Alpha, spr->Translation, spr->FillColor); if (!visible) { @@ -646,7 +646,7 @@ namespace swrenderer // Render the voxel, either directly to the screen or offscreen. R_DrawVoxel(spr->pa.vpos, spr->pa.vang, spr->gpos, spr->Angle, - spr->xscale, FLOAT2FIXED(spr->yscale), spr->voxel, spr->Style.BaseColormap, spr->Style.ColormapNum, cliptop, clipbot, + spr->xscale, FLOAT2FIXED(spr->yscale), spr->voxel, spr->BaseColormap, spr->ColormapNum, cliptop, clipbot, minslabz, maxslabz, flags); // Blend the voxel, if that's what we need to do. diff --git a/src/swrenderer/things/r_wallsprite.cpp b/src/swrenderer/things/r_wallsprite.cpp index 3f8ecbaa7..1a520cfe7 100644 --- a/src/swrenderer/things/r_wallsprite.cpp +++ b/src/swrenderer/things/r_wallsprite.cpp @@ -120,17 +120,17 @@ namespace swrenderer vis->deltay = float(pos.Y - ViewPos.Y); vis->renderflags = renderflags; if (thing->flags5 & MF5_BRIGHT) vis->renderflags |= RF_FULLBRIGHT; // kg3D - vis->Style.RenderStyle = thing->RenderStyle; + vis->RenderStyle = thing->RenderStyle; vis->FillColor = thing->fillcolor; vis->Translation = thing->Translation; vis->FakeFlatStat = WaterFakeSide::Center; - vis->Style.Alpha = float(thing->Alpha); + vis->Alpha = float(thing->Alpha); vis->fakefloor = NULL; vis->fakeceiling = NULL; //vis->bInMirror = renderportal->MirrorFlags & RF_XFLIP; vis->pic = pic; - vis->Style.ColormapNum = GETPALOOKUP(r_SpriteVisibility / MAX(tz, MINZ), spriteshade); - vis->Style.BaseColormap = basecolormap; + vis->ColormapNum = GETPALOOKUP(r_SpriteVisibility / MAX(tz, MINZ), spriteshade); + vis->BaseColormap = basecolormap; vis->wallc = wallc; vis->foggy = foggy; @@ -165,11 +165,11 @@ namespace swrenderer } // Prepare lighting bool calclighting = false; - FSWColormap *usecolormap = spr->Style.BaseColormap; + FSWColormap *usecolormap = spr->BaseColormap; bool rereadcolormap = true; // Decals that are added to the scene must fade to black. - if (spr->Style.RenderStyle == LegacyRenderStyles[STYLE_Add] && usecolormap->Fade != 0) + if (spr->RenderStyle == LegacyRenderStyles[STYLE_Add] && usecolormap->Fade != 0) { usecolormap = GetSpecialLights(usecolormap->Color, 0, usecolormap->Desaturate); rereadcolormap = false; @@ -206,14 +206,14 @@ namespace swrenderer int x = x1; - FDynamicColormap *basecolormap = static_cast(spr->Style.BaseColormap); + FDynamicColormap *basecolormap = static_cast(spr->BaseColormap); - bool visible = R_SetPatchStyle(spr->Style.RenderStyle, spr->Style.Alpha, spr->Translation, spr->FillColor, basecolormap); + bool visible = R_SetPatchStyle(spr->RenderStyle, spr->Alpha, spr->Translation, spr->FillColor, basecolormap); // R_SetPatchStyle can modify basecolormap. if (rereadcolormap) { - usecolormap = spr->Style.BaseColormap; + usecolormap = spr->BaseColormap; } if (!visible)