diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index 2cfb43a96bdf301c1fc86a3fd9e36f7ba0fc71e3..1ec9101c3b39c68826f086e15c5d823f176c9d0b 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -84,6 +84,8 @@ typedef struct gl_vissprite_s boolean rotated; UINT8 translucency; //alpha level 0-255 + angle_t angle; // for splats + //Hurdler: 25/04/2000: now support colormap in hardware mode UINT8 *colormap; INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index aa2f03f6f8958a246737e92cabff0dee82a7e54a..ec78a3d352ec60be80a25b9f33004ca91c20b7e1 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4173,7 +4173,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) scale *= spr->shadowscale; if (spr->rotateflags & SRF_3D || renderflags & RF_NOSPLATBILLBOARD) - angle = spr->mobj->angle; + angle = spr->angle; else angle = viewangle; @@ -4228,8 +4228,8 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) // Translate for (i = 0; i < 4; i++) { - wallVerts[i].x = rotated[i].x + FIXED_TO_FLOAT(spr->mobj->x); - wallVerts[i].z = rotated[i].y + FIXED_TO_FLOAT(spr->mobj->y); + wallVerts[i].x = rotated[i].x + spr->x1; + wallVerts[i].z = rotated[i].y + spr->z1; } if (renderflags & (RF_SLOPESPLAT | RF_OBJECTSLOPESPLAT)) @@ -4256,7 +4256,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) else { 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 @@ -5195,9 +5195,16 @@ static void HWR_ProjectSprite(mobj_t *thing) I_Error("sprframes NULL for sprite %d\n", thing->sprite); #endif - ang = R_PointToAngle (interp.x, interp.y) - interp.angle; - if (mirrored) - ang = InvAngle(ang); + if (splat) + { + ang = R_PointToAngle2(0, viewz, 0, interp.z); + } + else + { + ang = R_PointToAngle (interp.x, interp.y) - interp.angle; + if (mirrored) + ang = InvAngle(ang); + } if (sprframe->rotate == SRF_SINGLE) { @@ -5321,43 +5328,52 @@ static void HWR_ProjectSprite(mobj_t *thing) this_xscale = spritexscale * this_scale; this_yscale = spriteyscale * this_scale; - if (flip) + if (splat) { - x1 = (FIXED_TO_FLOAT(spr_width - spr_offset) * this_xscale); - x2 = (FIXED_TO_FLOAT(spr_offset) * this_xscale); + z1 = z2 = tr_y; + x1 = x2 = tr_x; + gz = gzt = interp.z; } else { - x1 = (FIXED_TO_FLOAT(spr_offset) * this_xscale); - x2 = (FIXED_TO_FLOAT(spr_width - spr_offset) * this_xscale); - } + if (flip) + { + 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 -/* - if (papersprite) - { - z1 = tz - x1 * angle_scalez; - z2 = tz + x2 * angle_scalez; + // test if too close + /* + if (papersprite) + { + z1 = tz - x1 * angle_scalez; + z2 = tz + x2 * angle_scalez; - if (max(z1, z2) < ZCLIP_PLANE) - return; - } -*/ + if (max(z1, z2) < ZCLIP_PLANE) + return; + } + */ - z1 = tr_y + x1 * rightsin; - z2 = tr_y - x2 * rightsin; - x1 = tr_x + x1 * rightcos; - x2 = tr_x - x2 * rightcos; + z1 = tr_y + x1 * rightsin; + z2 = tr_y - x2 * rightsin; + x1 = tr_x + x1 * rightcos; + x2 = tr_x - x2 * rightcos; - if (vflip) - { - gz = FIXED_TO_FLOAT(interp.z + thing->height) - (FIXED_TO_FLOAT(spr_topoffset) * this_yscale); - gzt = gz + (FIXED_TO_FLOAT(spr_height) * this_yscale); - } - else - { - gzt = FIXED_TO_FLOAT(interp.z) + (FIXED_TO_FLOAT(spr_topoffset) * this_yscale); - gz = gzt - (FIXED_TO_FLOAT(spr_height) * this_yscale); + if (vflip) + { + gz = FIXED_TO_FLOAT(interp.z + thing->height) - (FIXED_TO_FLOAT(spr_topoffset) * this_yscale); + gzt = gz + (FIXED_TO_FLOAT(spr_height) * this_yscale); + } + else + { + gzt = FIXED_TO_FLOAT(interp.z) + (FIXED_TO_FLOAT(spr_topoffset) * this_yscale); + gz = gzt - (FIXED_TO_FLOAT(spr_height) * this_yscale); + } } if (thing->subsector->sector->cullheight) @@ -5514,6 +5530,8 @@ static void HWR_ProjectSprite(mobj_t *thing) vis->vflip = vflip; vis->precip = false; + + vis->angle = interp.angle; } #ifdef HWPRECIP diff --git a/src/r_splats.c b/src/r_splats.c index 0a84a3a336b6a7f7fad2bf80d025fa2163f18b02..92d12d784fbd5fe3a2f3189e15dde86a8bc22d63 100644 --- a/src/r_splats.c +++ b/src/r_splats.c @@ -185,7 +185,7 @@ void R_DrawFloorSplat(vissprite_t *spr) splat.scale = FixedMul(splat.scale, ((skin_t *)mobj->skin)->highresscale); if (spr->rotateflags & SRF_3D || renderflags & RF_NOSPLATBILLBOARD) - splatangle = mobj->angle; + splatangle = spr->centerangle; else splatangle = spr->viewpoint.angle; @@ -209,14 +209,14 @@ void R_DrawFloorSplat(vissprite_t *spr) xoffset = FixedMul(leftoffset, splat.xscale); yoffset = FixedMul(topoffset, splat.yscale); - x = mobj->x; - y = mobj->y; + x = spr->gx; + y = spr->gy; w = (splat.width * splat.xscale); h = (splat.height * splat.yscale); splat.x = x; splat.y = y; - splat.z = mobj->z; + splat.z = spr->pz; splat.slope = NULL; // Set positions diff --git a/src/r_things.c b/src/r_things.c index 82292957475b494e9191b08911f3ed5601b094fb..9fbdf24aa75bd661f22543e4c6489b8f490117da 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1586,7 +1586,11 @@ static void R_ProjectSprite(mobj_t *thing) I_Error("R_ProjectSprite: sprframes NULL for sprite %d\n", thing->sprite); #endif - if (sprframe->rotate != SRF_SINGLE || papersprite) + if (splat) + { + ang = R_PointToAngle2(0, viewz, 0, interp.z); + } + else if (sprframe->rotate != SRF_SINGLE || papersprite) { ang = R_PointToAngle (interp.x, interp.y) - interp.angle; if (mirrored) @@ -1863,6 +1867,7 @@ static void R_ProjectSprite(mobj_t *thing) tr_y = (interp.y - sort_y) - viewy; sort_z = FixedMul(tr_x, viewcos) + FixedMul(tr_y, viewsin); sortsplat = FixedDiv(projectiony, sort_z); + centerangle = interp.angle; } // PORTAL SPRITE CLIPPING diff --git a/src/r_things.h b/src/r_things.h index f0a5751e847c68ed4db454fdeca18b1fe7d6ac4a..6993f201ebfd26080fdb7b94cc1b068682db91e2 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -165,7 +165,7 @@ typedef struct vissprite_s fixed_t paperoffset, paperdistance; // for paper sprites, offset/dist relative to the angle fixed_t xiscale; // negative if flipped - angle_t centerangle; // for paper sprites + angle_t centerangle; // for paper sprites / splats // for floor sprites struct {