diff --git a/src/deh_tables.c b/src/deh_tables.c index de88639e8..14d4696f8 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -6303,6 +6303,7 @@ struct int_const_s const INT_CONST[] = { {"RF_FULLDARK",RF_FULLDARK}, {"RF_SEMIBRIGHT",RF_SEMIBRIGHT}, {"RF_NOCOLORMAPS",RF_NOCOLORMAPS}, + {"RF_ALWAYSONTOP",RF_ALWAYSONTOP}, {"RF_SPRITETYPEMASK",RF_SPRITETYPEMASK}, {"RF_PAPERSPRITE",RF_PAPERSPRITE}, {"RF_FLOORSPRITE",RF_FLOORSPRITE}, diff --git a/src/k_waypoint.c b/src/k_waypoint.c index cf70c1dcd..ca4746357 100644 --- a/src/k_waypoint.c +++ b/src/k_waypoint.c @@ -578,7 +578,7 @@ static void K_DebugWaypointDrawRadius(waypoint_t *const waypoint) spawnX = waypointmobj->x; spawnY = waypointmobj->y; - spawnZ = waypointmobj->z + 16*mapobjectscale; + spawnZ = waypointmobj->z; radiusOrb = P_SpawnMobj(spawnX, spawnY, spawnZ, MT_SPARK); @@ -586,8 +586,9 @@ static void K_DebugWaypointDrawRadius(waypoint_t *const waypoint) radiusOrb->tics = 1; radiusOrb->frame &= ~FF_TRANSMASK; - radiusOrb->frame |= FF_FULLBRIGHT; + radiusOrb->frame |= FF_FULLBRIGHT|FF_REVERSESUBTRACT; radiusOrb->color = SKINCOLOR_PURPLE; + radiusOrb->renderflags |= RF_ALWAYSONTOP; radiusOrb->destscale = FixedDiv(waypointmobj->radius, spriteRadius); P_SetScale(radiusOrb, radiusOrb->destscale); @@ -627,6 +628,7 @@ void K_DebugWaypointsVisualise(void) debugmobj->frame &= ~FF_TRANSMASK; debugmobj->frame |= FF_FULLBRIGHT; //FF_TRANS20 + debugmobj->renderflags |= RF_ALWAYSONTOP; // There's a waypoint setup for this mobj! So draw that it's a valid waypoint and draw lines to its connections if (waypoint != NULL) diff --git a/src/r_defs.h b/src/r_defs.h index d4606c8ad..4e947616b 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -932,6 +932,8 @@ typedef enum RF_NOCOLORMAPS = 0x00000400, // Sprite is not drawn with colormaps + RF_ALWAYSONTOP = 0x00000800, // Sprite is drawn on top of level geometry + RF_SPRITETYPEMASK = 0x00003000, // --Different sprite types RF_PAPERSPRITE = 0x00001000, // Paper sprite RF_FLOORSPRITE = 0x00002000, // Floor sprite diff --git a/src/r_things.c b/src/r_things.c index 5f29920a5..458eaac4e 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2975,6 +2975,9 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps for (rover = vsprsortedhead.prev; rover != &vsprsortedhead; rover = rover->prev) { + const boolean alwaysontop = cv_debugrender_spriteclip.value || (rover->renderflags & RF_ALWAYSONTOP); + const INT32 ontopflag = cv_debugrender_spriteclip.value ? 0 : (rover->renderflags & RF_ALWAYSONTOP); + if (rover->szt > vid.height || rover->sz < 0) continue; @@ -2982,7 +2985,7 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps for (r2 = head->next; r2 != head; r2 = r2->next) { - if (cv_debugrender_spriteclip.value) + if (alwaysontop) { // Only sort behind other sprites; sorts in // front of everything else. @@ -2990,6 +2993,15 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps { continue; } + + // Only sort behind other RF_ALWAYSONTOP sprites. + // This avoids sorting behind a sprite that is + // behind level geometry and thus sorting this + // one behind level geometry too. + if (r2->sprite->renderflags ^ ontopflag) + { + continue; + } } if (r2->plane) @@ -3254,7 +3266,7 @@ void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2, portal_t* portal) fixed_t lowscale; INT32 silhouette; - if (cv_debugrender_spriteclip.value) + if ((spr->renderflags & RF_ALWAYSONTOP) || cv_debugrender_spriteclip.value) { for (x = x1; x <= x2; x++) {