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
parent 06fa67d9c5
commit b7ef8275c4
6 changed files with 62 additions and 6 deletions

View file

@ -395,6 +395,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
@ -422,6 +423,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.
@ -518,6 +532,14 @@ 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;
@ -529,7 +551,8 @@ static void R_AddLine(seg_t *line)
if (bothceilingssky && bothfloorssky) // everything's sky? let's save us a bit of time then
{
if (!line->polyseg &&
if (!R_IsDebugLine(line) &&
!line->polyseg &&
!line->sidedef->midtexture
&& ((!frontsector->ffloors && !backsector->ffloors)
|| Tag_Compare(&frontsector->tags, &backsector->tags)))

View file

@ -59,6 +59,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

@ -182,6 +182,8 @@ consvar_t cv_renderstats = CVAR_INIT ("renderstats", "Off", 0, CV_OnOff, NULL);
consvar_t cv_drawpickups = CVAR_INIT ("drawpickups", "Yes", CV_CHEAT, CV_YesNo, NULL);
consvar_t cv_debugfinishline = CVAR_INIT ("debugfinishline", "Off", CV_CHEAT, CV_OnOff, NULL);
void SplitScreen_OnChange(void)
{
UINT8 i;
@ -1676,6 +1678,8 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_drawpickups);
CV_RegisterVar(&cv_debugfinishline);
// debugging
CV_RegisterVar(&cv_debugrender_contrast);

View file

@ -122,6 +122,7 @@ extern consvar_t cv_fov[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_skybox;
extern consvar_t cv_tailspickup;
extern consvar_t cv_drawpickups;
extern consvar_t cv_debugfinishline;
// debugging

View file

@ -26,6 +26,10 @@
#include "p_slopes.h"
#include "console.h" // con_clipviewtop
#include "taglist.h"
#include "r_draw.h"
#define HEIGHTBITS 12
#define HEIGHTUNIT (1<<HEIGHTBITS)
// OPTIMIZE: closed two sided lines as single sided
@ -169,6 +173,32 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
// 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 = max(0, min(horizon, vid.height - thickness));
UINT8 *p = &topleft[x1 + (y * vid.width)];
range = 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);
@ -1161,8 +1191,6 @@ static boolean R_FFloorCanClip(visffloor_t *pfloor)
// textures.
// CALLED: CORE LOOPING ROUTINE.
//
#define HEIGHTBITS 12
#define HEIGHTUNIT (1<<HEIGHTBITS)
//profile stuff ---------------------------------------------------------

View file

@ -2899,7 +2899,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;
@ -3698,11 +3698,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;
}