From f8010854c3a1a8dc32cea01b9e511027f68af65a Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 27 Dec 2016 23:53:47 +0100 Subject: [PATCH] Move colfunc and friends to r_draw and change them to member function pointers --- src/swrenderer/drawers/r_draw.cpp | 66 +++++++++++++++-------------- src/swrenderer/drawers/r_draw.h | 47 ++++---------------- src/swrenderer/r_main.cpp | 12 ++---- src/swrenderer/r_main.h | 12 ------ src/swrenderer/scene/r_plane.cpp | 30 ++++++------- src/swrenderer/scene/r_things.cpp | 4 +- src/swrenderer/scene/r_voxel.cpp | 2 +- src/swrenderer/scene/r_walldraw.cpp | 20 ++++----- src/v_draw.cpp | 2 +- 9 files changed, 73 insertions(+), 122 deletions(-) diff --git a/src/swrenderer/drawers/r_draw.cpp b/src/swrenderer/drawers/r_draw.cpp index dbce7ec48..201f09abf 100644 --- a/src/swrenderer/drawers/r_draw.cpp +++ b/src/swrenderer/drawers/r_draw.cpp @@ -70,6 +70,12 @@ namespace swrenderer int fuzzpos; int fuzzviewheight; + DrawerFunc colfunc; + DrawerFunc basecolfunc; + DrawerFunc fuzzcolfunc; + DrawerFunc transcolfunc; + DrawerFunc spanfunc; + namespace drawerargs { int dc_pitch; @@ -154,10 +160,10 @@ namespace swrenderer else active_drawers = &pal_drawers; - colfunc = basecolfunc = R_DrawColumn; - fuzzcolfunc = R_DrawFuzzColumn; - transcolfunc = R_DrawTranslatedColumn; - spanfunc = R_DrawSpan; + colfunc = basecolfunc = &SWPixelFormatDrawers::DrawColumn; + fuzzcolfunc = &SWPixelFormatDrawers::DrawFuzzColumn; + transcolfunc = &SWPixelFormatDrawers::DrawTranslatedColumn; + spanfunc = &SWPixelFormatDrawers::DrawSpan; } void R_InitShadeMaps() @@ -240,7 +246,7 @@ namespace swrenderer { if (flags & STYLEF_ColorIsFixed) { - colfunc = R_FillColumn; + colfunc = &SWPixelFormatDrawers::FillColumn; } else if (dc_translation == NULL) { @@ -285,15 +291,15 @@ namespace swrenderer { // Colors won't overflow when added if (flags & STYLEF_ColorIsFixed) { - colfunc = R_FillAddColumn; + colfunc = &SWPixelFormatDrawers::FillAddColumn; } else if (dc_translation == NULL) { - colfunc = R_DrawAddColumn; + colfunc = &SWPixelFormatDrawers::DrawAddColumn; } else { - colfunc = R_DrawTlatedAddColumn; + colfunc = &SWPixelFormatDrawers::DrawTranslatedAddColumn; drawer_needs_pal_input = true; } } @@ -301,15 +307,15 @@ namespace swrenderer { // Colors might overflow when added if (flags & STYLEF_ColorIsFixed) { - colfunc = R_FillAddClampColumn; + colfunc = &SWPixelFormatDrawers::FillAddClampColumn; } else if (dc_translation == NULL) { - colfunc = R_DrawAddClampColumn; + colfunc = &SWPixelFormatDrawers::DrawAddClampColumn; } else { - colfunc = R_DrawAddClampTranslatedColumn; + colfunc = &SWPixelFormatDrawers::DrawAddClampTranslatedColumn; drawer_needs_pal_input = true; } } @@ -318,15 +324,15 @@ namespace swrenderer case STYLEOP_Sub: if (flags & STYLEF_ColorIsFixed) { - colfunc = R_FillSubClampColumn; + colfunc = &SWPixelFormatDrawers::FillSubClampColumn; } else if (dc_translation == NULL) { - colfunc = R_DrawSubClampColumn; + colfunc = &SWPixelFormatDrawers::DrawSubClampColumn; } else { - colfunc = R_DrawSubClampTranslatedColumn; + colfunc = &SWPixelFormatDrawers::DrawSubClampTranslatedColumn; drawer_needs_pal_input = true; } return true; @@ -338,15 +344,15 @@ namespace swrenderer } if (flags & STYLEF_ColorIsFixed) { - colfunc = R_FillRevSubClampColumn; + colfunc = &SWPixelFormatDrawers::FillRevSubClampColumn; } else if (dc_translation == NULL) { - colfunc = R_DrawRevSubClampColumn; + colfunc = &SWPixelFormatDrawers::DrawRevSubClampColumn; } else { - colfunc = R_DrawRevSubClampTranslatedColumn; + colfunc = &SWPixelFormatDrawers::DrawRevSubClampTranslatedColumn; drawer_needs_pal_input = true; } return true; @@ -433,7 +439,7 @@ namespace swrenderer // Shaded drawer only gets 16 levels of alpha because it saves memory. if ((alpha >>= 12) == 0) return false; - colfunc = R_DrawShadedColumn; + colfunc = &SWPixelFormatDrawers::DrawShadedColumn; drawer_needs_pal_input = true; dc_color = fixedcolormap ? fixedcolormap->Maps[APART(color)] : basecolormap->Maps[APART(color)]; basecolormap = &ShadeFakeColormap[16 - alpha]; @@ -507,29 +513,25 @@ namespace swrenderer return tex->GetColumn(col, nullptr); } - bool R_GetTransMaskDrawers(void(**drawColumn)()) + DrawerFunc R_GetTransMaskDrawer() { - if (colfunc == R_DrawAddColumn) + if (colfunc == &SWPixelFormatDrawers::DrawAddColumn) { - *drawColumn = R_DrawWallAddColumn; - return true; + return &SWPixelFormatDrawers::DrawWallAddColumn; } - if (colfunc == R_DrawAddClampColumn) + if (colfunc == &SWPixelFormatDrawers::DrawAddClampColumn) { - *drawColumn = R_DrawWallAddClampColumn; - return true; + return &SWPixelFormatDrawers::DrawWallAddClampColumn; } - if (colfunc == R_DrawSubClampColumn) + if (colfunc == &SWPixelFormatDrawers::DrawSubClampColumn) { - *drawColumn = R_DrawWallSubClampColumn; - return true; + return &SWPixelFormatDrawers::DrawWallSubClampColumn; } - if (colfunc == R_DrawRevSubClampColumn) + if (colfunc == &SWPixelFormatDrawers::DrawRevSubClampColumn) { - *drawColumn = R_DrawWallRevSubClampColumn; - return true; + return &SWPixelFormatDrawers::DrawWallRevSubClampColumn; } - return false; + return nullptr; } void R_SetColorMapLight(FSWColormap *base_colormap, float light, int shade) diff --git a/src/swrenderer/drawers/r_draw.h b/src/swrenderer/drawers/r_draw.h index bf2ef1a0b..496b2ee11 100644 --- a/src/swrenderer/drawers/r_draw.h +++ b/src/swrenderer/drawers/r_draw.h @@ -164,6 +164,8 @@ namespace swrenderer virtual void DrawFogBoundaryLine(int y, int x1, int x2) = 0; }; + typedef void(SWPixelFormatDrawers::*DrawerFunc)(); + SWPixelFormatDrawers *R_Drawers(); void R_InitColumnDrawers(); @@ -173,7 +175,7 @@ namespace swrenderer bool R_SetPatchStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color); bool R_SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color); void R_FinishSetPatchStyle(); // Call this after finished drawing the current thing, in case its style was STYLE_Shade - bool R_GetTransMaskDrawers(void(**drawColumn)()); + DrawerFunc R_GetTransMaskDrawer(); const uint8_t *R_GetColumn(FTexture *tex, int col); @@ -187,42 +189,9 @@ namespace swrenderer void R_SetSpanTexture(FTexture *tex); void R_SetSpanColormap(FDynamicColormap *colormap, int shade); - inline void R_DrawWallColumn() { R_Drawers()->DrawWallColumn(); } - inline void R_DrawWallMaskedColumn() { R_Drawers()->DrawWallMaskedColumn(); } - inline void R_DrawWallAddColumn() { R_Drawers()->DrawWallAddColumn(); } - inline void R_DrawWallAddClampColumn() { R_Drawers()->DrawWallAddClampColumn(); } - inline void R_DrawWallSubClampColumn() { R_Drawers()->DrawWallSubClampColumn(); } - inline void R_DrawWallRevSubClampColumn() { R_Drawers()->DrawWallRevSubClampColumn(); } - inline void R_DrawSingleSkyColumn(uint32_t solid_top, uint32_t solid_bottom) { R_Drawers()->DrawSingleSkyColumn(solid_top, solid_bottom); } - inline void R_DrawDoubleSkyColumn(uint32_t solid_top, uint32_t solid_bottom) { R_Drawers()->DrawDoubleSkyColumn(solid_top, solid_bottom); } - inline void R_DrawColumn() { R_Drawers()->DrawColumn(); } - inline void R_FillColumn() { R_Drawers()->FillColumn(); } - inline void R_FillAddColumn() { R_Drawers()->FillAddColumn(); } - inline void R_FillAddClampColumn() { R_Drawers()->FillAddClampColumn(); } - inline void R_FillSubClampColumn() { R_Drawers()->FillSubClampColumn(); } - inline void R_FillRevSubClampColumn() { R_Drawers()->FillRevSubClampColumn(); } - inline void R_DrawFuzzColumn() { R_Drawers()->DrawFuzzColumn(); } - inline void R_DrawAddColumn() { R_Drawers()->DrawAddColumn(); } - inline void R_DrawTranslatedColumn() { R_Drawers()->DrawTranslatedColumn(); } - inline void R_DrawTlatedAddColumn() { R_Drawers()->DrawTranslatedAddColumn(); } - inline void R_DrawShadedColumn() { R_Drawers()->DrawShadedColumn(); } - inline void R_DrawAddClampColumn() { R_Drawers()->DrawAddClampColumn(); } - inline void R_DrawAddClampTranslatedColumn() { R_Drawers()->DrawAddClampTranslatedColumn(); } - inline void R_DrawSubClampColumn() { R_Drawers()->DrawSubClampColumn(); } - inline void R_DrawSubClampTranslatedColumn() { R_Drawers()->DrawSubClampTranslatedColumn(); } - inline void R_DrawRevSubClampColumn() { R_Drawers()->DrawRevSubClampColumn(); } - inline void R_DrawRevSubClampTranslatedColumn() { R_Drawers()->DrawRevSubClampTranslatedColumn(); } - inline void R_DrawSpan() { R_Drawers()->DrawSpan(); } - inline void R_DrawSpanMasked() { R_Drawers()->DrawSpanMasked(); } - inline void R_DrawSpanTranslucent() { R_Drawers()->DrawSpanTranslucent(); } - inline void R_DrawSpanMaskedTranslucent() { R_Drawers()->DrawSpanMaskedTranslucent(); } - inline void R_DrawSpanAddClamp() { R_Drawers()->DrawSpanAddClamp(); } - inline void R_DrawSpanMaskedAddClamp() { R_Drawers()->DrawSpanMaskedAddClamp(); } - inline void R_FillSpan() { R_Drawers()->FillSpan(); } - inline void R_DrawTiltedSpan(int y, int x1, int x2, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int planeshade, float planelightfloat, fixed_t pviewx, fixed_t pviewy) - { - R_Drawers()->DrawTiltedSpan(y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy); - } - inline void R_DrawColoredSpan(int y, int x1, int x2) { R_Drawers()->DrawColoredSpan(y, x1, x2); } - inline void R_DrawFogBoundaryLine(int y, int x1, int x2) { R_Drawers()->DrawFogBoundaryLine(y, x1, x2); } + extern DrawerFunc colfunc; + extern DrawerFunc basecolfunc; + extern DrawerFunc fuzzcolfunc; + extern DrawerFunc transcolfunc; + extern DrawerFunc spanfunc; } diff --git a/src/swrenderer/r_main.cpp b/src/swrenderer/r_main.cpp index ea5bb64e5..dbee5ab24 100644 --- a/src/swrenderer/r_main.cpp +++ b/src/swrenderer/r_main.cpp @@ -163,12 +163,6 @@ angle_t xtoviewangle[MAXWIDTH+1]; bool foggy; // [RH] ignore extralight and fullbright? int r_actualextralight; -void (*colfunc) (void); -void (*basecolfunc) (void); -void (*fuzzcolfunc) (void); -void (*transcolfunc) (void); -void (*spanfunc) (void); - cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles; // PRIVATE DATA DEFINITIONS ------------------------------------------------ @@ -848,13 +842,13 @@ void R_RenderActorView (AActor *actor, bool dontmaplines) // [RH] Show off segs if r_drawflat is 1 if (r_drawflat) { - colfunc = R_FillColumn; - spanfunc = R_FillSpan; + colfunc = &SWPixelFormatDrawers::FillColumn; + spanfunc = &SWPixelFormatDrawers::FillSpan; } else { colfunc = basecolfunc; - spanfunc = R_DrawSpan; + spanfunc = &SWPixelFormatDrawers::DrawSpan; } WindowLeft = 0; diff --git a/src/swrenderer/r_main.h b/src/swrenderer/r_main.h index daf60c16d..5fb10cec3 100644 --- a/src/swrenderer/r_main.h +++ b/src/swrenderer/r_main.h @@ -112,18 +112,6 @@ extern int fixedlightlev; extern FSWColormap* fixedcolormap; extern FSpecialColormap*realfixedcolormap; - -// -// Function pointers to switch refresh/drawing functions. -// Used to select shadow mode etc. -// -extern void (*colfunc) (void); -extern void (*basecolfunc) (void); -extern void (*fuzzcolfunc) (void); -extern void (*transcolfunc) (void); -// No shadow effects on floors. -extern void (*spanfunc) (void); - void R_InitTextureMapping (); diff --git a/src/swrenderer/scene/r_plane.cpp b/src/swrenderer/scene/r_plane.cpp index fecef724e..9988ab12f 100644 --- a/src/swrenderer/scene/r_plane.cpp +++ b/src/swrenderer/scene/r_plane.cpp @@ -318,7 +318,7 @@ void R_MapPlane (int y, int x1) ds_x1 = x1; ds_x2 = x2; - spanfunc (); + (R_Drawers()->*spanfunc)(); } //========================================================================== @@ -329,7 +329,7 @@ void R_MapPlane (int y, int x1) void R_MapTiltedPlane (int y, int x1) { - R_DrawTiltedSpan(y, x1, spanend[y], plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy); + R_Drawers()->DrawTiltedSpan(y, x1, spanend[y], plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy); } //========================================================================== @@ -340,14 +340,14 @@ void R_MapTiltedPlane (int y, int x1) void R_MapColoredPlane(int y, int x1) { - R_DrawColoredSpan(y, x1, spanend[y]); + R_Drawers()->DrawColoredSpan(y, x1, spanend[y]); } void R_DrawFogBoundarySection(int y, int y2, int x1) { for (; y < y2; ++y) { - R_DrawFogBoundaryLine(y, x1, spanend[y]); + R_Drawers()->DrawFogBoundaryLine(y, x1, spanend[y]); } } @@ -411,13 +411,13 @@ void R_DrawFogBoundary(int x1, int x2, short *uclip, short *dclip) while (t2 < stop) { int y = t2++; - R_DrawFogBoundaryLine(y, xr, spanend[y]); + R_Drawers()->DrawFogBoundaryLine(y, xr, spanend[y]); } stop = MAX(b1, t2); while (b2 > stop) { int y = --b2; - R_DrawFogBoundaryLine(y, xr, spanend[y]); + R_Drawers()->DrawFogBoundaryLine(y, xr, spanend[y]); } } else @@ -1038,9 +1038,9 @@ static void R_DrawSkyColumnStripe(int start_x, int y1, int y2, int columns, doub uint32_t solid_bottom = frontskytex->GetSkyCapColor(true); if (!backskytex) - R_DrawSingleSkyColumn(solid_top, solid_bottom); + R_Drawers()->DrawSingleSkyColumn(solid_top, solid_bottom); else - R_DrawDoubleSkyColumn(solid_top, solid_bottom); + R_Drawers()->DrawDoubleSkyColumn(solid_top, solid_bottom); } static void R_DrawSkyColumn(int start_x, int y1, int y2, int columns) @@ -1745,7 +1745,7 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t plane_shade = true; } - if (spanfunc != R_FillSpan) + if (spanfunc != &SWPixelFormatDrawers::FillSpan) { if (masked) { @@ -1753,7 +1753,7 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t { if (!additive) { - spanfunc = R_DrawSpanMaskedTranslucent; + spanfunc = &SWPixelFormatDrawers::DrawSpanMaskedTranslucent; dc_srcblend = Col2RGB8[alpha>>10]; dc_destblend = Col2RGB8[(OPAQUE-alpha)>>10]; dc_srcalpha = alpha; @@ -1761,7 +1761,7 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t } else { - spanfunc = R_DrawSpanMaskedAddClamp; + spanfunc = &SWPixelFormatDrawers::DrawSpanMaskedAddClamp; dc_srcblend = Col2RGB8_LessPrecision[alpha>>10]; dc_destblend = Col2RGB8_LessPrecision[FRACUNIT>>10]; dc_srcalpha = alpha; @@ -1770,7 +1770,7 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t } else { - spanfunc = R_DrawSpanMasked; + spanfunc = &SWPixelFormatDrawers::DrawSpanMasked; } } else @@ -1779,7 +1779,7 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t { if (!additive) { - spanfunc = R_DrawSpanTranslucent; + spanfunc = &SWPixelFormatDrawers::DrawSpanTranslucent; dc_srcblend = Col2RGB8[alpha>>10]; dc_destblend = Col2RGB8[(OPAQUE-alpha)>>10]; dc_srcalpha = alpha; @@ -1787,7 +1787,7 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t } else { - spanfunc = R_DrawSpanAddClamp; + spanfunc = &SWPixelFormatDrawers::DrawSpanAddClamp; dc_srcblend = Col2RGB8_LessPrecision[alpha>>10]; dc_destblend = Col2RGB8_LessPrecision[FRACUNIT>>10]; dc_srcalpha = alpha; @@ -1796,7 +1796,7 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t } else { - spanfunc = R_DrawSpan; + spanfunc = &SWPixelFormatDrawers::DrawSpan; } } } diff --git a/src/swrenderer/scene/r_things.cpp b/src/swrenderer/scene/r_things.cpp index f0365819e..419499d4c 100644 --- a/src/swrenderer/scene/r_things.cpp +++ b/src/swrenderer/scene/r_things.cpp @@ -368,7 +368,7 @@ void R_DrawMaskedColumnBgra(FTexture *tex, fixed_t col, bool unmasked) double v = ((dc_yl + 0.5 - sprtopscreen) / spryscale) / tex->GetHeight(); dc_texturefrac = (uint32_t)(v * (1 << 30)); - colfunc(); + (R_Drawers()->*colfunc)(); } span++; } @@ -443,7 +443,7 @@ void R_DrawMaskedColumn (FTexture *tex, fixed_t col, bool unmasked) else if (dc_iscale < 0) dc_count = MIN(dc_count, (dc_texturefrac - dc_iscale) / (-dc_iscale)); - colfunc (); + (R_Drawers()->*colfunc)(); } span++; } diff --git a/src/swrenderer/scene/r_voxel.cpp b/src/swrenderer/scene/r_voxel.cpp index 464598242..22773499d 100644 --- a/src/swrenderer/scene/r_voxel.cpp +++ b/src/swrenderer/scene/r_voxel.cpp @@ -209,7 +209,7 @@ namespace swrenderer dc_dest = dc_destorg + (dc_pitch * columnY1 + x) * pixelsize; dc_color = color; dc_count = columnY2 - columnY1; - R_FillColumn(); + R_Drawers()->FillColumn(); } } } diff --git a/src/swrenderer/scene/r_walldraw.cpp b/src/swrenderer/scene/r_walldraw.cpp index 74aafe11e..0ffb3632c 100644 --- a/src/swrenderer/scene/r_walldraw.cpp +++ b/src/swrenderer/scene/r_walldraw.cpp @@ -188,7 +188,7 @@ WallSampler::WallSampler(int y1, float swal, double yrepeat, fixed_t xoffset, do } // Draw a column with support for non-power-of-two ranges -static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, void(*draw1column)()) +static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, DrawerFunc draw1column) { if (r_dynlights) { @@ -265,7 +265,7 @@ static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, void(*draw1 dc_iscale = sampler.uv_step; dc_texturefrac = sampler.uv_pos; dc_textureheight = sampler.height; - draw1column(); + (R_Drawers()->*draw1column)(); uint64_t step64 = sampler.uv_step; uint64_t pos64 = sampler.uv_pos; @@ -284,7 +284,7 @@ static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, void(*draw1 dc_count = count; dc_iscale = sampler.uv_step; dc_texturefrac = sampler.uv_pos; - draw1column(); + (R_Drawers()->*draw1column)(); uint64_t step64 = sampler.uv_step; uint64_t pos64 = sampler.uv_pos; @@ -310,7 +310,7 @@ static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, void(*draw1 dc_count = count; dc_iscale = sampler.uv_step; dc_texturefrac = uv_pos; - draw1column(); + (R_Drawers()->*draw1column)(); left -= count; uv_pos += sampler.uv_step * count; @@ -323,11 +323,9 @@ static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, void(*draw1 } } -typedef void(*DrawColumnFuncPtr)(); - static void ProcessWallWorker( int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, - const BYTE *(*getcol)(FTexture *tex, int x), DrawColumnFuncPtr drawcolumn) + const BYTE *(*getcol)(FTexture *tex, int x), DrawerFunc drawcolumn) { if (rw_pic->UseType == FTexture::TEX_Null) return; @@ -388,7 +386,7 @@ static void ProcessWallWorker( static void ProcessNormalWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn) { - ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, R_DrawWallColumn); + ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, &SWPixelFormatDrawers::DrawWallColumn); } static void ProcessMaskedWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn) @@ -399,14 +397,14 @@ static void ProcessMaskedWall(int x1, int x2, short *uwal, short *dwal, float *s } else { - ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, R_DrawWallMaskedColumn); + ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, &SWPixelFormatDrawers::DrawWallMaskedColumn); } } static void ProcessTranslucentWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn) { - void(*drawcol1)(); - if (!R_GetTransMaskDrawers(&drawcol1)) + DrawerFunc drawcol1 = R_GetTransMaskDrawer(); + if (drawcol1 == nullptr) { // The current translucency is unsupported, so draw with regular ProcessMaskedWall instead. ProcessMaskedWall(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol); diff --git a/src/v_draw.cpp b/src/v_draw.cpp index 31081a210..bd40c80ed 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -1481,7 +1481,7 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints, ds_xfrac = xs_RoundToInt(tex.X * scalex); ds_yfrac = xs_RoundToInt(tex.Y * scaley); - R_DrawSpan(); + R_Drawers()->DrawSpan(); #endif } x += xinc;