mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Use interpolated mobj x/y/z/angle for splats
This commit is contained in:
parent
8e7c5b2712
commit
ce4518a20c
5 changed files with 52 additions and 38 deletions
|
|
@ -87,6 +87,8 @@ typedef struct gl_vissprite_s
|
||||||
boolean rotated;
|
boolean rotated;
|
||||||
UINT8 translucency; //alpha level 0-255
|
UINT8 translucency; //alpha level 0-255
|
||||||
|
|
||||||
|
angle_t angle; // for splats
|
||||||
|
|
||||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||||
UINT8 *colormap;
|
UINT8 *colormap;
|
||||||
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
|
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
|
||||||
|
|
|
||||||
|
|
@ -4165,7 +4165,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||||
scale *= spr->shadowscale;
|
scale *= spr->shadowscale;
|
||||||
|
|
||||||
if (spr->rotateflags & SRF_3D || renderflags & RF_NOSPLATBILLBOARD)
|
if (spr->rotateflags & SRF_3D || renderflags & RF_NOSPLATBILLBOARD)
|
||||||
angle = spr->mobj->angle;
|
angle = spr->angle;
|
||||||
else
|
else
|
||||||
angle = viewangle;
|
angle = viewangle;
|
||||||
|
|
||||||
|
|
@ -4220,8 +4220,8 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||||
// Translate
|
// Translate
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
wallVerts[i].x = rotated[i].x + FIXED_TO_FLOAT(spr->mobj->x);
|
wallVerts[i].x = rotated[i].x + spr->x1;
|
||||||
wallVerts[i].z = rotated[i].y + FIXED_TO_FLOAT(spr->mobj->y);
|
wallVerts[i].z = rotated[i].y + spr->z1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (renderflags & (RF_SLOPESPLAT | RF_OBJECTSLOPESPLAT))
|
if (renderflags & (RF_SLOPESPLAT | RF_OBJECTSLOPESPLAT))
|
||||||
|
|
@ -4248,7 +4248,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
wallVerts[i].y = FIXED_TO_FLOAT(spr->mobj->z) + zoffset;
|
wallVerts[i].y = FIXED_TO_FLOAT(spr->gz) + zoffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -5369,43 +5369,52 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||||
this_xscale = spritexscale * this_scale;
|
this_xscale = spritexscale * this_scale;
|
||||||
this_yscale = spriteyscale * this_scale;
|
this_yscale = spriteyscale * this_scale;
|
||||||
|
|
||||||
if (flip)
|
if (splat)
|
||||||
{
|
{
|
||||||
x1 = (FIXED_TO_FLOAT(spr_width - spr_offset) * this_xscale);
|
z1 = z2 = tr_y;
|
||||||
x2 = (FIXED_TO_FLOAT(spr_offset) * this_xscale);
|
x1 = x2 = tr_x;
|
||||||
|
gz = gzt = interp.z;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x1 = (FIXED_TO_FLOAT(spr_offset) * this_xscale);
|
if (flip)
|
||||||
x2 = (FIXED_TO_FLOAT(spr_width - spr_offset) * this_xscale);
|
{
|
||||||
}
|
x1 = (FIXED_TO_FLOAT(spr_width - spr_offset) * this_xscale);
|
||||||
|
x2 = (FIXED_TO_FLOAT(spr_offset) * this_xscale);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x1 = (FIXED_TO_FLOAT(spr_offset) * this_xscale);
|
||||||
|
x2 = (FIXED_TO_FLOAT(spr_width - spr_offset) * this_xscale);
|
||||||
|
}
|
||||||
|
|
||||||
// test if too close
|
// test if too close
|
||||||
/*
|
/*
|
||||||
if (papersprite)
|
if (papersprite)
|
||||||
{
|
{
|
||||||
z1 = tz - x1 * angle_scalez;
|
z1 = tz - x1 * angle_scalez;
|
||||||
z2 = tz + x2 * angle_scalez;
|
z2 = tz + x2 * angle_scalez;
|
||||||
|
|
||||||
if (max(z1, z2) < ZCLIP_PLANE)
|
if (max(z1, z2) < ZCLIP_PLANE)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
z1 = tr_y + x1 * rightsin;
|
z1 = tr_y + x1 * rightsin;
|
||||||
z2 = tr_y - x2 * rightsin;
|
z2 = tr_y - x2 * rightsin;
|
||||||
x1 = tr_x + x1 * rightcos;
|
x1 = tr_x + x1 * rightcos;
|
||||||
x2 = tr_x - x2 * rightcos;
|
x2 = tr_x - x2 * rightcos;
|
||||||
|
|
||||||
if (vflip)
|
if (vflip)
|
||||||
{
|
{
|
||||||
gz = FIXED_TO_FLOAT(interp.z + thing->height) - (FIXED_TO_FLOAT(spr_topoffset) * this_yscale);
|
gz = FIXED_TO_FLOAT(interp.z + thing->height) - (FIXED_TO_FLOAT(spr_topoffset) * this_yscale);
|
||||||
gzt = gz + (FIXED_TO_FLOAT(spr_height) * this_yscale);
|
gzt = gz + (FIXED_TO_FLOAT(spr_height) * this_yscale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gzt = FIXED_TO_FLOAT(interp.z) + (FIXED_TO_FLOAT(spr_topoffset) * this_yscale);
|
gzt = FIXED_TO_FLOAT(interp.z) + (FIXED_TO_FLOAT(spr_topoffset) * this_yscale);
|
||||||
gz = gzt - (FIXED_TO_FLOAT(spr_height) * this_yscale);
|
gz = gzt - (FIXED_TO_FLOAT(spr_height) * this_yscale);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thing->subsector->sector->cullheight)
|
if (thing->subsector->sector->cullheight)
|
||||||
|
|
@ -5561,6 +5570,8 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||||
|
|
||||||
vis->precip = false;
|
vis->precip = false;
|
||||||
vis->bbox = false;
|
vis->bbox = false;
|
||||||
|
|
||||||
|
vis->angle = interp.angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HWPRECIP
|
#ifdef HWPRECIP
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@ void R_DrawFloorSplat(vissprite_t *spr)
|
||||||
splat.scale = FixedMul(splat.scale, ((skin_t *)mobj->skin)->highresscale);
|
splat.scale = FixedMul(splat.scale, ((skin_t *)mobj->skin)->highresscale);
|
||||||
|
|
||||||
if (spr->rotateflags & SRF_3D || renderflags & RF_NOSPLATBILLBOARD)
|
if (spr->rotateflags & SRF_3D || renderflags & RF_NOSPLATBILLBOARD)
|
||||||
splatangle = mobj->angle;
|
splatangle = spr->centerangle;
|
||||||
else
|
else
|
||||||
splatangle = spr->viewpoint.angle;
|
splatangle = spr->viewpoint.angle;
|
||||||
|
|
||||||
|
|
@ -209,14 +209,14 @@ void R_DrawFloorSplat(vissprite_t *spr)
|
||||||
xoffset = FixedMul(leftoffset, splat.xscale);
|
xoffset = FixedMul(leftoffset, splat.xscale);
|
||||||
yoffset = FixedMul(topoffset, splat.yscale);
|
yoffset = FixedMul(topoffset, splat.yscale);
|
||||||
|
|
||||||
x = mobj->x;
|
x = spr->gx;
|
||||||
y = mobj->y;
|
y = spr->gy;
|
||||||
w = (splat.width * splat.xscale);
|
w = (splat.width * splat.xscale);
|
||||||
h = (splat.height * splat.yscale);
|
h = (splat.height * splat.yscale);
|
||||||
|
|
||||||
splat.x = x;
|
splat.x = x;
|
||||||
splat.y = y;
|
splat.y = y;
|
||||||
splat.z = mobj->z;
|
splat.z = spr->pz;
|
||||||
splat.slope = NULL;
|
splat.slope = NULL;
|
||||||
|
|
||||||
// Set positions
|
// Set positions
|
||||||
|
|
|
||||||
|
|
@ -2056,6 +2056,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
tr_y = (interp.y - sort_y) - viewy;
|
tr_y = (interp.y - sort_y) - viewy;
|
||||||
sort_z = FixedMul(tr_x, viewcos) + FixedMul(tr_y, viewsin);
|
sort_z = FixedMul(tr_x, viewcos) + FixedMul(tr_y, viewsin);
|
||||||
sortsplat = FixedDiv(projectiony[viewssnum], sort_z);
|
sortsplat = FixedDiv(projectiony[viewssnum], sort_z);
|
||||||
|
centerangle = interp.angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PORTAL SPRITE CLIPPING
|
// PORTAL SPRITE CLIPPING
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ typedef struct vissprite_s
|
||||||
fixed_t paperoffset, paperdistance; // for paper sprites, offset/dist relative to the angle
|
fixed_t paperoffset, paperdistance; // for paper sprites, offset/dist relative to the angle
|
||||||
fixed_t xiscale; // negative if flipped
|
fixed_t xiscale; // negative if flipped
|
||||||
|
|
||||||
angle_t centerangle; // for paper sprites
|
angle_t centerangle; // for paper sprites / splats
|
||||||
|
|
||||||
// for floor sprites
|
// for floor sprites
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue