diff --git a/src/r_bsp.c b/src/r_bsp.c index d547d860a..e79a1cee3 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -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))) diff --git a/src/r_bsp.h b/src/r_bsp.h index 5a24ffe47..051253a5e 100644 --- a/src/r_bsp.h +++ b/src/r_bsp.h @@ -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); diff --git a/src/r_main.c b/src/r_main.c index dcb8e3316..9d001fc88 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -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); diff --git a/src/r_main.h b/src/r_main.h index 208d846a9..40103561a 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -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 diff --git a/src/r_segs.c b/src/r_segs.c index 21318e4ce..830a7529d 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -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<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<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; }