Add debugfinishline, highlight finish line linedefs and black fill solid walls

- Highlight is drawn across the screen at the horizon
  (player's eye level).
- Highlight alternates between red and white for 35 tics
  each.
This commit is contained in:
James R 2023-03-19 20:45:04 -07:00 committed by NepDisk
parent c68b60a67a
commit 92ca47e9c5
6 changed files with 76 additions and 11 deletions

View file

@ -393,6 +393,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back)
{
return (
!R_IsDebugLine(line) &&
!line->polyseg &&
back->ceilingpic == front->ceilingpic
&& back->floorpic == front->floorpic
@ -420,6 +421,19 @@ boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back)
|| Tag_Compare(&front->tags, &back->tags)));
}
boolean R_IsDebugLine(seg_t *line)
{
if (line->linedef->special == 2001) // Ring Racers: Finish Line
{
if (cv_debugfinishline.value)
{
return true;
}
}
return false;
}
//
// R_AddLine
// Clips the given segment and adds any visible pieces to the line list.
@ -516,12 +530,28 @@ static void R_AddLine(seg_t *line)
if (!backsector)
goto clipsolid;
// Finish line debug: make solid walls pitch black. This
// contrasts areas that are impossible to traverse next to
// finish lines.
if (cv_debugfinishline.value && (line->linedef->flags & (ML_IMPASSABLE|ML_BLOCKPLAYERS)))
{
goto clipsolid;
}
backsector = R_FakeFlat(backsector, &tempsec, NULL, NULL, true);
doorclosed = 0;
if (udmf)
{
if (!R_IsDebugLine(line) &&
!line->polyseg &&
!line->sidedef->midtexture
&& ((!frontsector->ffloors && !backsector->ffloors)
|| Tag_Compare(&frontsector->tags, &backsector->tags)))
return; // line is empty, don't even bother
if (backsector->ceilingpic == skyflatnum && frontsector->ceilingpic == skyflatnum)
bothceilingssky = true;
if (backsector->floorpic == skyflatnum && frontsector->floorpic == skyflatnum)

View file

@ -62,6 +62,7 @@ extern polyobj_t **po_ptrs; // temp ptr array to sort polyobject pointers
sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
INT32 *ceilinglightlevel, boolean back);
boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back);
boolean R_IsDebugLine(seg_t *line);
INT32 R_GetPlaneLight(sector_t *sector, fixed_t planeheight, boolean underside);
void R_Prep3DFloors(sector_t *sector);

View file

@ -185,6 +185,8 @@ consvar_t cv_maxportals = CVAR_INIT ("maxportals", "2", CV_SAVE, maxportals_cons
consvar_t cv_renderstats = CVAR_INIT ("renderstats", "Off", 0, CV_OnOff, NULL);
consvar_t cv_debugfinishline = CVAR_INIT ("debugfinishline", "Off", CV_CHEAT, CV_OnOff, NULL);
void SplitScreen_OnChange(void)
{
UINT8 i;
@ -1744,6 +1746,8 @@ void R_RegisterEngineStuff(void)
//CV_RegisterVar(&cv_drawpickups);
CV_RegisterVar(&cv_debugfinishline);
// debugging
CV_RegisterVar(&cv_debugrender_contrast);

View file

@ -124,6 +124,7 @@ extern consvar_t cv_drawdist, cv_drawdist_precip;
extern consvar_t cv_fov[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_skybox;
extern consvar_t cv_tailspickup;
extern consvar_t cv_debugfinishline;
// debugging

View file

@ -188,6 +188,32 @@ static void R_RenderMaskedSegLoop(drawseg_t *ds, INT32 x1, INT32 x2, INT32 texnu
// OPTIMIZE: get rid of LIGHTSEGSHIFT globally
curline = ds->curline;
if (R_IsDebugLine(curline))
{
const UINT8 thickness = 4;
const UINT8 pal = (leveltime % 70 < 35) ? 0x23 : 0x00;
const INT32 horizon = ((centeryfrac>>4) + 1 + HEIGHTUNIT - 1) >> HEIGHTBITS;
const INT32 y = std::max(0, std::min(horizon, vid.height - thickness));
UINT8 *p = &topleft[x1 + (y * vid.width)];
range = std::max(x2 - x1, 0) + 1;
for (i = 0; i < thickness; ++i)
{
memset(p, pal, range);
p += vid.width;
}
return;
}
if (ds->maskedtexturecol == NULL)
{
return;
}
frontsector = curline->frontsector;
backsector = curline->backsector;
texnum = R_GetTextureNum(curline->sidedef->midtexture);
@ -212,8 +238,6 @@ static void R_RenderMaskedSegLoop(drawseg_t *ds, INT32 x1, INT32 x2, INT32 texnu
transtable = static_cast<transnum_t>(0);
}
R_CheckDebugHighlight(SW_HI_MIDTEXTURES);
if (blendmode == AST_FOG)
{
R_SetColumnFunc(COLDRAWFUNC_FOG, bmnum != 0);
@ -626,7 +650,7 @@ static INT32 R_GetTwoSidedMidTexture(seg_t *line)
return R_GetTextureNum(texture);
}
/*static boolean R_CheckBlendMode(const line_t *ldef, boolean brightmapped)
static boolean R_CheckBlendMode(const line_t *ldef, boolean brightmapped)
{
transnum_t transtable = NUMTRANSMAPS;
patchalphastyle_t blendmode = AST_COPY;
@ -671,13 +695,14 @@ static INT32 R_GetTwoSidedMidTexture(seg_t *line)
}
return true;
}*/
}
void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
{
INT32 texnum;
void (*colfunc_2s)(column_t *, column_t *, INT32);
//line_t *ldef;
line_t *ldef;
const boolean debug = R_IsDebugLine(ds->curline);
// Calculate light table.
// Use different light tables
// for horizontal / vertical / diagonal. Diagonal?
@ -689,7 +714,14 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
texnum = R_GetTwoSidedMidTexture(curline);
windowbottom = windowtop = sprbotscreen = INT32_MAX;
//ldef = curline->linedef;
ldef = curline->linedef;
R_CheckDebugHighlight(SW_HI_MIDTEXTURES);
if (debug == false && R_CheckBlendMode(ldef, R_TextureHasBrightmap(texnum)) == false)
{
return; // does not render
}
rw_scalestep = ds->scalestep;
spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep;
@ -1320,8 +1352,6 @@ static boolean R_FFloorCanClip(visffloor_t *pfloor)
// textures.
// CALLED: CORE LOOPING ROUTINE.
//
#define HEIGHTBITS 12
#define HEIGHTUNIT (1<<HEIGHTBITS)
//profile stuff ---------------------------------------------------------

View file

@ -2940,7 +2940,7 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps
}
ds->curline->polyseg->visplane = NULL;
}
if (ds->maskedtexturecol)
if (ds->maskedtexturecol || R_IsDebugLine(ds->curline))
{
entry = R_CreateDrawNode(head);
entry->seg = ds;
@ -3710,11 +3710,10 @@ static void R_DrawMaskedList (drawnode_t* head)
R_DoneWithNode(r2);
r2 = next;
}
else if (r2->seg && r2->seg->maskedtexturecol != NULL)
else if (r2->seg)
{
next = r2->prev;
R_RenderMaskedSegRange(r2->seg, r2->seg->x1, r2->seg->x2);
r2->seg->maskedtexturecol = NULL;
R_DoneWithNode(r2);
r2 = next;
}