diff --git a/src/k_hud.c b/src/k_hud.c index 1031eeb2f..61578e8d7 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -3528,6 +3528,61 @@ static void K_drawKartMinimapIcon(fixed_t objx, fixed_t objy, INT32 hudx, INT32 V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, icon, colormap); } +static void K_drawKartMinimapDot(fixed_t objx, fixed_t objy, INT32 hudx, INT32 hudy, INT32 flags, UINT8 color, UINT8 size) +{ + fixed_t amnumxpos, amnumypos; + INT32 amxpos, amypos; + + amnumxpos = (FixedMul(objx, minimapinfo.zoom) - minimapinfo.offs_x); + amnumypos = -(FixedMul(objy, minimapinfo.zoom) - minimapinfo.offs_y); + + if (encoremode) + amnumxpos = -amnumxpos; + + amxpos = (amnumxpos / FRACUNIT) + (SHORT(minimapinfo.minimap_pic->width) / 2); + amypos = (amnumypos / FRACUNIT) + (SHORT(minimapinfo.minimap_pic->height) / 2); + + if (flags & V_NOSCALESTART) + { + amxpos *= vid.dupx; + amypos *= vid.dupy; + } + + V_DrawFill((amxpos + hudx) - (size / 2), (amypos + hudy) - (size / 2), size, size, flags | color); +} + +static void K_drawKartMinimapWaypoint(waypoint_t *wp, INT32 hudx, INT32 hudy, INT32 flags) +{ + UINT8 pal = 0x95; // blue + UINT8 size = 3; + + if (wp == stplyr->nextwaypoint) + { + pal = 0x70; // green + size = 6; + } + else if (K_GetWaypointIsShortcut(wp)) // shortcut + { + pal = 0x20; // pink + } + else if (!K_GetWaypointIsEnabled(wp)) // disabled + { + pal = 0x10; // gray + } + else if (wp->numnextwaypoints == 0 || wp->numprevwaypoints == 0) + { + pal = 0x40; // yellow + } + + if (!(flags & V_NOSCALESTART)) + { + hudx *= vid.dupx; + hudy *= vid.dupy; + } + + K_drawKartMinimapDot(wp->mobj->x, wp->mobj->y, hudx, hudy, flags | V_NOSCALESTART, pal, size); +} + static void K_drawKartMinimap(void) { patch_t *workingPic; @@ -3843,6 +3898,26 @@ static void K_drawKartMinimap(void) K_drawKartMinimapIcon(interpx, interpy, x, y, splitflags, kp_wantedreticle, NULL); } } + + if (cv_kartdebugwaypoints.value != 0) + { + size_t idx; + + for (idx = 0; idx < K_GetNumWaypoints(); ++idx) + { + waypoint_t *wp = K_GetWaypointFromIndex(idx); + + I_Assert(wp != NULL); + + K_drawKartMinimapWaypoint(wp, x, y, splitflags); + } + + if (stplyr->nextwaypoint != NULL) + { + // should be drawn on top of the others + K_drawKartMinimapWaypoint(stplyr->nextwaypoint, x, y, splitflags); + } + } } static void K_drawKartFinish(boolean finish) 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; }