Remove a few more drawerargs

This commit is contained in:
Magnus Norddahl 2017-01-28 08:17:31 +01:00
parent 9eebe3e940
commit dbf9cd5de5
5 changed files with 23 additions and 40 deletions

View File

@ -130,7 +130,6 @@ namespace swrenderer
const uint8_t *ds_source;
bool ds_source_mipmapped;
int ds_color;
bool drawer_needs_pal_input;
}
namespace
@ -242,19 +241,18 @@ namespace swrenderer
{
using namespace drawerargs;
dc_fcolormap = base_colormap;
if (r_swtruecolor)
{
dc_shade_constants.light_red = dc_fcolormap->Color.r * 256 / 255;
dc_shade_constants.light_green = dc_fcolormap->Color.g * 256 / 255;
dc_shade_constants.light_blue = dc_fcolormap->Color.b * 256 / 255;
dc_shade_constants.light_alpha = dc_fcolormap->Color.a * 256 / 255;
dc_shade_constants.fade_red = dc_fcolormap->Fade.r;
dc_shade_constants.fade_green = dc_fcolormap->Fade.g;
dc_shade_constants.fade_blue = dc_fcolormap->Fade.b;
dc_shade_constants.fade_alpha = dc_fcolormap->Fade.a;
dc_shade_constants.desaturate = MIN(abs(dc_fcolormap->Desaturate), 255) * 255 / 256;
dc_shade_constants.simple_shade = (dc_fcolormap->Color.d == 0x00ffffff && dc_fcolormap->Fade.d == 0x00000000 && dc_fcolormap->Desaturate == 0);
dc_shade_constants.light_red = base_colormap->Color.r * 256 / 255;
dc_shade_constants.light_green = base_colormap->Color.g * 256 / 255;
dc_shade_constants.light_blue = base_colormap->Color.b * 256 / 255;
dc_shade_constants.light_alpha = base_colormap->Color.a * 256 / 255;
dc_shade_constants.fade_red = base_colormap->Fade.r;
dc_shade_constants.fade_green = base_colormap->Fade.g;
dc_shade_constants.fade_blue = base_colormap->Fade.b;
dc_shade_constants.fade_alpha = base_colormap->Fade.a;
dc_shade_constants.desaturate = MIN(abs(base_colormap->Desaturate), 255) * 255 / 256;
dc_shade_constants.simple_shade = (base_colormap->Color.d == 0x00ffffff && base_colormap->Fade.d == 0x00000000 && base_colormap->Desaturate == 0);
dc_colormap = base_colormap->Maps;
dc_light = LIGHTSCALE(light, shade);
}
@ -687,7 +685,7 @@ namespace swrenderer
}
}
bool DrawerStyle::SetPatchStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap)
bool DrawerStyle::SetPatchStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade)
{
using namespace drawerargs;
@ -755,11 +753,13 @@ namespace swrenderer
basecolormap = &ShadeFakeColormap[16 - alpha];
if (cameraLight->fixedlightlev >= 0 && cameraLight->fixedcolormap == NULL)
{
R_SetColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
fixed_t shade = shadedlightshade;
if (shade == 0) FIXEDLIGHT2SHADE(cameraLight->fixedlightlev);
R_SetColorMapLight(basecolormap, 0, shade);
}
else
{
R_SetColorMapLight(basecolormap, 0, 0);
R_SetColorMapLight(basecolormap, 0, shadedlightshade);
}
return true;
}
@ -796,9 +796,9 @@ namespace swrenderer
return true;
}
bool DrawerStyle::SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap)
bool DrawerStyle::SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade)
{
return SetPatchStyle(style, FLOAT2FIXED(alpha), translation, color, basecolormap);
return SetPatchStyle(style, FLOAT2FIXED(alpha), translation, color, basecolormap, shadedlightshade);
}
DrawerFunc DrawerStyle::GetTransMaskDrawer()

View File

@ -37,7 +37,6 @@ namespace swrenderer
{
extern int dc_pitch;
extern lighttable_t *dc_colormap;
extern FSWColormap *dc_fcolormap;
extern ShadeConstants dc_shade_constants;
extern fixed_t dc_light;
extern int dc_x;
@ -67,8 +66,6 @@ namespace swrenderer
extern TriLight *dc_lights;
extern int dc_num_lights;
extern bool drawer_needs_pal_input;
extern uint32_t dc_wall_texturefrac[4];
extern uint32_t dc_wall_iscale[4];
extern uint8_t *dc_wall_colormap[4];
@ -192,8 +189,8 @@ namespace swrenderer
spanfunc = &SWPixelFormatDrawers::DrawSpan;
}
bool SetPatchStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap);
bool SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap);
bool SetPatchStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade = 0);
bool SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade = 0);
void SetSpanStyle(bool masked, bool additive, fixed_t alpha);
void DrawMaskedColumn(int x, fixed_t iscale, FTexture *texture, fixed_t column, double spryscale, double sprtopscreen, bool sprflipvert, const short *mfloorclip, const short *mceilingclip, bool unmasked = false);
@ -211,5 +208,7 @@ namespace swrenderer
bool SetBlendFunc(int op, fixed_t fglevel, fixed_t bglevel, int flags);
static fixed_t GetAlpha(int type, fixed_t alpha);
bool drawer_needs_pal_input = false;
};
}

View File

@ -592,15 +592,7 @@ namespace swrenderer
FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(Light.BaseColormap);
DrawerStyle drawerstyle;
bool visible = drawerstyle.SetPatchStyle(RenderStyle, Alpha, Translation, FillColor, basecolormap);
if (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, Light.ColormapNum << FRACBITS);
}
bool visible = drawerstyle.SetPatchStyle(RenderStyle, Alpha, Translation, FillColor, basecolormap, Light.ColormapNum << FRACBITS);
if (!visible)
return;

View File

@ -251,14 +251,7 @@ namespace swrenderer
FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(vis->Light.BaseColormap);
DrawerStyle drawerstyle;
bool visible = drawerstyle.SetPatchStyle(vis->RenderStyle, vis->Alpha, vis->Translation, vis->FillColor, basecolormap);
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->Light.ColormapNum << FRACBITS);
}
bool visible = drawerstyle.SetPatchStyle(vis->RenderStyle, vis->Alpha, vis->Translation, vis->FillColor, basecolormap, vis->Light.ColormapNum << FRACBITS);
if (visible)
{

View File

@ -197,7 +197,6 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
R_SetTranslationMap(identitymap);
}
CameraLight::Instance()->fixedcolormap = dc_fcolormap;
bool visible;
FDynamicColormap *basecolormap = nullptr;
DrawerStyle drawerstyle;