diff --git a/src/r_plane.c b/src/r_plane.c index f4fd9c397..c54b32382 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -759,7 +759,7 @@ d->z = (v1.x * v2.y) - (v1.y * v2.x) #undef SFMULT } -static void R_SetSlopePlaneVectors(visplane_t *pl, INT32 y, fixed_t xoff, fixed_t yoff, float fudge) +void R_SetTiltedSpan(INT32 span) { if (ds_su == NULL) ds_su = Z_Malloc(sizeof(*ds_su) * vid.height, PU_STATIC, NULL); @@ -768,10 +768,14 @@ static void R_SetSlopePlaneVectors(visplane_t *pl, INT32 y, fixed_t xoff, fixed_ if (ds_sz == NULL) ds_sz = Z_Malloc(sizeof(*ds_sz) * vid.height, PU_STATIC, NULL); - ds_sup = &ds_su[y]; - ds_svp = &ds_sv[y]; - ds_szp = &ds_sz[y]; + ds_sup = &ds_su[span]; + ds_svp = &ds_sv[span]; + ds_szp = &ds_sz[span]; +} +static void R_SetSlopePlaneVectors(visplane_t *pl, INT32 y, fixed_t xoff, fixed_t yoff, float fudge) +{ + R_SetTiltedSpan(y); R_CalculateSlopeVectors(pl->slope, pl->viewx, pl->viewy, pl->viewz, FRACUNIT, FRACUNIT, xoff, yoff, pl->viewangle, pl->plangle, fudge); } diff --git a/src/r_plane.h b/src/r_plane.h index 7664858c9..0d11c5b72 100644 --- a/src/r_plane.h +++ b/src/r_plane.h @@ -96,6 +96,9 @@ void R_DrawSinglePlane(visplane_t *pl); // Calculates the slope vectors needed for tilted span drawing. void R_CalculateSlopeVectors(pslope_t *slope, fixed_t planeviewx, fixed_t planeviewy, fixed_t planeviewz, fixed_t planexscale, fixed_t planeyscale, fixed_t planexoffset, fixed_t planeyoffset, angle_t planeviewangle, angle_t planeangle, float fudge); +// Sets the slope vector pointers for the current tilted span. +void R_SetTiltedSpan(INT32 span); + typedef struct planemgr_s { visplane_t *plane; diff --git a/src/r_splats.c b/src/r_splats.c index 636aa30ed..a3fad82d8 100644 --- a/src/r_splats.c +++ b/src/r_splats.c @@ -419,9 +419,7 @@ void R_RenderFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis // Lactozilla: I don't know what I'm doing if (pSplat->tilted) { - ds_sup = &ds_su[0]; - ds_svp = &ds_sv[0]; - ds_szp = &ds_sz[0]; + R_SetTiltedSpan(0); R_CalculateSlopeVectors(&pSplat->slope, viewx, viewy, viewz, pSplat->xscale, pSplat->yscale, -pSplat->verts[0].x, pSplat->verts[0].y, viewangle, pSplat->angle, 1.0f); spanfunctype = SPANDRAWFUNC_TILTEDSPRITE; }