Add R_SplatSlope, function to set slope of splat during rendering

Slope set by R_SplatSlope is only effective if
floorspriteslope or standingslope is not already being
used.
This commit is contained in:
James R 2023-06-18 00:11:01 -07:00
parent f20a7e4db2
commit f98319a98c
3 changed files with 20 additions and 0 deletions

View file

@ -141,6 +141,7 @@ static void rasterize_segment_tex(INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT32
void R_DrawFloorSplat(vissprite_t *spr)
{
floorsplat_t splat;
pslope_t localslope;
mobj_t *mobj = spr->mobj;
fixed_t tr_x, tr_y, rot_x, rot_y, rot_z;
@ -258,6 +259,9 @@ void R_DrawFloorSplat(vissprite_t *spr)
if (standingslope && (renderflags & RF_OBJECTSLOPESPLAT))
splat.slope = standingslope;
if (!splat.slope && R_SplatSlope(mobj, (vector3_t){splat.x, splat.y, splat.z}, &localslope))
splat.slope = &localslope;
}
// Translate

View file

@ -10,6 +10,7 @@
#include "d_player.h"
#include "p_tick.h"
#include "r_splats.h"
#include "r_things.h"
INT32 R_ThingLightLevel(mobj_t* thing)
@ -29,3 +30,17 @@ INT32 R_ThingLightLevel(mobj_t* thing)
return lightlevel;
}
// Use this function to set the slope of a splat sprite.
//
// slope->o, slope->d and slope->zdelta must be set, none of
// the other fields on pslope_t are used.
//
// Return true if you want the slope to be used. The object
// must have RF_SLOPESPLAT and mobj_t.floorspriteslope must be
// NULL. (If RF_OBJECTSLOPESPLAT is set, then
// mobj_t.standingslope must also be NULL.)
boolean R_SplatSlope(mobj_t* mobj, vector3_t position, pslope_t* slope)
{
return false;
}

View file

@ -94,6 +94,7 @@ boolean R_ThingIsFullDark (mobj_t *thing);
boolean R_ThingIsFlashing(mobj_t *thing);
INT32 R_ThingLightLevel(mobj_t *thing);
boolean R_SplatSlope(mobj_t *thing, vector3_t position, pslope_t *slope);
// --------------
// MASKED DRAWING