From 179608829bce23c1e3b71890fd6c6a0ea5b176f0 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 6 Mar 2023 05:10:58 -0800 Subject: [PATCH] Add the debugrender_highlight command, highlight specific rendering in flat colors Software mode only. The command is used like this: debugrender_highlight planes sprites debugrender_highlight pl spr debugrender_highlight none (Abbreviations work.) Supported rendering to flag: planes - sector floor/ceiling fofplanes - FOF top/bottom fofsides - FOF sides midtextures - pegged midtexture walls - sector upper/lower texture, one-sided linedefs sprites - sprites sky - skybox --- src/Sourcefile | 1 + src/r_debug.cpp | 62 ++++++++++++++++++++++++++- src/r_debug_detail.hpp | 42 +++++++++++++++++++ src/r_debug_parser.cpp | 95 ++++++++++++++++++++++++++++++++++++++++++ src/r_draw.c | 4 ++ src/r_draw.h | 9 ++++ src/r_draw8_flat.c | 79 +++++++++++++++++++++++++++++++++++ src/r_main.c | 2 + src/r_main.h | 17 ++++++++ src/r_plane.cpp | 31 ++++++++++---- src/r_segs.cpp | 19 ++++++--- src/r_things.c | 6 +++ src/screen.c | 31 ++++++++++++-- src/screen.h | 1 + 14 files changed, 381 insertions(+), 18 deletions(-) create mode 100644 src/r_debug_detail.hpp create mode 100644 src/r_debug_parser.cpp create mode 100644 src/r_draw8_flat.c diff --git a/src/Sourcefile b/src/Sourcefile index d22d5a631..21ab8e33d 100644 --- a/src/Sourcefile +++ b/src/Sourcefile @@ -78,6 +78,7 @@ r_picformats.c r_portal.c r_bbox.c r_debug.cpp +r_debug_parser.cpp screen.c taglist.c v_video.c diff --git a/src/r_debug.cpp b/src/r_debug.cpp index d090d230e..e12eb33b1 100644 --- a/src/r_debug.cpp +++ b/src/r_debug.cpp @@ -12,11 +12,15 @@ #include // std::clamp #include "cxxutil.hpp" +#include "r_debug_detail.hpp" #include "command.h" #include "m_fixed.h" +#include "r_draw.h" #include "r_main.h" +using namespace srb2::r_debug; + namespace { @@ -27,12 +31,68 @@ CV_PossibleValue_t contrast_cons_t[] = {{-FRACUNIT, "MIN"}, {FRACUNIT, "MAX"}, { consvar_t cv_debugrender_contrast = CVAR_INIT("debugrender_contrast", "0.0", CV_CHEAT | CV_FLOAT, contrast_cons_t, nullptr); +UINT32 debugrender_highlight; + +void R_CheckDebugHighlight(debugrender_highlight_t k) +{ + // If highlighting is enabled for anything, surfaces + // must be highlighted in one of two colors, depending on + // whether they fall under focus of the debug. + + if (debugrender_highlight) + { + r8_flatcolor = (debugrender_highlight & (1 << k)) ? detail::kHighlightOptions[k].color : 0x1F; + } +} + INT32 R_AdjustLightLevel(INT32 light) { constexpr fixed_t kRange = (LIGHTLEVELS - 1) * FRACUNIT; const fixed_t adjust = FixedMul(cv_debugrender_contrast.value, kRange); - light = std::clamp((light * FRACUNIT) - adjust, 0, kRange); + if (debugrender_highlight) + { + light = (kRange / 2) - (adjust / 2); + + SRB2_ASSERT(light >= 0); + SRB2_ASSERT(light <= kRange); + } + else + { + light = std::clamp((light * FRACUNIT) - adjust, 0, kRange); + } return light / FRACUNIT; } + +void Command_Debugrender_highlight(void) +{ + const bool changes = COM_Argc() > 1; + + if (!CV_CheatsEnabled()) + { + CONS_Printf("Cheats must be enabled.\n"); + return; + } + + if (changes) + { + const char* arg = COM_Argv(1); + + debugrender_highlight = 0; // always reset + + if (COM_Argc() > 2 || + // approximate match "none" + strncasecmp(arg, "none", strlen(arg))) + { + char* p = COM_Args(); + + while (p) + { + p = detail::parse_highlight_arg(p); + } + } + } + + detail::highlight_help(changes); +} diff --git a/src/r_debug_detail.hpp b/src/r_debug_detail.hpp new file mode 100644 index 000000000..7d495db47 --- /dev/null +++ b/src/r_debug_detail.hpp @@ -0,0 +1,42 @@ +// RING RACERS +//----------------------------------------------------------------------------- +// Copyright (C) 2023 by James Robert Roman. +// +// This program is free software distributed under the +// terms of the GNU General Public License, version 2. +// See the 'LICENSE' file for more details. +//----------------------------------------------------------------------------- +/// \file r_debug_detail.cpp +/// \brief Software renderer debugging, internal header + +#ifndef __R_DEBUG_DETAIL__ +#define __R_DEBUG_DETAIL__ + +#include "r_main.h" + +namespace srb2::r_debug::detail +{ + +struct HighlightDesc +{ + uint8_t color; + const char* label; + const char* description; +}; + +constexpr HighlightDesc kHighlightOptions[NUM_SW_HI] = { + {0x96, "planes", "Sector floor/ceiling"}, + {0x49, "fofplanes", "FOF top/bottom"}, + {0xB6, "fofsides", "FOF sides"}, + {0x7A, "midtextures", "Two-sided midtexture"}, + {0xC9, "walls", "Sector upper/lower texture, one-sided midtexture"}, + {0x23, "sprites", "Sprites"}, + {0x0F, "sky", "Sky texture"}}; + +char* skip_alnum(char* p, int mode); +char* parse_highlight_arg(char* p); +void highlight_help(bool only_on); + +}; // srb2::r_debug::detail + +#endif // __R_DEBUG_DETAIL__ diff --git a/src/r_debug_parser.cpp b/src/r_debug_parser.cpp new file mode 100644 index 000000000..8d1d30080 --- /dev/null +++ b/src/r_debug_parser.cpp @@ -0,0 +1,95 @@ +// RING RACERS +//----------------------------------------------------------------------------- +// Copyright (C) 2023 by James Robert Roman. +// +// This program is free software distributed under the +// terms of the GNU General Public License, version 2. +// See the 'LICENSE' file for more details. +//----------------------------------------------------------------------------- +/// \file r_debug_parser.cpp +/// \brief Helper functions for the debugrender_highlight command + +#include "r_debug_detail.hpp" + +#include "doomdef.h" +#include "r_main.h" + +using namespace srb2::r_debug; +using namespace srb2::r_debug::detail; + +char* detail::skip_alnum(char* p, int mode) +{ + while (*p != '\0' && !isalnum(*p) == !mode) + { + p++; + } + + return p; +} + +char* detail::parse_highlight_arg(char* p) +{ + INT32 k; + const HighlightDesc* key; + + const auto old = static_cast(debugrender_highlight); + + char* t; + int c; + + p = skip_alnum(p, 0); // skip "whitespace" + + if (*p == '\0') + { + return NULL; + } + + t = skip_alnum(p, 1); // find end of word + + c = *t; // save to restore afterward + *t = '\0'; // isolate word string + + for (k = 0; (key = &kHighlightOptions[k]), k < NUM_SW_HI; ++k) + { + // allow an approximate match + if (!strncasecmp(p, key->label, (t - p))) + { + debugrender_highlight |= (1 << k); + // keep going to match multiple with same + // prefix + } + } + + if (debugrender_highlight == old) + { + // no change? Foolish user + CONS_Alert(CONS_WARNING, "\"%s\" makes no sense\n", p); + } + + *t = c; // restore + + return t; // skip to end of word +} + +void detail::highlight_help(bool only_on) +{ + int32_t k; + const HighlightDesc* key; + + for (k = 0; (key = &kHighlightOptions[k]), k < NUM_SW_HI; ++k) + { + const bool on = (debugrender_highlight & (1 << k)) != 0; + + if (!only_on || on) + { + CONS_Printf("%s\x80 \x87%s\x80 - %s\n", on ? "\x83 ON" : "\x85OFF", key->label, key->description); + } + } + + if (!only_on) + { + CONS_Printf("\nYou can change the highlights by using a command like:\n\n" + "\x87 debugrender_highlight planes sprites\n" + "\x87 debugrender_highlight none\n"); + } +} diff --git a/src/r_draw.c b/src/r_draw.c index 0d30deb13..63af42fa9 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -68,6 +68,8 @@ INT32 columnofs[MAXVIDWIDTH*4]; UINT8 *topleft; +UINT8 r8_flatcolor; + // ========================================================================= // COLUMN DRAWING CODE STUFF // ========================================================================= @@ -81,6 +83,7 @@ UINT8 dc_hires; // under MSVC boolean is a byte, while on other systems, it a bi // soo lets make it a byte on all system for the ASM code UINT8 *dc_source; UINT8 *dc_brightmap; +UINT8 *dc_lightmap; // ----------------------- // translucency stuff here @@ -633,6 +636,7 @@ void R_DrawViewBorder(void) #include "r_draw8.c" #include "r_draw8_npo2.c" +#include "r_draw8_flat.c" // ========================================================================== // INCLUDE 16bpp DRAWING CODE HERE diff --git a/src/r_draw.h b/src/r_draw.h index 3c9e5205c..4936674e6 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -30,6 +30,7 @@ extern UINT8 *ylookup3[MAXVIDHEIGHT*4]; extern UINT8 *ylookup4[MAXVIDHEIGHT*4]; extern INT32 columnofs[MAXVIDWIDTH*4]; extern UINT8 *topleft; +extern UINT8 r8_flatcolor; // ------------------------- // COLUMN DRAWING CODE STUFF @@ -43,6 +44,7 @@ extern UINT8 dc_hires; extern UINT8 *dc_source; // first pixel in a column extern UINT8 *dc_brightmap; // brightmap texture column, can be NULL +extern UINT8 *dc_lightmap; // lighting only // translucency stuff here extern UINT8 *dc_transmap; @@ -76,6 +78,8 @@ extern UINT8 *ds_source; extern UINT8 *ds_brightmap; extern UINT8 *ds_transmap; +extern UINT8 ds_flatcolor; + struct floatv3_t { float x, y, z; }; @@ -233,6 +237,11 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_8(void); void R_DrawTranslucentWaterSpan_NPO2_8(void); void R_DrawTiltedTranslucentWaterSpan_NPO2_8(void); +// Debugging - highlight surfaces in flat colors +void R_DrawColumn_Flat_8(void); +void R_DrawSpan_Flat_8(void); +void R_DrawTiltedSpan_Flat_8(void); + #ifdef USEASM void ASMCALL R_DrawColumn_8_ASM(void); void ASMCALL R_DrawShadeColumn_8_ASM(void); diff --git a/src/r_draw8_flat.c b/src/r_draw8_flat.c new file mode 100644 index 000000000..20372d2c4 --- /dev/null +++ b/src/r_draw8_flat.c @@ -0,0 +1,79 @@ +// SONIC ROBO BLAST 2 +//----------------------------------------------------------------------------- +// Copyright (C) 1998-2000 by DooM Legacy Team. +// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 2023 by Kart Krew. +// +// This program is free software distributed under the +// terms of the GNU General Public License, version 2. +// See the 'LICENSE' file for more details. +//----------------------------------------------------------------------------- +/// \file r_draw8_flat.c +/// \brief 8bpp span/column drawer functions for debugging (draws in flat colors only) +/// \note no includes because this is included as part of r_draw.c + +void R_DrawColumn_Flat_8 (void) +{ + INT32 count; + UINT8 color = dc_lightmap[r8_flatcolor]; + register UINT8 *dest; + + count = dc_yh - dc_yl; + + if (count < 0) // Zero length, column does not exceed a pixel. + return; + +#ifdef RANGECHECK + if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height) + return; +#endif + + // Framebuffer destination address. + // Use ylookup LUT to avoid multiply with ScreenWidth. + // Use columnofs LUT for subwindows? + + //dest = ylookup[dc_yl] + columnofs[dc_x]; + dest = &topleft[dc_yl*vid.width + dc_x]; + + count++; + + do + { + *dest = color; + dest += vid.width; + } while (--count); +} + +void R_DrawSpan_Flat_8 (void) +{ + UINT8 *dest = ylookup[ds_y] + columnofs[ds_x1]; + + memset(dest, ds_colormap[r8_flatcolor], (ds_x2 - ds_x1) + 1); +} + +void R_DrawTiltedSpan_Flat_8 (void) +{ + // x1, x2 = ds_x1, ds_x2 + int width = ds_x2 - ds_x1; + double iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx); + + UINT8 *dest = ylookup[ds_y]; + + // Lighting is simple. It's just linear interpolation from start to end + { + float planelightfloat = PLANELIGHTFLOAT; + float lightstart, lightend; + + lightend = (iz + ds_szp->x*width) * planelightfloat; + lightstart = iz * planelightfloat; + + R_CalcTiltedLighting(FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend)); + //CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf); + } + + while (ds_x1 <= ds_x2) + { + dest[ds_x1] = planezlight[tiltlighting[ds_x1]][r8_flatcolor]; + ds_x1++; + } +} diff --git a/src/r_main.c b/src/r_main.c index 34f42c47d..080a1e604 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1667,4 +1667,6 @@ void R_RegisterEngineStuff(void) // debugging CV_RegisterVar(&cv_debugrender_contrast); + + COM_AddCommand("debugrender_highlight", Command_Debugrender_highlight); } diff --git a/src/r_main.h b/src/r_main.h index ba2a0418e..ab5319cc5 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -127,8 +127,25 @@ extern consvar_t cv_tailspickup; // debugging +typedef enum { + SW_HI_PLANES, + SW_HI_FOFPLANES, + SW_HI_FOFSIDES, + SW_HI_MIDTEXTURES, + SW_HI_WALLS, + SW_HI_THINGS, + SW_HI_SKY, + + NUM_SW_HI +} debugrender_highlight_t; + +extern UINT32 debugrender_highlight; + +void R_CheckDebugHighlight(debugrender_highlight_t type); INT32 R_AdjustLightLevel(INT32 light); +void Command_Debugrender_highlight(void); + extern consvar_t cv_debugrender_contrast; diff --git a/src/r_plane.cpp b/src/r_plane.cpp index a0cad8265..d2b36bed7 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -215,14 +215,17 @@ static void R_MapPlane(INT32 y, INT32 x1, INT32 x2) pindex = MAXLIGHTZ - 1; ds_colormap = planezlight[pindex]; - if (currentplane->extra_colormap) - ds_colormap = currentplane->extra_colormap->colormap + (ds_colormap - colormaps); - - ds_fullbright = colormaps; - if (encoremap && !currentplane->noencore) + if (!debugrender_highlight) { - ds_colormap += COLORMAP_REMAPOFFSET; - ds_fullbright += COLORMAP_REMAPOFFSET; + if (currentplane->extra_colormap) + ds_colormap = currentplane->extra_colormap->colormap + (ds_colormap - colormaps); + + ds_fullbright = colormaps; + if (encoremap && !currentplane->noencore) + { + ds_colormap += COLORMAP_REMAPOFFSET; + ds_fullbright += COLORMAP_REMAPOFFSET; + } } ds_y = y; @@ -631,6 +634,8 @@ static void R_DrawSkyPlane(visplane_t *pl) INT32 x; INT32 angle; + R_CheckDebugHighlight(SW_HI_SKY); + // Reset column drawer function (note: couldn't we just call walldrawerfunc directly?) // (that is, unless we'll need to switch drawers in future for some reason) R_SetColumnFunc(BASEDRAWFUNC, false); @@ -649,6 +654,7 @@ static void R_DrawSkyPlane(visplane_t *pl) dc_colormap += COLORMAP_REMAPOFFSET; dc_fullbright += COLORMAP_REMAPOFFSET; } + dc_lightmap = colormaps; dc_texturemid = skytexturemid; dc_texheight = textureheight[skytexture] >>FRACBITS; @@ -849,7 +855,8 @@ void R_DrawSinglePlane(visplane_t *pl) INT32 x, stop; ffloor_t *rover; INT32 type, spanfunctype = BASEDRAWFUNC; - //debugrender_highlight_t debug = debugrender_highlight_t::SW_HI_PLANES; + debugrender_highlight_t debug = debugrender_highlight_t::SW_HI_PLANES; + void (*mapfunc)(INT32, INT32, INT32) = R_MapPlane; if (!(pl->minx <= pl->maxx)) @@ -930,10 +937,16 @@ void R_DrawSinglePlane(visplane_t *pl) light = (pl->lightlevel >> LIGHTSEGSHIFT); } else light = (pl->lightlevel >> LIGHTSEGSHIFT); + + debug = SW_HI_FOFPLANES; } else + { light = (pl->lightlevel >> LIGHTSEGSHIFT); + debug = SW_HI_PLANES; + } + #ifndef NOWATER if (pl->ripple) { @@ -1107,6 +1120,8 @@ void R_DrawSinglePlane(visplane_t *pl) } + R_CheckDebugHighlight(debug); + // Use the correct span drawer depending on the powers-of-twoness R_SetSpanFunc(spanfunctype, !ds_powersoftwo, ds_brightmap != NULL); diff --git a/src/r_segs.cpp b/src/r_segs.cpp index cebbc6b54..79b4ef873 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -212,6 +212,8 @@ static void R_RenderMaskedSegLoop(drawseg_t *ds, INT32 x1, INT32 x2, INT32 texnu transtable = static_cast(0); } + R_CheckDebugHighlight(SW_HI_MIDTEXTURES); + if (blendmode == AST_FOG) { R_SetColumnFunc(COLDRAWFUNC_FOG, bmnum != 0); @@ -484,7 +486,7 @@ static void R_RenderMaskedSegLoop(drawseg_t *ds, INT32 x1, INT32 x2, INT32 texnu if (height <= windowtop) { dc_colormap = rlight->rcolormap; - //dc->lightmap = xwalllights[pindex]; + dc_lightmap = xwalllights[pindex]; dc_fullbright = colormaps; if (remap && !(ldef->flags & ML_TFERLINE)) { @@ -510,7 +512,7 @@ static void R_RenderMaskedSegLoop(drawseg_t *ds, INT32 x1, INT32 x2, INT32 texnu colfunc_2s(col, bmCol, -1); windowtop = windowbottom + 1; dc_colormap = rlight->rcolormap; - //dc->lightmap = xwalllights[pindex]; + dc_lightmap = xwalllights[pindex]; dc_fullbright = colormaps; if (remap && !(ldef->flags & ML_TFERLINE)) { @@ -533,7 +535,7 @@ static void R_RenderMaskedSegLoop(drawseg_t *ds, INT32 x1, INT32 x2, INT32 texnu pindex = MAXLIGHTSCALE - 1; dc_colormap = walllights[pindex]; - //dc->lightmap = walllights[pindex]; + dc_lightmap = walllights[pindex]; dc_fullbright = colormaps; if (remap && !(ldef->flags & ML_TFERLINE)) { @@ -802,6 +804,8 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) frontsector = curline->frontsector == pfloor->target ? curline->backsector : curline->frontsector; texnum = R_GetTextureNum(sides[pfloor->master->sidenum[0]].midtexture); + R_CheckDebugHighlight(SW_HI_FOFSIDES); + if (pfloor->master->flags & ML_TFERLINE) { size_t linenum = std::min(curline->linedef-backsector->lines[0], (long int)pfloor->master->frontsector->linecount); @@ -1200,7 +1204,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) if (lighteffect) { dc_colormap = rlight->rcolormap; - //dc->lightmap = xwalllights[pindex]; + dc_lightmap = xwalllights[pindex]; dc_fullbright = colormaps; if (remap && !(curline->linedef->flags & ML_TFERLINE)) { @@ -1237,7 +1241,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) if (lighteffect) { dc_colormap = rlight->rcolormap; - //dc->lightmap = xwalllights[pindex]; + dc_lightmap = xwalllights[pindex]; dc_fullbright = colormaps; if (remap && !(curline->linedef->flags & ML_TFERLINE)) { @@ -1262,6 +1266,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) pindex = MAXLIGHTSCALE - 1; dc_colormap = walllights[pindex]; + dc_lightmap = walllights[pindex]; dc_fullbright = colormaps; if (remap && !(curline->linedef->flags & ML_TFERLINE)) @@ -1545,7 +1550,7 @@ static void R_RenderSegLoop (void) pindex = MAXLIGHTSCALE-1; dc_colormap = walllights[pindex]; - //dc->lightmap = walllights[pindex]; + dc_lightmap = walllights[pindex]; dc_fullbright = colormaps; dc_x = rw_x; dc_iscale = 0xffffffffu / (unsigned)rw_scale; @@ -1786,6 +1791,8 @@ void R_StoreWallRange(INT32 start, INT32 stop) memset(&segleft, 0x00, sizeof(segleft)); memset(&segright, 0x00, sizeof(segright)); + R_CheckDebugHighlight(SW_HI_WALLS); + R_SetColumnFunc(BASEDRAWFUNC, false); if (ds_p == drawsegs+maxdrawsegs) diff --git a/src/r_things.c b/src/r_things.c index b6004ed02..7941d8359 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -934,6 +934,8 @@ static void R_DrawVisSprite(vissprite_t *vis) if (!dc_colormap) dc_colormap = colormaps; + dc_lightmap = colormaps; + dc_fullbright = colormaps; if (encoremap && !vis->mobj->color && !(vis->mobj->flags & MF_DONTENCOREMAP)) @@ -1126,6 +1128,8 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis) dc_fullbright += COLORMAP_REMAPOFFSET; } + dc_lightmap = colormaps; + dc_iscale = FixedDiv(FRACUNIT, vis->scale); dc_texturemid = FixedDiv(vis->texturemid, this_scale); dc_texheight = 0; @@ -3251,6 +3255,8 @@ static void R_DrawSprite(vissprite_t *spr) mfloorclip = spr->clipbot; mceilingclip = spr->cliptop; + R_CheckDebugHighlight(SW_HI_THINGS); + if (spr->cut & SC_BBOX) R_DrawThingBoundingBox(spr); else if (spr->cut & SC_SPLAT) diff --git a/src/screen.c b/src/screen.c index 4441e1067..21a6ad00e 100644 --- a/src/screen.c +++ b/src/screen.c @@ -65,6 +65,7 @@ void (*spanfuncs_npo2[SPANDRAWFUNC_MAX])(void); #ifdef USE_COL_SPAN_ASM void (*spanfuncs_asm[SPANDRAWFUNC_MAX])(void); #endif +void (*spanfuncs_flat[SPANDRAWFUNC_MAX])(void); // ------------------ // global video state @@ -171,6 +172,22 @@ void SCR_SetDrawFuncs(void) spanfuncs_npo2[SPANDRAWFUNC_TILTEDWATER] = R_DrawTiltedTranslucentWaterSpan_NPO2_8; spanfuncs_npo2[SPANDRAWFUNC_FOG] = NULL; // Not needed + // Debugging - highlight surfaces in flat colors + spanfuncs_flat[BASEDRAWFUNC] = R_DrawSpan_Flat_8; + spanfuncs_flat[SPANDRAWFUNC_TRANS] = R_DrawSpan_Flat_8; + spanfuncs_flat[SPANDRAWFUNC_TILTED] = R_DrawTiltedSpan_Flat_8; + spanfuncs_flat[SPANDRAWFUNC_TILTEDTRANS] = R_DrawTiltedSpan_Flat_8; + spanfuncs_flat[SPANDRAWFUNC_SPLAT] = R_DrawSpan_Flat_8; + spanfuncs_flat[SPANDRAWFUNC_TRANSSPLAT] = R_DrawSpan_Flat_8; + spanfuncs_flat[SPANDRAWFUNC_TILTEDSPLAT] = R_DrawTiltedSpan_Flat_8; + spanfuncs_flat[SPANDRAWFUNC_SPRITE] = R_DrawSpan_Flat_8; + spanfuncs_flat[SPANDRAWFUNC_TRANSSPRITE] = R_DrawSpan_Flat_8; + spanfuncs_flat[SPANDRAWFUNC_TILTEDSPRITE] = R_DrawTiltedSpan_Flat_8; + spanfuncs_flat[SPANDRAWFUNC_TILTEDTRANSSPRITE] = R_DrawTiltedSpan_Flat_8; + spanfuncs_flat[SPANDRAWFUNC_WATER] = R_DrawSpan_Flat_8; + spanfuncs_flat[SPANDRAWFUNC_TILTEDWATER] = R_DrawTiltedSpan_Flat_8; + spanfuncs_flat[SPANDRAWFUNC_FOG] = R_DrawSpan_Flat_8; // Not needed + #if (defined(RUSEASM) && defined(USE_COL_SPAN_ASM)) if (R_ASM) { @@ -221,13 +238,17 @@ void R_SetColumnFunc(size_t id, boolean brightmapped) colfunctype = id; + if (debugrender_highlight != 0) + { + colfunc = R_DrawColumn_Flat_8; + } #ifdef USE_COL_SPAN_ASM - if (colfuncs_asm[id] != NULL && brightmapped == false) + else if (colfuncs_asm[id] != NULL && brightmapped == false) { colfunc = colfuncs_asm[id]; } - else #endif + else { colfunc = colfuncs[id]; } @@ -237,7 +258,11 @@ void R_SetSpanFunc(size_t id, boolean npo2, boolean brightmapped) { I_Assert(id < COLDRAWFUNC_MAX); - if (spanfuncs_npo2[id] != NULL && npo2 == true) + if (spanfuncs_flat[id] != NULL && debugrender_highlight != 0) + { + spanfunc = spanfuncs_flat[id]; + } + else if (spanfuncs_npo2[id] != NULL && npo2 == true) { spanfunc = spanfuncs_npo2[id]; } diff --git a/src/screen.h b/src/screen.h index 23498de59..70455885f 100644 --- a/src/screen.h +++ b/src/screen.h @@ -177,6 +177,7 @@ extern void (*spanfuncs_npo2[SPANDRAWFUNC_MAX])(void); #ifdef USE_COL_SPAN_ASM extern void (*spanfuncs_asm[SPANDRAWFUNC_MAX])(void); #endif +extern void (*spanfuncs_flat[SPANDRAWFUNC_MAX])(void); // ----- // CPUID