From e872f25ce66261f3159d3f66aae196822ba252ae Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 20 Apr 2025 06:23:36 +0200 Subject: [PATCH 1/5] check for sloperoll first --- src/hardware/hw_main.c | 2 +- src/r_things.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 4e6f352ef..390192d16 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4673,7 +4673,7 @@ static void HWR_ProjectSprite(mobj_t *thing) #ifdef ROTSPRITE // determine here if sprite should rotate for optimization const boolean sliprollrotate = (cv_sliptideroll.value && (thing->player && thing->player->sliproll)); - const boolean shouldrotate = (interp.roll || interp.pitch || interp.sloperoll || interp.slopepitch || thing->rollangle || sliprollrotate); + const boolean shouldrotate = (interp.sloperoll || interp.slopepitch || interp.roll || interp.pitch || thing->rollangle || sliprollrotate); #endif //Fab : 02-08-98: 'skin' override spritedef currently used for skin diff --git a/src/r_things.c b/src/r_things.c index f0f960d63..f0538291c 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1259,7 +1259,7 @@ static void R_ProjectSprite(mobj_t *thing) #ifdef ROTSPRITE // determine here if sprite should rotate for optimization const boolean sliprollrotate = (cv_sliptideroll.value && (thing->player && thing->player->sliproll)); - const boolean shouldrotate = (interp.roll || interp.pitch || interp.sloperoll || interp.slopepitch || thing->rollangle || sliprollrotate); + const boolean shouldrotate = (interp.sloperoll || interp.slopepitch || interp.roll || interp.pitch || thing->rollangle || sliprollrotate); #endif //Fab : 02-08-98: 'skin' override spritedef currently used for skin From fe632340b436f2ccc28b5ede7d93a191ce2cfae6 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 20 Apr 2025 15:21:39 +0200 Subject: [PATCH 2/5] fix P_CameraLineOpening lel this was always botched --- src/p_maputl.c | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index a88545135..7b748c22e 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -294,50 +294,34 @@ void P_CameraLineOpening(line_t *linedef) // If you can see through it, why not move the camera through it too? if (front->camsec >= 0) { - frontfloor = sectors[front->camsec].floorheight; - frontceiling = sectors[front->camsec].ceilingheight; - if (sectors[front->camsec].f_slope) - frontfloor = P_GetZAt(sectors[front->camsec].f_slope, camera[0].x, camera[0].y); - if (sectors[front->camsec].c_slope) - frontceiling = P_GetZAt(sectors[front->camsec].c_slope, camera[0].x, camera[0].y); + frontfloor = P_GetSectorFloorZAt (§ors[front->camsec], camera[0].x, camera[0].y); + frontceiling = P_GetSectorCeilingZAt(§ors[front->camsec], camera[0].x, camera[0].y); } else if (front->heightsec >= 0) { - frontfloor = sectors[front->heightsec].floorheight; - frontceiling = sectors[front->heightsec].ceilingheight; - if (sectors[front->heightsec].f_slope) - frontfloor = P_GetZAt(sectors[front->heightsec].f_slope, camera[0].x, camera[0].y); - if (sectors[front->heightsec].c_slope) - frontceiling = P_GetZAt(sectors[front->heightsec].c_slope, camera[0].x, camera[0].y); + frontfloor = P_GetSectorFloorZAt (§ors[front->heightsec], camera[0].x, camera[0].y); + frontceiling = P_GetSectorCeilingZAt(§ors[front->heightsec], camera[0].x, camera[0].y); } else { - frontfloor = P_CameraGetFloorZ(mapcampointer, front, tmx, tmy, linedef); + frontfloor = P_CameraGetFloorZ (mapcampointer, front, tmx, tmy, linedef); frontceiling = P_CameraGetCeilingZ(mapcampointer, front, tmx, tmy, linedef); } if (back->camsec >= 0) { - backfloor = sectors[back->camsec].floorheight; - backceiling = sectors[back->camsec].ceilingheight; - if (sectors[back->camsec].f_slope) - frontfloor = P_GetZAt(sectors[back->camsec].f_slope, camera[0].x, camera[0].y); - if (sectors[back->camsec].c_slope) - frontceiling = P_GetZAt(sectors[back->camsec].c_slope, camera[0].x, camera[0].y); + backfloor = P_GetSectorFloorZAt (§ors[back->camsec], camera[0].x, camera[0].y); + backceiling = P_GetSectorCeilingZAt(§ors[back->camsec], camera[0].x, camera[0].y); } else if (back->heightsec >= 0) { - backfloor = sectors[back->heightsec].floorheight; - backceiling = sectors[back->heightsec].ceilingheight; - if (sectors[back->heightsec].f_slope) - frontfloor = P_GetZAt(sectors[back->heightsec].f_slope, camera[0].x, camera[0].y); - if (sectors[back->heightsec].c_slope) - frontceiling = P_GetZAt(sectors[back->heightsec].c_slope, camera[0].x, camera[0].y); + backfloor = P_GetSectorFloorZAt (§ors[back->heightsec], camera[0].x, camera[0].y); + backceiling = P_GetSectorCeilingZAt(§ors[back->heightsec], camera[0].x, camera[0].y); } else { - backfloor = P_CameraGetFloorZ(mapcampointer, back, tmx, tmy, linedef); + backfloor = P_CameraGetFloorZ(mapcampointer, back, tmx, tmy, linedef); backceiling = P_CameraGetCeilingZ(mapcampointer, back, tmx, tmy, linedef); } From cd2f8577a00d53b853a646208b8368ac6750a6fd Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 20 Apr 2025 23:01:53 +0200 Subject: [PATCH 3/5] big cleanup "GetZAt" stuff GetZAt now takes 4 parameters (slope, x, y, normalheight) and everything now uses their designated getzatfunction --- src/am_map.c | 7 +- src/hardware/hw_main.c | 388 ++++++++++++++++++++--------------------- src/k_kart.c | 10 +- src/lua_baselib.c | 2 +- src/m_cheat.c | 16 +- src/p_map.c | 18 +- src/p_mobj.c | 130 +++++--------- src/p_setup.c | 7 +- src/p_slopes.c | 10 +- src/p_slopes.h | 17 +- src/p_spec.c | 12 +- src/p_user.c | 29 +-- src/r_bsp.c | 56 +++--- src/r_plane.c | 10 +- src/r_segs.c | 266 +++++++++++----------------- src/r_things.c | 47 ++--- 16 files changed, 440 insertions(+), 585 deletions(-) diff --git a/src/am_map.c b/src/am_map.c index 64fad1e0e..f91273e8b 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -931,11 +931,8 @@ static INT32 GetOffroad(INT32 special) } #define SLOPEPARAMS(slope, end1, end2, normalheight) \ - if (slope) { \ - end1 = (P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y) + FRACUNIT/2) >> FRACBITS; \ - end2 = (P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y) + FRACUNIT/2) >> FRACBITS; \ - } else \ - end1 = end2 = (normalheight + FRACUNIT/2) >> FRACBITS; + end1 = (P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y, ((normalheight + FRACUNIT/2) >> FRACBITS)) + FRACUNIT/2) >> FRACBITS; \ + end2 = (P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y, ((normalheight + FRACUNIT/2) >> FRACBITS)) + FRACUNIT/2) >> FRACBITS; static ffloor_t *AM_CompareFOFs(size_t i, ffloor_t *rover, ffloor_t *secondarystore) { diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 390192d16..65b6137bf 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -573,9 +573,9 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool // Set fixedheight to the slope's height from our viewpoint, if we have a slope if (slope) - fixedheight = P_GetZAt(slope, viewx, viewy); + fixedheight = P_GetSlopeZAt(slope, viewx, viewy); - height = FIXED_TO_FLOAT(fixedheight); + height = FixedToFloat(fixedheight); // Allocate plane-vertex buffer if we need to if (!planeVerts || nrPlaneVerts > numAllocedPlaneVerts) @@ -629,14 +629,14 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool { if (!isceiling) // it's a floor { - scrollx = FIXED_TO_FLOAT(FOFsector->floor_xoffs)/fflatsize; - scrolly = FIXED_TO_FLOAT(FOFsector->floor_yoffs)/fflatsize; + scrollx = FixedToFloat(FOFsector->floor_xoffs)/fflatsize; + scrolly = FixedToFloat(FOFsector->floor_yoffs)/fflatsize; angle = FOFsector->floorpic_angle; } else // it's a ceiling { - scrollx = FIXED_TO_FLOAT(FOFsector->ceiling_xoffs)/fflatsize; - scrolly = FIXED_TO_FLOAT(FOFsector->ceiling_yoffs)/fflatsize; + scrollx = FixedToFloat(FOFsector->ceiling_xoffs)/fflatsize; + scrolly = FixedToFloat(FOFsector->ceiling_yoffs)/fflatsize; angle = FOFsector->ceilingpic_angle; } } @@ -644,14 +644,14 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool { if (!isceiling) // it's a floor { - scrollx = FIXED_TO_FLOAT(gl_frontsector->floor_xoffs)/fflatsize; - scrolly = FIXED_TO_FLOAT(gl_frontsector->floor_yoffs)/fflatsize; + scrollx = FixedToFloat(gl_frontsector->floor_xoffs)/fflatsize; + scrolly = FixedToFloat(gl_frontsector->floor_yoffs)/fflatsize; angle = gl_frontsector->floorpic_angle; } else // it's a ceiling { - scrollx = FIXED_TO_FLOAT(gl_frontsector->ceiling_xoffs)/fflatsize; - scrolly = FIXED_TO_FLOAT(gl_frontsector->ceiling_yoffs)/fflatsize; + scrollx = FixedToFloat(gl_frontsector->ceiling_xoffs)/fflatsize; + scrolly = FixedToFloat(gl_frontsector->ceiling_yoffs)/fflatsize; angle = gl_frontsector->ceilingpic_angle; } } @@ -662,10 +662,10 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool // This needs to be done so everything aligns after rotation // It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does - tempxsow = FLOAT_TO_FIXED(flatxref); - tempytow = FLOAT_TO_FIXED(flatyref); - flatxref = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); - flatyref = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle)))); + tempxsow = FloatToFixed(flatxref); + tempytow = FloatToFixed(flatyref); + flatxref = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); + flatyref = (FixedToFloat(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle)))); } #define SETUP3DVERT(vert, vx, vy) {\ @@ -676,10 +676,10 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool /* Need to rotate before translate */\ if (angle) /* Only needs to be done if there's an altered angle */\ {\ - tempxsow = FLOAT_TO_FIXED(vert->s);\ - tempytow = FLOAT_TO_FIXED(vert->t);\ - vert->s = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));\ - vert->t = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));\ + tempxsow = FloatToFixed(vert->s);\ + tempytow = FloatToFixed(vert->t);\ + vert->s = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));\ + vert->t = (FixedToFloat(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));\ }\ \ vert->x = (vx);\ @@ -688,8 +688,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool \ if (slope)\ {\ - fixedheight = P_GetZAt(slope, FLOAT_TO_FIXED((vx)), FLOAT_TO_FIXED((vy)));\ - vert->y = FIXED_TO_FLOAT(fixedheight);\ + fixedheight = P_GetSlopeZAt(slope, FloatToFixed((vx)), FloatToFixed((vy)));\ + vert->y = FixedToFloat(fixedheight);\ }\ } for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++,v3d++,pv++) @@ -745,7 +745,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool continue; P_ClosestPointOnLine(viewx, viewy, line->linedef, &v); - dist = FIXED_TO_FLOAT(R_PointToDist(v.x, v.y)); + dist = FixedToFloat(R_PointToDist(v.x, v.y)); if (line->pv1) { @@ -754,8 +754,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool } else { - x1 = FIXED_TO_FLOAT(line->v1->x); - y1 = FIXED_TO_FLOAT(line->v1->x); + x1 = FixedToFloat(line->v1->x); + y1 = FixedToFloat(line->v1->x); } if (line->pv2) @@ -765,8 +765,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool } else { - xd = FIXED_TO_FLOAT(line->v2->x) - x1; - yd = FIXED_TO_FLOAT(line->v2->y) - y1; + xd = FixedToFloat(line->v2->x) - x1; + yd = FixedToFloat(line->v2->y) - y1; } // Based on the seg length and the distance from the line, split horizon into multiple poly sets to reduce distortion @@ -830,11 +830,11 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf) M_ClearBox(segbbox); M_AddToBox(segbbox, - FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv1)->x), - FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv1)->y)); + FloatToFixed(((polyvertex_t *)gl_curline->pv1)->x), + FloatToFixed(((polyvertex_t *)gl_curline->pv1)->y)); M_AddToBox(segbbox, - FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv2)->x), - FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv2)->y)); + FloatToFixed(((polyvertex_t *)gl_curline->pv2)->x), + FloatToFixed(((polyvertex_t *)gl_curline->pv2)->y)); splat = (wallsplat_t *)gl_curline->linedef->splats; for (; splat; splat = splat->next) @@ -847,17 +847,17 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf) gpatch = W_CachePatchNum(splat->patch, PU_CACHE); HWR_GetPatch(gpatch); - wallVerts[0].x = wallVerts[3].x = FIXED_TO_FLOAT(splat->v1.x); - wallVerts[0].z = wallVerts[3].z = FIXED_TO_FLOAT(splat->v1.y); - wallVerts[2].x = wallVerts[1].x = FIXED_TO_FLOAT(splat->v2.x); - wallVerts[2].z = wallVerts[1].z = FIXED_TO_FLOAT(splat->v2.y); + wallVerts[0].x = wallVerts[3].x = FixedToFloat(splat->v1.x); + wallVerts[0].z = wallVerts[3].z = FixedToFloat(splat->v1.y); + wallVerts[2].x = wallVerts[1].x = FixedToFloat(splat->v2.x); + wallVerts[2].z = wallVerts[1].z = FixedToFloat(splat->v2.y); i = splat->top; if (splat->yoffset) i += *splat->yoffset; - wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(i)+(gpatch->height>>1); - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(i)-(gpatch->height>>1); + wallVerts[2].y = wallVerts[3].y = FixedToFloat(i)+(gpatch->height>>1); + wallVerts[0].y = wallVerts[1].y = FixedToFloat(i)-(gpatch->height>>1); wallVerts[3].s = wallVerts[3].t = wallVerts[2].s = wallVerts[0].t = 0.0f; wallVerts[1].s = wallVerts[1].t = wallVerts[2].t = wallVerts[0].s = 1.0f; @@ -1333,13 +1333,13 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { vs.x = ((polyvertex_t *)gl_curline->pv1)->x; vs.y = ((polyvertex_t *)gl_curline->pv1)->y; - v1x = FLOAT_TO_FIXED(vs.x); - v1y = FLOAT_TO_FIXED(vs.y); + v1x = FloatToFixed(vs.x); + v1y = FloatToFixed(vs.y); } else { - vs.x = FIXED_TO_FLOAT(gl_curline->v1->x); - vs.y = FIXED_TO_FLOAT(gl_curline->v1->y); + vs.x = FixedToFloat(gl_curline->v1->x); + vs.y = FixedToFloat(gl_curline->v1->y); v1x = gl_curline->v1->x; v1y = gl_curline->v1->y; } @@ -1348,23 +1348,20 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { ve.x = ((polyvertex_t *)gl_curline->pv2)->x; ve.y = ((polyvertex_t *)gl_curline->pv2)->y; - v2x = FLOAT_TO_FIXED(ve.x); - v2y = FLOAT_TO_FIXED(ve.y); + v2x = FloatToFixed(ve.x); + v2y = FloatToFixed(ve.y); } else { - ve.x = FIXED_TO_FLOAT(gl_curline->v2->x); - ve.y = FIXED_TO_FLOAT(gl_curline->v2->y); + ve.x = FixedToFloat(gl_curline->v2->x); + ve.y = FixedToFloat(gl_curline->v2->y); v2x = gl_curline->v2->x; v2y = gl_curline->v2->y; } #define SLOPEPARAMS(slope, end1, end2, normalheight) \ - if (slope) { \ - end1 = P_GetZAt(slope, v1x, v1y); \ - end2 = P_GetZAt(slope, v2x, v2y); \ - } else \ - end1 = end2 = normalheight; + end1 = P_GetZAt(slope, v1x, v1y, normalheight); \ + end2 = P_GetZAt(slope, v2x, v2y, normalheight); SLOPEPARAMS(gl_frontsector->c_slope, worldtop, worldtopslope, gl_frontsector->ceilingheight) SLOPEPARAMS(gl_frontsector->f_slope, worldbottom, worldbottomslope, gl_frontsector->floorheight) @@ -1412,7 +1409,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (!gl_curline->polyseg) // Don't do it for polyobjects { // Sky Ceilings - wallVerts[3].y = wallVerts[2].y = FIXED_TO_FLOAT(INT32_MAX); + wallVerts[3].y = wallVerts[2].y = FixedToFloat(INT32_MAX); if (gl_frontsector->ceilingpic == skyflatnum) { @@ -1424,29 +1421,29 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom && (worldhigh != worldtop || worldhighslope != worldtopslope)) // Removing the second line above will render more rarely visible skywalls. Example: Cave garden ceiling in Dark race { - wallVerts[0].y = FIXED_TO_FLOAT(worldhigh); - wallVerts[1].y = FIXED_TO_FLOAT(worldhighslope); + wallVerts[0].y = FixedToFloat(worldhigh); + wallVerts[1].y = FixedToFloat(worldhighslope); HWR_DrawSkyWall(wallVerts, &Surf); } } else { // Only the frontsector is sky, just draw a skywall from the front ceiling - wallVerts[0].y = FIXED_TO_FLOAT(worldtop); - wallVerts[1].y = FIXED_TO_FLOAT(worldtopslope); + wallVerts[0].y = FixedToFloat(worldtop); + wallVerts[1].y = FixedToFloat(worldtopslope); HWR_DrawSkyWall(wallVerts, &Surf); } } else if (gl_backsector->ceilingpic == skyflatnum) { // Only the backsector is sky, just draw a skywall from the front ceiling - wallVerts[0].y = FIXED_TO_FLOAT(worldtop); - wallVerts[1].y = FIXED_TO_FLOAT(worldtopslope); + wallVerts[0].y = FixedToFloat(worldtop); + wallVerts[1].y = FixedToFloat(worldtopslope); HWR_DrawSkyWall(wallVerts, &Surf); } // Sky Floors - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(INT32_MIN); + wallVerts[0].y = wallVerts[1].y = FixedToFloat(INT32_MIN); if (gl_frontsector->floorpic == skyflatnum) { @@ -1460,24 +1457,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // Removing the second line above will render more rarely visible skywalls. Example: Cave garden ceiling in Dark race && !(gl_sidedef->bottomtexture)) { - wallVerts[3].y = FIXED_TO_FLOAT(worldlow); - wallVerts[2].y = FIXED_TO_FLOAT(worldlowslope); + wallVerts[3].y = FixedToFloat(worldlow); + wallVerts[2].y = FixedToFloat(worldlowslope); HWR_DrawSkyWall(wallVerts, &Surf); } } else { // Only the backsector has sky, just draw a skywall from the back floor - wallVerts[3].y = FIXED_TO_FLOAT(worldbottom); - wallVerts[2].y = FIXED_TO_FLOAT(worldbottomslope); + wallVerts[3].y = FixedToFloat(worldbottom); + wallVerts[2].y = FixedToFloat(worldbottomslope); HWR_DrawSkyWall(wallVerts, &Surf); } } else if ((gl_backsector->floorpic == skyflatnum) && !(gl_sidedef->bottomtexture)) { // Only the backsector has sky, just draw a skywall from the back floor if there's no bottomtexture - wallVerts[3].y = FIXED_TO_FLOAT(worldlow); - wallVerts[2].y = FIXED_TO_FLOAT(worldlowslope); + wallVerts[3].y = FixedToFloat(worldlow); + wallVerts[2].y = FixedToFloat(worldlowslope); HWR_DrawSkyWall(wallVerts, &Surf); } } @@ -1540,10 +1537,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom } // set top/bottom coords - wallVerts[3].y = FIXED_TO_FLOAT(worldtop); - wallVerts[0].y = FIXED_TO_FLOAT(worldhigh); - wallVerts[2].y = FIXED_TO_FLOAT(worldtopslope); - wallVerts[1].y = FIXED_TO_FLOAT(worldhighslope); + wallVerts[3].y = FixedToFloat(worldtop); + wallVerts[0].y = FixedToFloat(worldhigh); + wallVerts[2].y = FixedToFloat(worldtopslope); + wallVerts[1].y = FixedToFloat(worldhighslope); if (!gl_drawing_stencil && gl_frontsector->numlights) HWR_SplitWall(gl_frontsector, wallVerts, gl_toptexture, noencore, &Surf, FF_CUTLEVEL, NULL, 0); @@ -1601,10 +1598,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom } // set top/bottom coords - wallVerts[3].y = FIXED_TO_FLOAT(worldlow); - wallVerts[0].y = FIXED_TO_FLOAT(worldbottom); - wallVerts[2].y = FIXED_TO_FLOAT(worldlowslope); - wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope); + wallVerts[3].y = FixedToFloat(worldlow); + wallVerts[0].y = FixedToFloat(worldbottom); + wallVerts[2].y = FixedToFloat(worldlowslope); + wallVerts[1].y = FixedToFloat(worldbottomslope); if (!gl_drawing_stencil && gl_frontsector->numlights) HWR_SplitWall(gl_frontsector, wallVerts, gl_bottomtexture, noencore, &Surf, FF_CUTLEVEL, NULL, 0); @@ -1765,10 +1762,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // set top/bottom coords // Take the texture peg into account, rather than changing the offsets past // where the polygon might not be. - wallVerts[3].y = FIXED_TO_FLOAT(h); - wallVerts[0].y = FIXED_TO_FLOAT(l); - wallVerts[2].y = FIXED_TO_FLOAT(hS); - wallVerts[1].y = FIXED_TO_FLOAT(lS); + wallVerts[3].y = FixedToFloat(h); + wallVerts[0].y = FixedToFloat(l); + wallVerts[2].y = FixedToFloat(hS); + wallVerts[1].y = FixedToFloat(lS); // TODO: Actually use the surface's flags so that I don't have to do this FUINT blendmode = Surf.PolyFlags; @@ -1827,10 +1824,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom } //Set textures properly on single sided walls that are sloped - wallVerts[3].y = FIXED_TO_FLOAT(worldtop); - wallVerts[0].y = FIXED_TO_FLOAT(worldbottom); - wallVerts[2].y = FIXED_TO_FLOAT(worldtopslope); - wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope); + wallVerts[3].y = FixedToFloat(worldtop); + wallVerts[0].y = FixedToFloat(worldbottom); + wallVerts[2].y = FixedToFloat(worldtopslope); + wallVerts[1].y = FixedToFloat(worldbottomslope); if (gl_frontsector->numlights) { @@ -1847,10 +1844,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom else { //Set textures properly on single sided walls that are sloped - wallVerts[3].y = FIXED_TO_FLOAT(worldtop); - wallVerts[0].y = FIXED_TO_FLOAT(worldbottom); - wallVerts[2].y = FIXED_TO_FLOAT(worldtopslope); - wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope); + wallVerts[3].y = FixedToFloat(worldtop); + wallVerts[0].y = FixedToFloat(worldbottom); + wallVerts[2].y = FixedToFloat(worldtopslope); + wallVerts[1].y = FixedToFloat(worldbottomslope); // When there's no midtexture, draw a skywall to prevent rendering behind it HWR_DrawSkyWall(wallVerts, &Surf); @@ -1860,17 +1857,17 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { if (gl_frontsector->ceilingpic == skyflatnum) // It's a single-sided line with sky for its sector { - wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(INT32_MAX); // draw to top of map space - wallVerts[0].y = FIXED_TO_FLOAT(worldtop); - wallVerts[1].y = FIXED_TO_FLOAT(worldtopslope); + wallVerts[2].y = wallVerts[3].y = FixedToFloat(INT32_MAX); // draw to top of map space + wallVerts[0].y = FixedToFloat(worldtop); + wallVerts[1].y = FixedToFloat(worldtopslope); HWR_DrawSkyWall(wallVerts, &Surf); } if (gl_frontsector->floorpic == skyflatnum) { - wallVerts[3].y = FIXED_TO_FLOAT(worldbottom); - wallVerts[2].y = FIXED_TO_FLOAT(worldbottomslope); - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(INT32_MIN); // draw to bottom of map space + wallVerts[3].y = FixedToFloat(worldbottom); + wallVerts[2].y = FixedToFloat(worldbottomslope); + wallVerts[0].y = wallVerts[1].y = FixedToFloat(INT32_MIN); // draw to bottom of map space HWR_DrawSkyWall(wallVerts, &Surf); } @@ -1940,10 +1937,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom //FIXME: check if peging is correct // set top/bottom coords - wallVerts[3].y = FIXED_TO_FLOAT(h); - wallVerts[2].y = FIXED_TO_FLOAT(hS); - wallVerts[0].y = FIXED_TO_FLOAT(l); - wallVerts[1].y = FIXED_TO_FLOAT(lS); + wallVerts[3].y = FixedToFloat(h); + wallVerts[2].y = FixedToFloat(hS); + wallVerts[0].y = FixedToFloat(l); + wallVerts[1].y = FixedToFloat(lS); if (roverflags & FF_FOG) { @@ -2090,10 +2087,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom //FIXME: check if peging is correct // set top/bottom coords - wallVerts[3].y = FIXED_TO_FLOAT(h); - wallVerts[2].y = FIXED_TO_FLOAT(hS); - wallVerts[0].y = FIXED_TO_FLOAT(l); - wallVerts[1].y = FIXED_TO_FLOAT(lS); + wallVerts[3].y = FixedToFloat(h); + wallVerts[2].y = FixedToFloat(hS); + wallVerts[0].y = FixedToFloat(l); + wallVerts[1].y = FixedToFloat(lS); if (roverflags & FF_FOG) { @@ -2187,8 +2184,8 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector) if (LIKELY(gl_curline->pv1)) { - v1x = FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv1)->x); - v1y = FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv1)->y); + v1x = FloatToFixed(((polyvertex_t *)gl_curline->pv1)->x); + v1y = FloatToFixed(((polyvertex_t *)gl_curline->pv1)->y); } else { @@ -2198,8 +2195,8 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector) if (LIKELY(gl_curline->pv2)) { - v2x = FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv2)->x); - v2y = FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv2)->y); + v2x = FloatToFixed(((polyvertex_t *)gl_curline->pv2)->x); + v2y = FloatToFixed(((polyvertex_t *)gl_curline->pv2)->y); } else { @@ -2208,11 +2205,8 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector) } #define SLOPEPARAMS(slope, end1, end2, normalheight) \ - if (slope) { \ - end1 = P_GetZAt(slope, v1x, v1y); \ - end2 = P_GetZAt(slope, v2x, v2y); \ - } else \ - end1 = end2 = normalheight; + end1 = P_GetZAt(slope, v1x, v1y, normalheight); \ + end2 = P_GetZAt(slope, v2x, v2y, normalheight); SLOPEPARAMS(afrontsector->f_slope, frontf1, frontf2, afrontsector->floorheight) SLOPEPARAMS(afrontsector->c_slope, frontc1, frontc2, afrontsector->ceilingheight) @@ -2326,8 +2320,8 @@ static void HWR_AddLine(seg_t *line) if (LIKELY(gl_curline->pv1)) { - v1x = FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv1)->x); - v1y = FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv1)->y); + v1x = FloatToFixed(((polyvertex_t *)gl_curline->pv1)->x); + v1y = FloatToFixed(((polyvertex_t *)gl_curline->pv1)->y); } else { @@ -2337,8 +2331,8 @@ static void HWR_AddLine(seg_t *line) if (LIKELY(gl_curline->pv2)) { - v2x = FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv2)->x); - v2y = FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv2)->y); + v2x = FloatToFixed(((polyvertex_t *)gl_curline->pv2)->x); + v2y = FloatToFixed(((polyvertex_t *)gl_curline->pv2)->y); } else { @@ -2586,7 +2580,7 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, Z_Malloc(numAllocedPlaneVerts * sizeof (FOutVector), PU_LEVEL, &planeVerts); } - height = FIXED_TO_FLOAT(fixedheight); + height = FixedToFloat(fixedheight); len = W_LumpLength(lumpnum); @@ -2623,8 +2617,8 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, } // reference point for flat texture coord for each vertex around the polygon - flatxref = FIXED_TO_FLOAT(polysector->origVerts[0].x); - flatyref = FIXED_TO_FLOAT(polysector->origVerts[0].y); + flatxref = FixedToFloat(polysector->origVerts[0].x); + flatyref = FixedToFloat(polysector->origVerts[0].y); flatxref = (float)(((fixed_t)flatxref & (~flatflag)) / fflatsize); flatyref = (float)(((fixed_t)flatyref & (~flatflag)) / fflatsize); @@ -2636,14 +2630,14 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, { if (!isceiling) // it's a floor { - scrollx = FIXED_TO_FLOAT(FOFsector->floor_xoffs)/fflatsize; - scrolly = FIXED_TO_FLOAT(FOFsector->floor_yoffs)/fflatsize; + scrollx = FixedToFloat(FOFsector->floor_xoffs)/fflatsize; + scrolly = FixedToFloat(FOFsector->floor_yoffs)/fflatsize; angle = FOFsector->floorpic_angle>>ANGLETOFINESHIFT; } else // it's a ceiling { - scrollx = FIXED_TO_FLOAT(FOFsector->ceiling_xoffs)/fflatsize; - scrolly = FIXED_TO_FLOAT(FOFsector->ceiling_yoffs)/fflatsize; + scrollx = FixedToFloat(FOFsector->ceiling_xoffs)/fflatsize; + scrolly = FixedToFloat(FOFsector->ceiling_yoffs)/fflatsize; angle = FOFsector->ceilingpic_angle>>ANGLETOFINESHIFT; } } @@ -2651,14 +2645,14 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, { if (!isceiling) // it's a floor { - scrollx = FIXED_TO_FLOAT(gl_frontsector->floor_xoffs)/fflatsize; - scrolly = FIXED_TO_FLOAT(gl_frontsector->floor_yoffs)/fflatsize; + scrollx = FixedToFloat(gl_frontsector->floor_xoffs)/fflatsize; + scrolly = FixedToFloat(gl_frontsector->floor_yoffs)/fflatsize; angle = gl_frontsector->floorpic_angle>>ANGLETOFINESHIFT; } else // it's a ceiling { - scrollx = FIXED_TO_FLOAT(gl_frontsector->ceiling_xoffs)/fflatsize; - scrolly = FIXED_TO_FLOAT(gl_frontsector->ceiling_yoffs)/fflatsize; + scrollx = FixedToFloat(gl_frontsector->ceiling_xoffs)/fflatsize; + scrolly = FixedToFloat(gl_frontsector->ceiling_yoffs)/fflatsize; angle = gl_frontsector->ceilingpic_angle>>ANGLETOFINESHIFT; } } @@ -2666,37 +2660,37 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, if (angle) // Only needs to be done if there's an altered angle { // This needs to be done so that it scrolls in a different direction after rotation like software - tempxsow = FLOAT_TO_FIXED(scrollx); - tempytow = FLOAT_TO_FIXED(scrolly); - scrollx = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); - scrolly = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle)))); + tempxsow = FloatToFixed(scrollx); + tempytow = FloatToFixed(scrolly); + scrollx = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); + scrolly = (FixedToFloat(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle)))); // This needs to be done so everything aligns after rotation // It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does - tempxsow = FLOAT_TO_FIXED(flatxref); - tempytow = FLOAT_TO_FIXED(flatyref); - flatxref = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); - flatyref = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle)))); + tempxsow = FloatToFixed(flatxref); + tempytow = FloatToFixed(flatyref); + flatxref = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); + flatyref = (FixedToFloat(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle)))); } for (i = 0; i < (INT32)nrPlaneVerts; i++,v3d++) { // Hurdler: add scrolling texture on floor/ceiling - v3d->s = (float)((FIXED_TO_FLOAT(polysector->origVerts[i].x) / fflatsize) - flatxref + scrollx); // Go from the polysector's original vertex locations - v3d->t = (float)(flatyref - (FIXED_TO_FLOAT(polysector->origVerts[i].y) / fflatsize) + scrolly); // Means the flat is offset based on the original vertex locations + v3d->s = (float)((FixedToFloat(polysector->origVerts[i].x) / fflatsize) - flatxref + scrollx); // Go from the polysector's original vertex locations + v3d->t = (float)(flatyref - (FixedToFloat(polysector->origVerts[i].y) / fflatsize) + scrolly); // Means the flat is offset based on the original vertex locations // Need to rotate before translate if (angle) // Only needs to be done if there's an altered angle { - tempxsow = FLOAT_TO_FIXED(v3d->s); - tempytow = FLOAT_TO_FIXED(v3d->t); - v3d->s = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); - v3d->t = (FIXED_TO_FLOAT(-FixedMul(tempxsow, FINESINE(angle)) - FixedMul(tempytow, FINECOSINE(angle)))); + tempxsow = FloatToFixed(v3d->s); + tempytow = FloatToFixed(v3d->t); + v3d->s = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); + v3d->t = (FixedToFloat(-FixedMul(tempxsow, FINESINE(angle)) - FixedMul(tempytow, FINECOSINE(angle)))); } - v3d->x = FIXED_TO_FLOAT(polysector->vertices[i]->x); + v3d->x = FixedToFloat(polysector->vertices[i]->x); v3d->y = height; - v3d->z = FIXED_TO_FLOAT(polysector->vertices[i]->y); + v3d->z = FixedToFloat(polysector->vertices[i]->y); } HWR_Lighting(&Surf, lightlevel, planecolormap, P_SectorUsesDirectionalLighting((FOFsector != NULL) ? FOFsector : gl_frontsector)); @@ -2796,7 +2790,7 @@ static boolean HWR_DoCulling(line_t *cullheight, line_t *viewcullheight, float v if (!cullheight) return false; - cullplane = FIXED_TO_FLOAT(cullheight->frontsector->floorheight); + cullplane = FixedToFloat(cullheight->frontsector->floorheight); if (cullheight->flags & ML_NOCLIMB) // Group culling { @@ -2994,7 +2988,7 @@ static void HWR_Subsector(size_t num) if (gl_frontsector->cullheight) { - if (HWR_DoCulling(gl_frontsector->cullheight, viewsector->cullheight, gl_viewz, FIXED_TO_FLOAT(*rover->bottomheight), FIXED_TO_FLOAT(*rover->topheight))) + if (HWR_DoCulling(gl_frontsector->cullheight, viewsector->cullheight, gl_viewz, FixedToFloat(*rover->bottomheight), FixedToFloat(*rover->topheight))) continue; } @@ -3328,9 +3322,9 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, GLPatch_t *gpatch) // technically this_scale gets multiplied and added to sprite y/x scale, but this thing needs it for some crap so ill just throw it in here again const boolean hires = (spr->mobj && spr->mobj->skin && K_GetMobjSkin(spr->mobj)->flags & SF_HIRES); if (spr->mobj) - this_scale = FIXED_TO_FLOAT(spr->mobj->scale); + this_scale = FixedToFloat(spr->mobj->scale); if (hires) - this_scale = this_scale * FIXED_TO_FLOAT(K_GetMobjSkin(spr->mobj)->highresscale); + this_scale = this_scale * FixedToFloat(K_GetMobjSkin(spr->mobj)->highresscale); R_GetShadowZ(spr->mobj, &floorslope); @@ -3432,8 +3426,8 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, GLPatch_t *gpatch) { for (int i = 0; i < 4; i++) { - slopez = P_GetZAt(floorslope, FLOAT_TO_FIXED(swallVerts[i].x), FLOAT_TO_FIXED(swallVerts[i].z)); - swallVerts[i].y = FIXED_TO_FLOAT(slopez) + 0.05f; + slopez = P_GetSlopeZAt(floorslope, FloatToFixed(swallVerts[i].x), FloatToFixed(swallVerts[i].z)); + swallVerts[i].y = FixedToFloat(slopez) + 0.05f; } } @@ -3526,11 +3520,11 @@ static void HWR_RotateSpritePolyToAim(gl_vissprite_t *spr, FOutVector *wallVerts if (!precip && P_MobjFlip(spr->mobj) == -1) // precip doesn't have eflags so they can't flip { - basey = FIXED_TO_FLOAT(interp.z + spr->mobj->height); + basey = FixedToFloat(interp.z + spr->mobj->height); } else { - basey = FIXED_TO_FLOAT(interp.z); + basey = FixedToFloat(interp.z); } lowy = wallVerts[0].y; @@ -3623,10 +3617,10 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite) baseWallVerts[2].y = baseWallVerts[3].y = spr->gzt; baseWallVerts[0].y = baseWallVerts[1].y = spr->gz; - v1x = FLOAT_TO_FIXED(spr->x1); - v1y = FLOAT_TO_FIXED(spr->z1); - v2x = FLOAT_TO_FIXED(spr->x2); - v2y = FLOAT_TO_FIXED(spr->z2); + v1x = FloatToFixed(spr->x1); + v1y = FloatToFixed(spr->z1); + v2x = FloatToFixed(spr->x2); + v2y = FloatToFixed(spr->z2); if (spr->flip) { @@ -3712,7 +3706,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite) colormap = list[sector->numlights - 1].extra_colormap; i = 0; - temp = FLOAT_TO_FIXED(realtop); + temp = FloatToFixed(realtop); lightset = HWR_OverrideObjectLightLevel(spr->mobj, &lightlevel); @@ -3751,9 +3745,9 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite) if (i + 1 < sector->numlights) { temp = P_GetLightZAt(&list[i+1], v1x, v1y); - bheight = FIXED_TO_FLOAT(temp); + bheight = FixedToFloat(temp); temp = P_GetLightZAt(&list[i+1], v2x, v2y); - endbheight = FIXED_TO_FLOAT(temp); + endbheight = FixedToFloat(temp); } else { @@ -4644,8 +4638,8 @@ static void HWR_ProjectSprite(mobj_t *thing) } // transform the origin point - tr_x = FIXED_TO_FLOAT(interp.x); - tr_y = FIXED_TO_FLOAT(interp.y); + tr_x = FixedToFloat(interp.x); + tr_y = FixedToFloat(interp.y); // rotation around vertical axis tz = ((tr_x - gl_viewx) * gl_viewcos) + ((tr_y - gl_viewy) * gl_viewsin); @@ -4658,9 +4652,9 @@ static void HWR_ProjectSprite(mobj_t *thing) const boolean vflip = (thing->eflags & MFE_VERTICALFLIP); const boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored); - this_scale = FIXED_TO_FLOAT(interp.scale); - spritexscale = FIXED_TO_FLOAT(interp.spritexscale); - spriteyscale = FIXED_TO_FLOAT(interp.spriteyscale); + this_scale = FixedToFloat(interp.scale); + spritexscale = FixedToFloat(interp.spritexscale); + spriteyscale = FixedToFloat(interp.spriteyscale); // decide which patch to use for sprite relative to player #ifdef RANGECHECK @@ -4761,7 +4755,7 @@ static void HWR_ProjectSprite(mobj_t *thing) } if ((thing->skin || thing->localskin) && K_GetMobjSkin(thing)->flags & SF_HIRES) - this_scale *= FIXED_TO_FLOAT(K_GetMobjSkin(thing)->highresscale); + this_scale *= FixedToFloat(K_GetMobjSkin(thing)->highresscale); spr_width = spritecachedinfo[lumpoff].width; spr_height = spritecachedinfo[lumpoff].height; @@ -4809,13 +4803,13 @@ static void HWR_ProjectSprite(mobj_t *thing) if (papersprite) { - rightsin = FIXED_TO_FLOAT(FINESINE(interp.angle >> ANGLETOFINESHIFT)); - rightcos = FIXED_TO_FLOAT(FINECOSINE(interp.angle >> ANGLETOFINESHIFT)); + rightsin = FixedToFloat(FINESINE(interp.angle >> ANGLETOFINESHIFT)); + rightcos = FixedToFloat(FINECOSINE(interp.angle >> ANGLETOFINESHIFT)); } else { - rightsin = FIXED_TO_FLOAT(FINESINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT)); - rightcos = FIXED_TO_FLOAT(FINECOSINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT)); + rightsin = FixedToFloat(FINESINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT)); + rightcos = FixedToFloat(FINECOSINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT)); } spritexscale *= this_scale; @@ -4825,13 +4819,13 @@ static void HWR_ProjectSprite(mobj_t *thing) if (flip) { - x1 = (FIXED_TO_FLOAT(spr_width - spr_offset) * spritexscale); - x2 = (FIXED_TO_FLOAT(spr_offset) * spritexscale); + x1 = (FixedToFloat(spr_width - spr_offset) * spritexscale); + x2 = (FixedToFloat(spr_offset) * spritexscale); } else { - x1 = (FIXED_TO_FLOAT(spr_offset) * spritexscale); - x2 = (FIXED_TO_FLOAT(spr_width - spr_offset) * spritexscale); + x1 = (FixedToFloat(spr_offset) * spritexscale); + x2 = (FixedToFloat(spr_width - spr_offset) * spritexscale); } z1 = tr_y + x1 * rightsin; @@ -4841,13 +4835,13 @@ static void HWR_ProjectSprite(mobj_t *thing) if (vflip) { - gz = FIXED_TO_FLOAT(interp.z + thing->height) - (FIXED_TO_FLOAT(spr_topoffset) * spriteyscale); - gzt = gz + (FIXED_TO_FLOAT(spr_height) * spriteyscale); + gz = FixedToFloat(interp.z + thing->height) - (FixedToFloat(spr_topoffset) * spriteyscale); + gzt = gz + (FixedToFloat(spr_height) * spriteyscale); } else { - gzt = FIXED_TO_FLOAT(interp.z) + (FIXED_TO_FLOAT(spr_topoffset) * spriteyscale); - gz = gzt - (FIXED_TO_FLOAT(spr_height) * spriteyscale); + gzt = FixedToFloat(interp.z) + (FixedToFloat(spr_topoffset) * spriteyscale); + gz = gzt - (FixedToFloat(spr_height) * spriteyscale); } if (thing->subsector->sector->cullheight) @@ -4864,13 +4858,13 @@ static void HWR_ProjectSprite(mobj_t *thing) if (heightsec != -1 && phs != -1) // only clip things which are in special sectors { - if (gl_viewz < FIXED_TO_FLOAT(sectors[phs].floorheight) ? - FIXED_TO_FLOAT(interp.z) >= FIXED_TO_FLOAT(sectors[heightsec].floorheight) : - gzt < FIXED_TO_FLOAT(sectors[heightsec].floorheight)) + if (gl_viewz < FixedToFloat(sectors[phs].floorheight) ? + FixedToFloat(interp.z) >= FixedToFloat(sectors[heightsec].floorheight) : + gzt < FixedToFloat(sectors[heightsec].floorheight)) return; - if (gl_viewz > FIXED_TO_FLOAT(sectors[phs].ceilingheight) ? - gzt < FIXED_TO_FLOAT(sectors[heightsec].ceilingheight) && gl_viewz >= FIXED_TO_FLOAT(sectors[heightsec].ceilingheight) : - FIXED_TO_FLOAT(interp.z) >= FIXED_TO_FLOAT(sectors[heightsec].ceilingheight)) + if (gl_viewz > FixedToFloat(sectors[phs].ceilingheight) ? + gzt < FixedToFloat(sectors[heightsec].ceilingheight) && gl_viewz >= FixedToFloat(sectors[heightsec].ceilingheight) : + FixedToFloat(interp.z) >= FixedToFloat(sectors[heightsec].ceilingheight)) return; } @@ -4889,8 +4883,8 @@ static void HWR_ProjectSprite(mobj_t *thing) vis->scale = this_scale; vis->spritexscale = spritexscale; vis->spriteyscale = spriteyscale; - vis->spritexoffset = FIXED_TO_FLOAT(spr_offset); - vis->spriteyoffset = FIXED_TO_FLOAT(spr_topoffset); + vis->spritexoffset = FixedToFloat(spr_offset); + vis->spriteyoffset = FixedToFloat(spr_topoffset); #ifdef ROTSPRITE if (rotsprite != NULL) @@ -4992,8 +4986,8 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) } // transform the origin point - tr_x = FIXED_TO_FLOAT(interp.x); - tr_y = FIXED_TO_FLOAT(interp.y); + tr_x = FixedToFloat(interp.x); + tr_y = FixedToFloat(interp.y); // rotation around vertical axis tz = ((tr_x - gl_viewx) * gl_viewcos) + ((tr_y - gl_viewy) * gl_viewsin); @@ -5025,7 +5019,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) #endif } - this_scale = FIXED_TO_FLOAT(interp.scale); + this_scale = FixedToFloat(interp.scale); sprframe = &sprdef->spriteframes[thing->frame & FF_FRAMEMASK]; @@ -5033,18 +5027,18 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) lumpoff = sprframe->lumpid[0]; flip = sprframe->flip; // Will only be 0x00 or 0xFF - rightsin = FIXED_TO_FLOAT(FINESINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT)); - rightcos = FIXED_TO_FLOAT(FINECOSINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT)); + rightsin = FixedToFloat(FINESINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT)); + rightcos = FixedToFloat(FINECOSINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT)); if (flip) { - x1 = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width - spritecachedinfo[lumpoff].offset); - x2 = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].offset); + x1 = FixedToFloat(spritecachedinfo[lumpoff].width - spritecachedinfo[lumpoff].offset); + x2 = FixedToFloat(spritecachedinfo[lumpoff].offset); } else { - x1 = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].offset); - x2 = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width - spritecachedinfo[lumpoff].offset); + x1 = FixedToFloat(spritecachedinfo[lumpoff].offset); + x2 = FixedToFloat(spritecachedinfo[lumpoff].width - spritecachedinfo[lumpoff].offset); } x1 *= this_scale; @@ -5077,8 +5071,8 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) #endif // set top/bottom coords - vis->gzt = FIXED_TO_FLOAT(interp.z) + (FIXED_TO_FLOAT(spritecachedinfo[lumpoff].topoffset) * this_scale); - vis->gz = vis->gzt - (FIXED_TO_FLOAT(spritecachedinfo[lumpoff].height) * this_scale); + vis->gzt = FixedToFloat(interp.z) + (FixedToFloat(spritecachedinfo[lumpoff].topoffset) * this_scale); + vis->gz = vis->gzt - (FixedToFloat(spritecachedinfo[lumpoff].height) * this_scale); vis->precip = true; } @@ -5313,7 +5307,7 @@ static void HWR_SetTransformAiming(FTransform *trans) if (cv_glshearing.value) { fixed_t fixedaiming = AIMINGTODY(aimingangle); - trans->viewaiming = FIXED_TO_FLOAT(fixedaiming); + trans->viewaiming = FixedToFloat(fixedaiming); trans->shearing = true; gl_aimingangle = 0; } @@ -5330,11 +5324,11 @@ void HWR_SetTransform(float fpov) UINT8 viewnum = R_GetViewNumber(); camera_t *thiscam = &camera[viewnum]; - gl_viewx = FIXED_TO_FLOAT(viewx); - gl_viewy = FIXED_TO_FLOAT(viewy); - gl_viewz = FIXED_TO_FLOAT(viewz); - gl_viewsin = FIXED_TO_FLOAT(viewsin); - gl_viewcos = FIXED_TO_FLOAT(viewcos); + gl_viewx = FixedToFloat(viewx); + gl_viewy = FixedToFloat(viewy); + gl_viewz = FixedToFloat(viewz); + gl_viewsin = FixedToFloat(viewsin); + gl_viewcos = FixedToFloat(viewcos); memset(&atransform, 0x00, sizeof(FTransform)); @@ -5350,8 +5344,8 @@ void HWR_SetTransform(float fpov) HWR_SetTransformAiming(&atransform); atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(FINEDEGREE); - gl_viewludsin = FIXED_TO_FLOAT(FINECOSINE(gl_aimingangle>>ANGLETOFINESHIFT)); - gl_viewludcos = FIXED_TO_FLOAT(-FINESINE(gl_aimingangle>>ANGLETOFINESHIFT)); + gl_viewludsin = FixedToFloat(FINECOSINE(gl_aimingangle>>ANGLETOFINESHIFT)); + gl_viewludcos = FixedToFloat(-FINESINE(gl_aimingangle>>ANGLETOFINESHIFT)); atransform.fovangle = fpov; // Tails HWR_RollTransform(&atransform, viewroll); @@ -6003,7 +5997,7 @@ static void HWR_DoPostProcessor(player_t *player) { // 10 by 10 grid. 2 coordinates (xy) float v[SCREENVERTS][SCREENVERTS][2]; - float disStart = (leveltime-1) + FIXED_TO_FLOAT(rendertimefrac); + float disStart = (leveltime-1) + FixedToFloat(rendertimefrac); UINT8 x, y; INT32 WAVELENGTH; diff --git a/src/k_kart.c b/src/k_kart.c index a871f74bc..344c1ace2 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3720,7 +3720,8 @@ void K_SpawnBoostTrail(player_t *player) if (player->mo->standingslope) { - ground = P_GetZAt(player->mo->standingslope, newx, newy); + ground = P_GetSlopeZAt(player->mo->standingslope, newx, newy); + if (player->mo->eflags & MFE_VERTICALFLIP) ground -= FixedMul(mobjinfo[MT_SNEAKERTRAIL].height, player->mo->scale); } @@ -4830,12 +4831,7 @@ static fixed_t K_BananaSlopeZ(pslope_t *slope, fixed_t x, fixed_t y, fixed_t z, testy += y; } - if (slope) - { - slopez = P_GetZAt(slope, testx, testy); - } - else - slopez = z; + slopez = P_GetZAt(slope, testx, testy, z); return slopez; } diff --git a/src/lua_baselib.c b/src/lua_baselib.c index f125bbc11..df949149e 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1767,7 +1767,7 @@ static int lib_pGetZAt(lua_State *L) if (!slope) return LUA_ErrInvalid(L, "pslope_t"); - lua_pushfixed(L, P_GetZAt(slope, x, y)); + lua_pushfixed(L, P_GetSlopeZAt(slope, x, y)); return 1; } diff --git a/src/m_cheat.c b/src/m_cheat.c index 5f8648cbd..1cdb57419 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -864,7 +864,7 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling) { // Truncate position to match where mapthing would be when spawned // (this applies to every further P_GetZAt call as well) - fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->ceilingheight; + fixed_t cheight = P_GetSectorCeilingZAt(sec, (player->mo->x & 0xFFFF0000), (player->mo->y & 0xFFFF0000)); if (((cheight - player->mo->z - player->mo->height)>>FRACBITS) >= (1 << (16-ZSHIFT))) { @@ -875,7 +875,8 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling) } else { - fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight; + fixed_t fheight = P_GetSectorFloorZAt(sec, (player->mo->x & 0xFFFF0000), (player->mo->y & 0xFFFF0000)); + if (((player->mo->z - fheight)>>FRACBITS) >= (1 << (16-ZSHIFT))) { CONS_Printf(M_GetText("Sorry, you're too %s to place this object (max: %d %s).\n"), M_GetText("high"), @@ -922,12 +923,12 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c mt->y = (INT16)(player->mo->y>>FRACBITS); if (ceiling) { - fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, mt->x << FRACBITS, mt->y << FRACBITS) : sec->ceilingheight; + fixed_t cheight = P_GetSectorCeilingZAt(sec, (mt->x << FRACBITS), (mt->y << FRACBITS)); mt->options = (UINT16)((cheight - player->mo->z - player->mo->height)>>FRACBITS); } else { - fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, mt->x << FRACBITS, mt->y << FRACBITS) : sec->floorheight; + fixed_t fheight = P_GetSectorFloorZAt(sec, (mt->x << FRACBITS), (mt->y << FRACBITS)); mt->options = (UINT16)((player->mo->z - fheight)>>FRACBITS); } mt->options <<= ZSHIFT; @@ -984,8 +985,7 @@ void OP_NightsObjectplace(player_t *player) UINT16 angle = (UINT16)(player->anotherflyangle % 360); INT16 temp = (INT16)FixedInt(AngleFixed(player->mo->angle)); // Traditional 2D Angle sector_t *sec = player->mo->subsector->sector; - fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight; - + fixed_t fheight = P_GetSectorFloorZAt(sec, (player->mo->x & 0xFFFF0000), (player->mo->y & 0xFFFF0000)); player->pflags |= PF_ATTACKDOWN; @@ -1141,12 +1141,12 @@ void OP_ObjectplaceMovement(player_t *player) if (!!(mobjinfo[op_currentthing].flags & MF_SPAWNCEILING) ^ !!(cv_opflags.value & MTF_OBJECTFLIP)) { - fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->ceilingheight; + fixed_t cheight = P_GetSectorCeilingZAt(sec, (player->mo->x & 0xFFFF0000), (player->mo->y & 0xFFFF0000)); op_displayflags = (UINT16)((cheight - player->mo->z - mobjinfo[op_currentthing].height)>>FRACBITS); } else { - fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight; + fixed_t fheight = P_GetSectorFloorZAt(sec, (player->mo->x & 0xFFFF0000), (player->mo->y & 0xFFFF0000)); op_displayflags = (UINT16)((player->mo->z - fheight)>>FRACBITS); } op_displayflags <<= ZSHIFT; diff --git a/src/p_map.c b/src/p_map.c index 91b15d8ab..aacbb2e6e 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1699,7 +1699,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) INT32 xl, xh, yl, yh, bx, by; subsector_t *newsubsec; boolean blockval = true; - + ps_checkposition_calls.value.i++; I_Assert(thing != NULL); @@ -4102,10 +4102,7 @@ void P_MapEnd(void) fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height) { sector_t *sec = R_PointInSubsector(x, y)->sector; - fixed_t floorz = sec->floorheight; - - if (sec->f_slope) - floorz = P_GetZAt(sec->f_slope, x, y); + fixed_t floorz = P_GetSectorFloorZAt(sec, x, y); // Intercept the stupid 'fall through 3dfloors' bug Tails 03-17-2002 if (sec->ffloors) @@ -4116,19 +4113,15 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height) for (rover = sec->ffloors; rover; rover = rover->next) { fixed_t topheight, bottomheight; + if (!(rover->flags & FF_EXISTS)) continue; if ((!(rover->flags & FF_SOLID || rover->flags & FF_QUICKSAND) || (rover->flags & FF_SWIMMABLE))) continue; - topheight = *rover->topheight; - bottomheight = *rover->bottomheight; - - if (*rover->t_slope) - topheight = P_GetZAt(*rover->t_slope, x, y); - if (*rover->b_slope) - bottomheight = P_GetZAt(*rover->b_slope, x, y); + topheight = P_GetFFloorTopZAt (rover, x, y); + bottomheight = P_GetFFloorBottomZAt(rover, x, y); if (rover->flags & FF_QUICKSAND) { @@ -4142,6 +4135,7 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height) delta1 = z - (bottomheight + ((topheight - bottomheight)/2)); delta2 = thingtop - (bottomheight + ((topheight - bottomheight)/2)); + if (topheight > floorz && abs(delta1) < abs(delta2)) floorz = topheight; } diff --git a/src/p_mobj.c b/src/p_mobj.c index fa4d2c099..a743f05fc 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -502,12 +502,12 @@ static fixed_t HighestOnLine(fixed_t radius, fixed_t x, fixed_t y, line_t *line, /*CONS_Printf("BEFORE: v1 = %f %f %f\n", FIXED_TO_FLOAT(v1.x), FIXED_TO_FLOAT(v1.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) + FIXED_TO_FLOAT(P_GetSlopeZAt(slope, v1.x, v1.y)) ); CONS_Printf(" v2 = %f %f %f\n", FIXED_TO_FLOAT(v2.x), FIXED_TO_FLOAT(v2.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) + FIXED_TO_FLOAT(P_GetSlopeZAt(slope, v2.x, v2.y)) );*/ if (abs(v1.x-x) > radius) { @@ -565,24 +565,24 @@ static fixed_t HighestOnLine(fixed_t radius, fixed_t x, fixed_t y, line_t *line, /*CONS_Printf("AFTER: v1 = %f %f %f\n", FIXED_TO_FLOAT(v1.x), FIXED_TO_FLOAT(v1.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) + FIXED_TO_FLOAT(P_GetSlopeZAt(slope, v1.x, v1.y)) ); CONS_Printf(" v2 = %f %f %f\n", FIXED_TO_FLOAT(v2.x), FIXED_TO_FLOAT(v2.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) + FIXED_TO_FLOAT(P_GetSlopeZAt(slope, v2.x, v2.y)) );*/ // Return the higher of the two points if (actuallylowest) return min( - P_GetZAt(slope, v1.x, v1.y), - P_GetZAt(slope, v2.x, v2.y) + P_GetSlopeZAt(slope, v1.x, v1.y), + P_GetSlopeZAt(slope, v2.x, v2.y) ); else return max( - P_GetZAt(slope, v1.x, v1.y), - P_GetZAt(slope, v2.x, v2.y) + P_GetSlopeZAt(slope, v1.x, v1.y), + P_GetSlopeZAt(slope, v2.x, v2.y) ); } @@ -618,7 +618,7 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t // If the highest point is in the sector, then we have it easy! Just get the Z at that point if (R_PointInSubsector(testx, testy)->sector == (boundsec ? boundsec : sector)) - return P_GetZAt(slope, testx, testy); + return P_GetSlopeZAt(slope, testx, testy); // If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point if (perfect) @@ -657,7 +657,7 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t // If we're just testing for base sector location (no collision line), just go for the center's spot... // It'll get fixed when we test for collision anyway, and the final result can't be lower than this if (line == NULL) - return P_GetZAt(slope, x, y); + return P_GetSlopeZAt(slope, x, y); return HighestOnLine(mobj->radius, x, y, line, slope, lowest); } @@ -697,7 +697,7 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed // If the highest point is in the sector, then we have it easy! Just get the Z at that point if (R_PointInSubsector(testx, testy)->sector == (boundsec ? boundsec : sector)) - return P_GetZAt(slope, testx, testy); + return P_GetSlopeZAt(slope, testx, testy); // If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point if (perfect) @@ -736,7 +736,7 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed // If we're just testing for base sector location (no collision line), just go for the center's spot... // It'll get fixed when we test for collision anyway, and the final result can't be lower than this if (line == NULL) - return P_GetZAt(slope, x, y); + return P_GetSlopeZAt(slope, x, y); return HighestOnLine(mobj->radius, x, y, line, slope, lowest); } @@ -777,7 +777,7 @@ fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fix // If the highest point is in the sector, then we have it easy! Just get the Z at that point if (R_PointInSubsector(testx, testy)->sector == (boundsec ? boundsec : sector)) - return P_GetZAt(slope, testx, testy); + return P_GetSlopeZAt(slope, testx, testy); // If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point if (perfect) @@ -816,7 +816,7 @@ fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fix // If we're just testing for base sector location (no collision line), just go for the center's spot... // It'll get fixed when we test for collision anyway, and the final result can't be lower than this if (line == NULL) - return P_GetZAt(slope, x, y); + return P_GetSlopeZAt(slope, x, y); return HighestOnLine(mobj->radius, x, y, line, slope, lowest); } @@ -856,7 +856,7 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f // If the highest point is in the sector, then we have it easy! Just get the Z at that point if (R_PointInSubsector(testx, testy)->sector == (boundsec ? boundsec : sector)) - return P_GetZAt(slope, testx, testy); + return P_GetSlopeZAt(slope, testx, testy); // If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point if (perfect) @@ -895,7 +895,7 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f // If we're just testing for base sector location (no collision line), just go for the center's spot... // It'll get fixed when we test for collision anyway, and the final result can't be lower than this if (line == NULL) - return P_GetZAt(slope, x, y); + return P_GetSlopeZAt(slope, x, y); return HighestOnLine(mobj->radius, x, y, line, slope, lowest); } @@ -1918,9 +1918,7 @@ boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover) I_Assert(mo != NULL); I_Assert(!P_MobjWasRemoved(mo)); - fixed_t topheight = - *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : - *rover->topheight; + fixed_t topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y); if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3 && !(rover->master->flags & ML_BLOCKMONSTERS) @@ -2887,14 +2885,8 @@ void P_MobjCheckWater(mobj_t *mobj) || ((rover->flags & FF_BLOCKOTHERS) && !mobj->player))) continue; - topheight = *rover->topheight; - bottomheight = *rover->bottomheight; - - if (*rover->t_slope) - topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y); - - if (*rover->b_slope) - bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y); + topheight = P_GetFFloorTopZAt(rover, mobj->x, mobj->y); + bottomheight = P_GetFFloorBottomZAt(rover, mobj->x, mobj->y); if (mobj->eflags & MFE_VERTICALFLIP) { @@ -3112,14 +3104,8 @@ static void P_SceneryCheckWater(mobj_t *mobj) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKOTHERS) continue; - topheight = *rover->topheight; - bottomheight = *rover->bottomheight; - - if (*rover->t_slope) - topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y); - - if (*rover->b_slope) - bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y); + topheight = P_GetFFloorTopZAt(rover, mobj->x, mobj->y); + bottomheight = P_GetFFloorBottomZAt(rover, mobj->x, mobj->y); if (topheight <= mobj->z || bottomheight > (mobj->z + FixedMul(mobj->info->height >> 1, mobj->scale))) @@ -9471,12 +9457,8 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) // Make sure scale matches destscale immediately when spawned P_SetScale(mobj, mobj->destscale); - mobj->floorz = - mobj->subsector->sector->f_slope ? P_GetZAt(mobj->subsector->sector->f_slope, x, y) : - mobj->subsector->sector->floorheight; - mobj->ceilingz = - mobj->subsector->sector->c_slope ? P_GetZAt(mobj->subsector->sector->c_slope, x, y) : - mobj->subsector->sector->ceilingheight; + mobj->floorz = P_GetSectorFloorZAt(mobj->subsector->sector, x, y); + mobj->ceilingz = P_GetSectorCeilingZAt(mobj->subsector->sector, x, y); // Tells MobjCheckWater that the water height was not set. mobj->watertop = INT32_MAX; @@ -10542,9 +10524,8 @@ void P_RespawnSpecials(void) if (mthing->options & MTF_OBJECTFLIP) { - z = ( - ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) : - ss->sector->ceilingheight) - (mthing->options >> ZSHIFT) * FRACUNIT; + z = P_GetSectorCeilingZAt(ss->sector, x, y) - (mthing->options >> ZSHIFT) * FRACUNIT; + if (mthing->options & MTF_AMBUSH && (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || P_WeaponOrPanel(i))) z -= 24*FRACUNIT; @@ -10552,9 +10533,8 @@ void P_RespawnSpecials(void) } else { - z = ( - ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) : - ss->sector->floorheight) + (mthing->options >> ZSHIFT) * FRACUNIT; + z = P_GetSectorFloorZAt(ss->sector, x, y) + (mthing->options >> ZSHIFT) * FRACUNIT; + if (mthing->options & MTF_AMBUSH && (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || P_WeaponOrPanel(i))) z += 24*FRACUNIT; @@ -10853,14 +10833,9 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) //spawn at the origin as a desperation move if there is no mapthing // set Z height - sector = R_PointInSubsector(x, y)->sector; - - floor = - sector->f_slope ? P_GetZAt(sector->f_slope, x, y) : - sector->floorheight; - ceiling = - sector->c_slope ? P_GetZAt(sector->c_slope, x, y) : - sector->ceilingheight; + sector = R_PointInSubsector(x, y)->sector; + floor = P_GetSectorFloorZAt(sector, x, y); + ceiling = P_GetSectorCeilingZAt(sector, x, y); if (mthing) { @@ -10928,14 +10903,11 @@ void P_MovePlayerToStarpost(INT32 playernum) mobj->x = p->starpostx << FRACBITS; mobj->y = p->starposty << FRACBITS; P_SetThingPosition(mobj); - sector = R_PointInSubsector(mobj->x, mobj->y)->sector; - floor = - sector->f_slope ? P_GetZAt(sector->f_slope, mobj->x, mobj->y) : - sector->floorheight; - ceiling = - sector->c_slope ? P_GetZAt(sector->c_slope, mobj->x, mobj->y) : - sector->ceilingheight; + // set Z height + sector = R_PointInSubsector(mobj->x, mobj->y)->sector; + floor = P_GetSectorFloorZAt(sector, mobj->x, mobj->y); + ceiling = P_GetSectorCeilingZAt(sector, mobj->x, mobj->y); if (mobj->player->kartstuff[k_starpostflip]) z = (p->starpostz<height; @@ -11107,10 +11079,8 @@ void P_SpawnMapThing(mapthing_t *mthing) if (gametype != GT_COOP) return; - ss = R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS); - mthing->z = (INT16)((( - ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, mthing->x << FRACBITS, mthing->y << FRACBITS) : - ss->sector->floorheight)>>FRACBITS) + (mthing->options >> ZSHIFT)); + ss = R_PointInSubsector((mthing->x << FRACBITS), (mthing->y << FRACBITS)); + mthing->z = (INT16)((P_GetSectorFloorZAt(ss->sector, (mthing->x << FRACBITS), (mthing->y << FRACBITS)) >> FRACBITS) + (mthing->options >> ZSHIFT)); if (numhuntemeralds < MAXHUNTEMERALDS) huntemeralds[numhuntemeralds++] = mthing; @@ -11224,18 +11194,14 @@ void P_SpawnMapThing(mapthing_t *mthing) ss = R_PointInSubsector(x, y); if (i == MT_NIGHTSBUMPER) - z = ( - ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) : - ss->sector->floorheight) + ((mthing->options >> ZSHIFT) << FRACBITS); + z = P_GetSectorFloorZAt(ss->sector, x, y) + ((mthing->options >> ZSHIFT) << FRACBITS); else if (i == MT_AXIS || i == MT_AXISTRANSFER || i == MT_AXISTRANSFERLINE) z = ONFLOORZ; else if (i == MT_SPECIALSPIKEBALL || P_WeaponOrPanel(i) || i == MT_EMERALDSPAWN || i == MT_EMMY) { if (mthing->options & MTF_OBJECTFLIP) { - z = ( - ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) : - ss->sector->ceilingheight); + z = P_GetSectorCeilingZAt(ss->sector, x, y); if (mthing->options & MTF_AMBUSH) // Special flag for rings z -= 24*FRACUNIT; @@ -11246,9 +11212,7 @@ void P_SpawnMapThing(mapthing_t *mthing) } else { - z = ( - ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) : - ss->sector->floorheight); + z = P_GetSectorFloorZAt(ss->sector, x, y); if (mthing->options & MTF_AMBUSH) // Special flag for rings z += 24*FRACUNIT; @@ -11268,13 +11232,9 @@ void P_SpawnMapThing(mapthing_t *mthing) // base positions if (flip) - z = ( - ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) : - ss->sector->ceilingheight) - mobjinfo[i].height; + z = P_GetSectorCeilingZAt(ss->sector, x, y) - mobjinfo[i].height; else - z = ( - ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) : - ss->sector->floorheight); + z = P_GetSectorFloorZAt(ss->sector, x, y); // offsetting if (mthing->options >> ZSHIFT) @@ -11847,9 +11807,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) hoopcenter = P_SpawnMobj(x, y, z, MT_HOOPCENTER); hoopcenter->spawnpoint = mthing; - z += - sec->f_slope ? P_GetZAt(sec->f_slope, x, y) : - sec->floorheight; + z += P_GetSectorFloorZAt(sec, x, y); hoopcenter->z = z - hoopcenter->height/2; @@ -11980,9 +11938,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) hoopcenter = P_SpawnMobj(x, y, z, MT_HOOPCENTER); hoopcenter->spawnpoint = mthing; - z += - sec->f_slope ? P_GetZAt(sec->f_slope, x, y) : - sec->floorheight; + z += P_GetSectorFloorZAt(sec, x, y); hoopcenter->z = z - hoopcenter->height/2; P_UnsetThingPosition(hoopcenter); diff --git a/src/p_setup.c b/src/p_setup.c index e6e46edd6..5d13df8b5 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1009,14 +1009,13 @@ static void P_LoadThings(void) mt = mapthings; numhuntemeralds = 0; + for (i = 0; i < nummapthings; i++, mt++) { - sector_t *mtsector = R_PointInSubsector(mt->x << FRACBITS, mt->y << FRACBITS)->sector; + sector_t *mtsector = R_PointInSubsector((mt->x << FRACBITS), (mt->y << FRACBITS))->sector; // Z for objects - mt->z = (INT16)( - mtsector->f_slope ? P_GetZAt(mtsector->f_slope, mt->x << FRACBITS, mt->y << FRACBITS) : - mtsector->floorheight)>>FRACBITS; + mt->z = (INT16)(P_GetSectorFloorZAt(mtsector, (mt->x << FRACBITS), (mt->y << FRACBITS))) >> FRACBITS; if (mt->type == 1700 // MT_AXIS || mt->type == 1701 // MT_AXISTRANSFER diff --git a/src/p_slopes.c b/src/p_slopes.c index 81d8c54e3..ed6c8019b 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -412,7 +412,7 @@ void P_SpawnSlope_Line(int linenum) fslope->sourceline = line; // To find the real highz/lowz of a slope, you need to check all the vertexes - // in the slope's sector with P_GetZAt to get the REAL lowz & highz + // in the slope's sector with P_GetSlopeZAt to get the REAL lowz & highz // Although these slopes are set by floorheights the ANGLE is what a slope is, // so technically any slope can extend on forever (they are just bound by sectors) // *You can use sourceline as a reference to see if two slopes really are the same @@ -426,7 +426,7 @@ void P_SpawnSlope_Line(int linenum) for (l = 0; l < line->frontsector->linecount; l++) { - fixed_t height = P_GetZAt(line->frontsector->f_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); + fixed_t height = P_GetSlopeZAt(line->frontsector->f_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); if (height > highest) highest = height; @@ -473,7 +473,7 @@ void P_SpawnSlope_Line(int linenum) for (l = 0; l < line->frontsector->linecount; l++) { - fixed_t height = P_GetZAt(line->frontsector->c_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); + fixed_t height = P_GetSlopeZAt(line->frontsector->c_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); if (height > highest) highest = height; @@ -542,7 +542,7 @@ void P_SpawnSlope_Line(int linenum) for (l = 0; l < line->backsector->linecount; l++) { - fixed_t height = P_GetZAt(line->backsector->f_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); + fixed_t height = P_GetSlopeZAt(line->backsector->f_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); if (height > highest) highest = height; @@ -589,7 +589,7 @@ void P_SpawnSlope_Line(int linenum) for (l = 0; l < line->backsector->linecount; l++) { - fixed_t height = P_GetZAt(line->backsector->c_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); + fixed_t height = P_GetSlopeZAt(line->backsector->c_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); if (height > highest) highest = height; diff --git a/src/p_slopes.h b/src/p_slopes.h index 89cfdc343..40502a5ea 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -40,39 +40,44 @@ extern pslope_t *slopelist; // // Returns the height of the sloped plane at (x, y) as a fixed_t -FUNCINLINE static ATTRINLINE fixed_t P_GetZAt(pslope_t *z_slope, fixed_t x, fixed_t y) +FUNCINLINE static ATTRINLINE fixed_t P_GetSlopeZAt(const pslope_t *z_slope, fixed_t x, fixed_t y) { return z_slope->o.z + FixedMul((FixedMul(x - z_slope->o.x, z_slope->d.x) + FixedMul(y - z_slope->o.y, z_slope->d.y)), z_slope->zdelta); } +// Like P_GetSlopeZAt but falls back to z if slope is NULL +FUNCINLINE static ATTRINLINE fixed_t P_GetZAt(const pslope_t *slope, fixed_t x, fixed_t y, fixed_t z) +{ + return slope ? P_GetSlopeZAt(slope, x, y) : z; +} // Returns the height of the sector floor at (x, y) FUNCINLINE static ATTRINLINE fixed_t P_GetSectorFloorZAt(const sector_t *z_sector, fixed_t x, fixed_t y) { - return z_sector->f_slope ? P_GetZAt(z_sector->f_slope, x, y) : z_sector->floorheight; + return z_sector->f_slope ? P_GetSlopeZAt(z_sector->f_slope, x, y) : z_sector->floorheight; } // Returns the height of the sector ceiling at (x, y) FUNCINLINE static ATTRINLINE fixed_t P_GetSectorCeilingZAt(const sector_t *z_sector, fixed_t x, fixed_t y) { - return z_sector->c_slope ? P_GetZAt(z_sector->c_slope, x, y) : z_sector->ceilingheight; + return z_sector->c_slope ? P_GetSlopeZAt(z_sector->c_slope, x, y) : z_sector->ceilingheight; } // Returns the height of the FOF top at (x, y) FUNCINLINE static ATTRINLINE fixed_t P_GetFFloorTopZAt(const ffloor_t *z_ffloor, fixed_t x, fixed_t y) { - return *z_ffloor->t_slope ? P_GetZAt(*z_ffloor->t_slope, x, y) : *z_ffloor->topheight; + return *z_ffloor->t_slope ? P_GetSlopeZAt(*z_ffloor->t_slope, x, y) : *z_ffloor->topheight; } // Returns the height of the FOF bottom at (x, y) FUNCINLINE static ATTRINLINE fixed_t P_GetFFloorBottomZAt(const ffloor_t *z_ffloor, fixed_t x, fixed_t y) { - return *z_ffloor->b_slope ? P_GetZAt(*z_ffloor->b_slope, x, y) : *z_ffloor->bottomheight; + return *z_ffloor->b_slope ? P_GetSlopeZAt(*z_ffloor->b_slope, x, y) : *z_ffloor->bottomheight; } // Returns the height of the light list at (x, y) FUNCINLINE static ATTRINLINE fixed_t P_GetLightZAt(const lightlist_t *z_light, fixed_t x, fixed_t y) { - return z_light->slope ? P_GetZAt(z_light->slope, x, y) : z_light->height; + return z_light->slope ? P_GetSlopeZAt(z_light->slope, x, y) : z_light->height; } // Lots of physics-based bullshit diff --git a/src/p_spec.c b/src/p_spec.c index 42345e6dd..670289fcf 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -5125,11 +5125,10 @@ void T_LaserFlash(laserthink_t *flash) sourcesec = ffloor->master->frontsector; // Less to type! - top = (*ffloor->t_slope) ? P_GetZAt(*ffloor->t_slope, sector->soundorg.x, sector->soundorg.y) - : *ffloor->topheight; - bottom = (*ffloor->b_slope) ? P_GetZAt(*ffloor->b_slope, sector->soundorg.x, sector->soundorg.y) - : *ffloor->bottomheight; + top = P_GetFFloorTopZAt (ffloor, sector->soundorg.x, sector->soundorg.y); + bottom = P_GetFFloorBottomZAt(ffloor, sector->soundorg.x, sector->soundorg.y); sector->soundorg.z = (top + bottom)/2; + S_StartSound(§or->soundorg, sfx_laser); // Seek out objects to DESTROY! MUAHAHHAHAHAA!!!*cough* @@ -6765,10 +6764,7 @@ void T_Disappear(disappear_t *d) if (!(lines[d->sourceline].flags & ML_NOCLIMB)) { - if (*rover->t_slope) - sectors[s].soundorg.z = P_GetZAt(*rover->t_slope, sectors[s].soundorg.x, sectors[s].soundorg.y); - else - sectors[s].soundorg.z = *rover->topheight; + sectors[s].soundorg.z = P_GetFFloorTopZAt(rover, sectors[s].soundorg.x, sectors[s].soundorg.y); S_StartSound(§ors[s].soundorg, sfx_appear); } } diff --git a/src/p_user.c b/src/p_user.c index 1747a84a1..536ebc771 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1317,8 +1317,9 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space if (GETSECSPECIAL(rover->master->frontsector->special, 1) != SPACESPECIAL) continue; - topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : *rover->topheight; - bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) : *rover->bottomheight; + + topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y); + bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y); if (mo->z + (mo->height/2) > topheight) continue; @@ -1352,8 +1353,8 @@ boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand if (!(rover->flags & FF_QUICKSAND)) continue; - topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : *rover->topheight; - bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) : *rover->bottomheight; + topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y); + bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y); if (mo->z + flipoffset > topheight) continue; @@ -1644,8 +1645,8 @@ static void P_CheckQuicksand(player_t *player) if (!(rover->flags & FF_QUICKSAND)) continue; - topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; - bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight; + topheight = P_GetFFloorTopZAt(rover, player->mo->x, player->mo->y); + bottomheight = P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y); if (topheight >= player->mo->z && bottomheight < player->mo->z + player->mo->height) { @@ -2133,12 +2134,16 @@ static void P_SpectatorMovement(player_t *player) void P_BlackOw(player_t *player) { INT32 i; - S_StartSound (player->mo, sfx_bkpoof); // Sound the BANG! + S_StartSound(player->mo, sfx_bkpoof); // Sound the BANG! for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] && P_AproxDistance(player->mo->x - players[i].mo->x, - player->mo->y - players[i].mo->y) < 1536*FRACUNIT) + { + if (!playeringame[i]) + continue; + + if (P_AproxDistance(player->mo->x - players[i].mo->x, player->mo->y - players[i].mo->y) < 1536*FRACUNIT) P_FlashPal(&players[i], PAL_NUKE, 10); + } P_NukeEnemies(player->mo, player->mo, 1536*FRACUNIT); // Search for all nearby enemies and nuke their pants off! player->powers[pw_shield] = player->powers[pw_shield] & SH_STACK; @@ -2168,12 +2173,15 @@ void P_ElementalFireTrail(player_t *player) { newx = player->mo->x + P_ReturnThrustX(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); newy = player->mo->y + P_ReturnThrustY(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); + if (player->mo->standingslope) { - ground = P_GetZAt(player->mo->standingslope, newx, newy); + ground = P_GetSlopeZAt(player->mo->standingslope, newx, newy); + if (player->mo->eflags & MFE_VERTICALFLIP) ground -= FixedMul(mobjinfo[MT_SPINFIRE].height, player->mo->scale); } + flame = P_SpawnMobj(newx, newy, ground, MT_SPINFIRE); P_SetTarget(&flame->target, player->mo); flame->angle = travelangle; @@ -2184,6 +2192,7 @@ void P_ElementalFireTrail(player_t *player) flame->momx = 8; P_XYMovement(flame); + if (P_MobjWasRemoved(flame)) continue; diff --git a/src/r_bsp.c b/src/r_bsp.c index 278bafb82..e2e878078 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -482,11 +482,8 @@ static void R_AddLine(seg_t *line) if (frontsector->f_slope || frontsector->c_slope || backsector->f_slope || backsector->c_slope) { #define SLOPEPARAMS(slope, end1, end2, normalheight) \ - if (slope) { \ - end1 = P_GetZAt(slope, line->v1->x, line->v1->y); \ - end2 = P_GetZAt(slope, line->v2->x, line->v2->y); \ - } else \ - end1 = end2 = normalheight; + end1 = P_GetZAt(slope, line->v1->x, line->v1->y, normalheight); \ + end2 = P_GetZAt(slope, line->v2->x, line->v2->y, normalheight); SLOPEPARAMS(frontsector->f_slope, frontf1, frontf2, frontsector->floorheight) SLOPEPARAMS(frontsector->c_slope, frontc1, frontc2, frontsector->ceilingheight) @@ -849,13 +846,8 @@ static void R_Subsector(size_t num) floorcolormap = ceilingcolormap = frontsector->extra_colormap; - floorcenterz = - frontsector->f_slope ? P_GetZAt(frontsector->f_slope, frontsector->soundorg.x, frontsector->soundorg.y) : - frontsector->floorheight; - - ceilingcenterz = - frontsector->c_slope ? P_GetZAt(frontsector->c_slope, frontsector->soundorg.x, frontsector->soundorg.y) : - frontsector->ceilingheight; + floorcenterz = P_GetSectorFloorZAt(frontsector, frontsector->soundorg.x, frontsector->soundorg.y); + ceilingcenterz = P_GetSectorCeilingZAt(frontsector, frontsector->soundorg.x, frontsector->soundorg.y); // Check and prep all 3D floors. Set the sector floor/ceiling light levels and colormaps. if (frontsector->ffloors) @@ -900,9 +892,7 @@ static void R_Subsector(size_t num) sub->sector->extra_colormap = frontsector->extra_colormap; - if ((( - frontsector->f_slope ? P_GetZAt(frontsector->f_slope, viewx, viewy) : - frontsector->floorheight) < viewz || (frontsector->heightsec != -1 + if ((P_GetSectorFloorZAt(frontsector, viewx, viewy) < viewz || (frontsector->heightsec != -1 && sectors[frontsector->heightsec].ceilingpic == skyflatnum))) { floorplane = R_FindPlane(frontsector->floorheight, frontsector->floorpic, floorlightlevel, @@ -914,9 +904,7 @@ static void R_Subsector(size_t num) else floorplane = NULL; - if ((( - frontsector->c_slope ? P_GetZAt(frontsector->c_slope, viewx, viewy) : - frontsector->ceilingheight) > viewz || frontsector->ceilingpic == skyflatnum + if ((P_GetSectorCeilingZAt(frontsector, viewx, viewy) > viewz || frontsector->ceilingpic == skyflatnum || (frontsector->heightsec != -1 && sectors[frontsector->heightsec].floorpic == skyflatnum))) { @@ -934,6 +922,7 @@ static void R_Subsector(size_t num) ffloor[numffloors].slope = NULL; ffloor[numffloors].plane = NULL; ffloor[numffloors].polyobj = NULL; + if (frontsector->ffloors) { fixed_t heightcheck, planecenterz; @@ -955,13 +944,9 @@ static void R_Subsector(size_t num) ffloor[numffloors].plane = NULL; ffloor[numffloors].polyobj = NULL; - heightcheck = - *rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : - *rover->bottomheight; + heightcheck = P_GetFFloorBottomZAt(rover, viewx, viewy); + planecenterz = P_GetFFloorBottomZAt(rover, frontsector->soundorg.x, frontsector->soundorg.y); - planecenterz = - *rover->b_slope ? P_GetZAt(*rover->b_slope, frontsector->soundorg.x, frontsector->soundorg.y) : - *rover->bottomheight; if (planecenterz <= ceilingcenterz && planecenterz >= floorcenterz && ((viewz < heightcheck && !(rover->flags & FF_INVERTPLANES)) @@ -987,18 +972,16 @@ static void R_Subsector(size_t num) ffloor[numffloors].ffloor = rover; numffloors++; } + if (numffloors >= MAXFFLOORS) break; + ffloor[numffloors].plane = NULL; ffloor[numffloors].polyobj = NULL; - heightcheck = - *rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : - *rover->topheight; + heightcheck = P_GetFFloorTopZAt(rover, viewx, viewy); + planecenterz = P_GetFFloorTopZAt(rover, frontsector->soundorg.x, frontsector->soundorg.y); - planecenterz = - *rover->t_slope ? P_GetZAt(*rover->t_slope, frontsector->soundorg.x, frontsector->soundorg.y) : - *rover->topheight; if (planecenterz >= floorcenterz && planecenterz <= ceilingcenterz && ((viewz > heightcheck && !(rover->flags & FF_INVERTPLANES)) @@ -1166,7 +1149,7 @@ void R_Prep3DFloors(sector_t *sector) else memset(sector->lightlist, 0, sizeof (lightlist_t) * count); - heighttest = sector->c_slope ? P_GetZAt(sector->c_slope, sector->soundorg.x, sector->soundorg.y) : sector->ceilingheight; + heighttest = P_GetSectorCeilingZAt(sector, sector->soundorg.x, sector->soundorg.y); sector->lightlist[0].height = heighttest + 1; sector->lightlist[0].slope = sector->c_slope; @@ -1187,7 +1170,7 @@ void R_Prep3DFloors(sector_t *sector) && !(rover->flags & FF_CUTLEVEL) && !(rover->flags & FF_CUTSPRITES))) continue; - heighttest = *rover->t_slope ? P_GetZAt(*rover->t_slope, sector->soundorg.x, sector->soundorg.y) : *rover->topheight; + heighttest = P_GetFFloorTopZAt(rover, sector->soundorg.x, sector->soundorg.y); if (heighttest > bestheight && heighttest < maxheight) { @@ -1196,8 +1179,9 @@ void R_Prep3DFloors(sector_t *sector) bestslope = *rover->t_slope; continue; } - if (rover->flags & FF_DOUBLESHADOW) { - heighttest = *rover->b_slope ? P_GetZAt(*rover->b_slope, sector->soundorg.x, sector->soundorg.y) : *rover->bottomheight; + if (rover->flags & FF_DOUBLESHADOW) + { + heighttest = P_GetFFloorBottomZAt(rover, sector->soundorg.x, sector->soundorg.y); if (heighttest > bestheight && heighttest < maxheight) @@ -1221,6 +1205,7 @@ void R_Prep3DFloors(sector_t *sector) sector->lightlist[i].slope = bestslope; sec = §ors[best->secnum]; mapnum = sec->midmap; + if (mapnum >= 0 && (size_t)mapnum < num_extra_colormaps) sec->extra_colormap = &extra_colormaps[mapnum]; else @@ -1244,7 +1229,8 @@ void R_Prep3DFloors(sector_t *sector) if (best->flags & FF_DOUBLESHADOW) { - heighttest = *best->b_slope ? P_GetZAt(*best->b_slope, sector->soundorg.x, sector->soundorg.y) : *best->bottomheight; + heighttest = P_GetFFloorBottomZAt(best, sector->soundorg.x, sector->soundorg.y); + if (bestheight == heighttest) ///TODO: do this in a more efficient way -Red { sector->lightlist[i].lightlevel = sector->lightlist[best->lastlight].lightlevel; diff --git a/src/r_plane.c b/src/r_plane.c index 807baca5c..d4e9c92ff 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -697,7 +697,7 @@ void R_CalculateSlopeVectors(pslope_t *slope, fixed_t planeviewx, fixed_t planev vy = FIXED_TO_FLOAT(planeviewy-planeyoffset); vz = FIXED_TO_FLOAT(planeviewz); - temp = P_GetZAt(slope, planeviewx, planeviewy); + temp = P_GetSlopeZAt(slope, planeviewx, planeviewy); zeroheight = FIXED_TO_FLOAT(temp); // p is the texture origin in view space @@ -706,7 +706,7 @@ void R_CalculateSlopeVectors(pslope_t *slope, fixed_t planeviewx, fixed_t planev ang = ANG2RAD(ANGLE_270 - planeviewangle); p.x = vx * cos(ang) - vy * sin(ang); p.z = vx * sin(ang) + vy * cos(ang); - temp = P_GetZAt(slope, -planexoffset, planeyoffset); + temp = P_GetSlopeZAt(slope, -planexoffset, planeyoffset); p.y = FIXED_TO_FLOAT(temp) - vz; // m is the v direction vector in view space @@ -719,9 +719,9 @@ void R_CalculateSlopeVectors(pslope_t *slope, fixed_t planeviewx, fixed_t planev n.z = -xscale * cos(ang); ang = ANG2RAD(planeangle); - temp = P_GetZAt(slope, planeviewx + FLOAT_TO_FIXED(yscale * sin(ang)), planeviewy + FLOAT_TO_FIXED(yscale * cos(ang))); + temp = P_GetSlopeZAt(slope, planeviewx + FLOAT_TO_FIXED(yscale * sin(ang)), planeviewy + FLOAT_TO_FIXED(yscale * cos(ang))); m.y = FIXED_TO_FLOAT(temp) - zeroheight; - temp = P_GetZAt(slope, planeviewx + FLOAT_TO_FIXED(xscale * cos(ang)), planeviewy - FLOAT_TO_FIXED(xscale * sin(ang))); + temp = P_GetSlopeZAt(slope, planeviewx + FLOAT_TO_FIXED(xscale * cos(ang)), planeviewy - FLOAT_TO_FIXED(xscale * sin(ang))); n.y = FIXED_TO_FLOAT(temp) - zeroheight; m.x /= fudge; @@ -1054,7 +1054,7 @@ void R_DrawSinglePlane(visplane_t *pl) #ifndef NOWATER if (planeripple.active) { - fixed_t plheight = abs(P_GetZAt(pl->slope, pl->viewx, pl->viewy) - pl->viewz); + fixed_t plheight = abs(P_GetSlopeZAt(pl->slope, pl->viewx, pl->viewy) - pl->viewz); R_PlaneBounds(pl); diff --git a/src/r_segs.c b/src/r_segs.c index 2b0700e4d..a1d3b626e 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -389,11 +389,9 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) fixed_t leftheight, rightheight; light = &frontsector->lightlist[i]; rlight = &dc_lightlist[i]; - if (light->slope) { - leftheight = P_GetZAt(light->slope, ds->leftpos.x, ds->leftpos.y); - rightheight = P_GetZAt(light->slope, ds->rightpos.x, ds->rightpos.y); - } else - leftheight = rightheight = light->height; + + leftheight = P_GetLightZAt(light, ds-> leftpos.x, ds-> leftpos.y); + rightheight = P_GetLightZAt(light, ds->rightpos.x, ds->rightpos.y); leftheight -= viewz; rightheight -= viewz; @@ -401,8 +399,6 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) rlight->height = (centeryfrac) - FixedMul(leftheight, ds->scale1); rlight->heightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2); rlight->heightstep = (rlight->heightstep-rlight->height)/(range); - //if (x1 > ds->x1) - //rlight->height -= (x1 - ds->x1)*rlight->heightstep; rlight->startheight = rlight->height; // keep starting value here to reset for each repeat rlight->lightlevel = *light->lightlevel; rlight->extra_colormap = light->extra_colormap; @@ -762,11 +758,8 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) rlight = &dc_lightlist[p]; #define SLOPEPARAMS(slope, end1, end2, normalheight) \ - if (slope) { \ - end1 = P_GetZAt(slope, ds->leftpos.x, ds->leftpos.y); \ - end2 = P_GetZAt(slope, ds->rightpos.x, ds->rightpos.y); \ - } else \ - end1 = end2 = normalheight; + end1 = P_GetZAt(slope, ds->leftpos.x, ds->leftpos.y, normalheight); \ + end2 = P_GetZAt(slope, ds->rightpos.x, ds->rightpos.y, normalheight); SLOPEPARAMS(light->slope, leftheight, rightheight, light->height) SLOPEPARAMS(*pfloor->b_slope, pfloorleft, pfloorright, *pfloor->bottomheight) @@ -779,8 +772,8 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) if (leftheight > pfloorleft && rightheight > pfloorright && i+1 < dc_numlights) { lightlist_t *nextlight = &frontsector->lightlist[i+1]; - if ((nextlight->slope ? P_GetZAt(nextlight->slope, ds->leftpos.x, ds->leftpos.y) : nextlight->height) > pfloorleft - && (nextlight->slope ? P_GetZAt(nextlight->slope, ds->rightpos.x, ds->rightpos.y) : nextlight->height) > pfloorright) + if ((P_GetLightZAt(nextlight, ds->leftpos.x, ds->leftpos.y) > pfloorleft) + && (P_GetLightZAt(nextlight, ds->rightpos.x, ds->rightpos.y) > pfloorright)) continue; } @@ -873,16 +866,11 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) dc_texheight = textureheight[texnum]>>FRACBITS; // calculate both left ends - if (*pfloor->t_slope) - left_top = P_GetZAt(*pfloor->t_slope, ds->leftpos.x, ds->leftpos.y) - viewz; - else - left_top = *pfloor->topheight - viewz; + left_top = P_GetFFloorTopZAt (pfloor, ds->leftpos.x, ds->leftpos.y) - viewz; + left_bottom = P_GetFFloorBottomZAt(pfloor, ds->leftpos.x, ds->leftpos.y) - viewz; - if (*pfloor->b_slope) - left_bottom = P_GetZAt(*pfloor->b_slope, ds->leftpos.x, ds->leftpos.y) - viewz; - else - left_bottom = *pfloor->bottomheight - viewz; skewslope = *pfloor->t_slope; // skew using top slope by default + if (newline) { if (newline->flags & ML_DONTPEGTOP) @@ -949,15 +937,8 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) fixed_t right_top, right_bottom; // calculate right ends now - if (*pfloor->t_slope) - right_top = P_GetZAt(*pfloor->t_slope, ds->rightpos.x, ds->rightpos.y) - viewz; - else - right_top = *pfloor->topheight - viewz; - - if (*pfloor->b_slope) - right_bottom = P_GetZAt(*pfloor->b_slope, ds->rightpos.x, ds->rightpos.y) - viewz; - else - right_bottom = *pfloor->bottomheight - viewz; + right_top = P_GetFFloorTopZAt (pfloor, ds->rightpos.x, ds->rightpos.y) - viewz; + right_bottom = P_GetFFloorBottomZAt(pfloor, ds->rightpos.x, ds->rightpos.y) - viewz; // using INT64 to avoid 32bit overflow top_frac = (INT64)centeryfrac - (((INT64)left_top * ds->scale1) >> FRACBITS); @@ -1799,22 +1780,18 @@ void R_StoreWallRange(INT32 start, INT32 stop) } - if (frontsector->c_slope) { - worldtop = P_GetZAt(frontsector->c_slope, segleft.x, segleft.y) - viewz; - worldtopslope = P_GetZAt(frontsector->c_slope, segright.x, segright.y) - viewz; - } else { - worldtopslope = - worldtop = frontsector->ceilingheight - viewz; - } +#define SLOPEPARAMS(slope, end1, end2, normalheight) \ + end1 = P_GetZAt(slope, segleft.x, segleft.y, normalheight); \ + end2 = P_GetZAt(slope, segright.x, segright.y, normalheight); - - if (frontsector->f_slope) { - worldbottom = P_GetZAt(frontsector->f_slope, segleft.x, segleft.y) - viewz; - worldbottomslope = P_GetZAt(frontsector->f_slope, segright.x, segright.y) - viewz; - } else { - worldbottomslope = - worldbottom = frontsector->floorheight - viewz; - } + SLOPEPARAMS(frontsector->c_slope, worldtop, worldtopslope, frontsector->ceilingheight) + SLOPEPARAMS(frontsector->f_slope, worldbottom, worldbottomslope, frontsector->floorheight) + // subtract viewz from these to turn them into + // positions relative to the camera's z position + worldtop -= viewz; + worldtopslope -= viewz; + worldbottom -= viewz; + worldbottomslope -= viewz; midtexture = toptexture = bottomtexture = maskedtexture = 0; ds_p->maskedtexturecol = NULL; @@ -1834,12 +1811,8 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (ffloor[i].polyobj && (!ds_p->curline->polyseg || ffloor[i].polyobj != ds_p->curline->polyseg)) continue; - if (ffloor[i].slope) { - ffloor[i].f_pos = P_GetZAt(ffloor[i].slope, segleft.x, segleft.y) - viewz; - ffloor[i].f_pos_slope = P_GetZAt(ffloor[i].slope, segright.x, segright.y) - viewz; - } else - ffloor[i].f_pos_slope = - ffloor[i].f_pos = ffloor[i].height - viewz; + ffloor[i].f_pos = P_GetZAt(ffloor[i].slope, segleft .x, segleft .y, ffloor[i].height) - viewz; + ffloor[i].f_pos_slope = P_GetZAt(ffloor[i].slope, segright.x, segright.y, ffloor[i].height) - viewz; } } @@ -1898,26 +1871,15 @@ void R_StoreWallRange(INT32 start, INT32 stop) else { // two sided line - - if (backsector->c_slope) { - worldhigh = P_GetZAt(backsector->c_slope, segleft.x, segleft.y) - viewz; - worldhighslope = P_GetZAt(backsector->c_slope, segright.x, segright.y) - viewz; - } else { - worldhighslope = - worldhigh = backsector->ceilingheight - viewz; - } - - - if (backsector->f_slope) { - worldlow = P_GetZAt(backsector->f_slope, segleft.x, segleft.y) - viewz; - worldlowslope = P_GetZAt(backsector->f_slope, segright.x, segright.y) - viewz; - } else { - worldlowslope = - worldlow = backsector->floorheight - viewz; - } - + SLOPEPARAMS(backsector->c_slope, worldhigh, worldhighslope, backsector->ceilingheight) + SLOPEPARAMS(backsector->f_slope, worldlow, worldlowslope, backsector->floorheight) + worldhigh -= viewz; + worldhighslope -= viewz; + worldlow -= viewz; + worldlowslope -= viewz; // hack to allow height changes in outdoor areas + // This is what gets rid of the upper textures if there should be sky if (frontsector->ceilingpic == skyflatnum && backsector->ceilingpic == skyflatnum) { @@ -1931,12 +1893,12 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (worldbottomslope > worldlowslope || worldbottom > worldlow) { ds_p->silhouette = SIL_BOTTOM; - if ((backsector->f_slope ? P_GetZAt(backsector->f_slope, viewx, viewy) : backsector->floorheight) > viewz) + if (P_GetSectorFloorZAt(backsector, viewx, viewy) > viewz) ds_p->bsilheight = INT32_MAX; else ds_p->bsilheight = (frontsector->f_slope ? INT32_MAX : frontsector->floorheight); } - else if ((backsector->f_slope ? P_GetZAt(backsector->f_slope, viewx, viewy) : backsector->floorheight) > viewz) + else if (P_GetSectorFloorZAt(backsector, viewx, viewy) > viewz) { ds_p->silhouette = SIL_BOTTOM; ds_p->bsilheight = INT32_MAX; @@ -1946,16 +1908,15 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (worldtopslope < worldhighslope || worldtop < worldhigh) { ds_p->silhouette |= SIL_TOP; - if ((backsector->c_slope ? P_GetZAt(backsector->c_slope, viewx, viewy) : backsector->ceilingheight) < viewz) + if (P_GetSectorCeilingZAt(backsector, viewx, viewy) < viewz) ds_p->tsilheight = INT32_MIN; else ds_p->tsilheight = (frontsector->c_slope ? INT32_MIN : frontsector->ceilingheight); } - else if ((backsector->c_slope ? P_GetZAt(backsector->c_slope, viewx, viewy) : backsector->ceilingheight) < viewz) + else if (P_GetSectorCeilingZAt(backsector, viewx, viewy) < viewz) { ds_p->silhouette |= SIL_TOP; ds_p->tsilheight = INT32_MIN; - // ds_p->sprtopclip = screenheightarray; } if (viewsector != frontsector && viewsector != backsector) @@ -2053,13 +2014,15 @@ void R_StoreWallRange(INT32 start, INT32 stop) toptexture = R_GetTextureNum(sidedef->toptexture); texheight = textureheight[toptexture]; } - if (!(linedef->flags & ML_EFFECT1)) { // Ignore slopes for lower/upper textures unless flag is checked + + if (!(linedef->flags & ML_EFFECT1)) // Ignore slopes for lower/upper textures unless flag is checked + { if (linedef->flags & ML_DONTPEGTOP) rw_toptexturemid = frontsector->ceilingheight - viewz; else rw_toptexturemid = backsector->ceilingheight - viewz; - } else - if (linedef->flags & ML_DONTPEGTOP) + } + else if (linedef->flags & ML_DONTPEGTOP) { // top of texture at top rw_toptexturemid = worldtop; @@ -2077,20 +2040,22 @@ void R_StoreWallRange(INT32 start, INT32 stop) // bottom texture bottomtexture = R_GetTextureNum(sidedef->bottomtexture); - if (!(linedef->flags & ML_EFFECT1)) { // Ignore slopes for lower/upper textures unless flag is checked + if (!(linedef->flags & ML_EFFECT1)) // Ignore slopes for lower/upper textures unless flag is checked + { if (linedef->flags & ML_DONTPEGBOTTOM) rw_bottomtexturemid = frontsector->floorheight - viewz; else rw_bottomtexturemid = backsector->floorheight - viewz; - } else - if (linedef->flags & ML_DONTPEGBOTTOM) + } + else if (linedef->flags & ML_DONTPEGBOTTOM) { // bottom of texture at bottom // top of texture at top rw_bottomtexturemid = worldbottom; rw_bottomtextureslide = floorfrontslide; } - else { // top of texture at top + else // top of texture at top + { rw_bottomtexturemid = worldlow; rw_bottomtextureslide = floorbackslide; } @@ -2123,6 +2088,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (frontsector->ffloors && backsector->ffloors) { i = 0; + for (rover = backsector->ffloors; rover && i < MAXFFLOORS; rover = rover->next) { if (!(rover->flags & FF_RENDERSIDES) || !(rover->flags & FF_EXISTS)) @@ -2133,16 +2099,8 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (rover->norender == leveltime) continue; - if (*rover->t_slope) { - high1 = P_GetZAt(*rover->t_slope, segleft.x, segleft.y); - highslope1 = P_GetZAt(*rover->t_slope, segright.x, segright.y); - } else - high1 = highslope1 = *rover->topheight; - if (*rover->b_slope) { - low1 = P_GetZAt(*rover->b_slope, segleft.x, segleft.y); - lowslope1 = P_GetZAt(*rover->b_slope, segright.x, segright.y); - } else - low1 = lowslope1 = *rover->bottomheight; + SLOPEPARAMS(*rover->t_slope, high1, highslope1, *rover->topheight) + SLOPEPARAMS(*rover->b_slope, low1, lowslope1, *rover->bottomheight) if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope)) continue; @@ -2169,16 +2127,8 @@ void R_StoreWallRange(INT32 start, INT32 stop) continue; } - if (*r2->t_slope) { - high2 = P_GetZAt(*r2->t_slope, segleft.x, segleft.y); - highslope2 = P_GetZAt(*r2->t_slope, segright.x, segright.y); - } else - high2 = highslope2 = *r2->topheight; - if (*r2->b_slope) { - low2 = P_GetZAt(*r2->b_slope, segleft.x, segleft.y); - lowslope2 = P_GetZAt(*r2->b_slope, segright.x, segright.y); - } else - low2 = lowslope2 = *r2->bottomheight; + SLOPEPARAMS(*r2->t_slope, high2, highslope2, *r2->topheight) + SLOPEPARAMS(*r2->b_slope, low2, lowslope2, *r2->bottomheight) if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope)) continue; @@ -2187,6 +2137,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) break; } + if (r2) continue; @@ -2204,16 +2155,8 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (rover->norender == leveltime) continue; - if (*rover->t_slope) { - high1 = P_GetZAt(*rover->t_slope, segleft.x, segleft.y); - highslope1 = P_GetZAt(*rover->t_slope, segright.x, segright.y); - } else - high1 = highslope1 = *rover->topheight; - if (*rover->b_slope) { - low1 = P_GetZAt(*rover->b_slope, segleft.x, segleft.y); - lowslope1 = P_GetZAt(*rover->b_slope, segright.x, segright.y); - } else - low1 = lowslope1 = *rover->bottomheight; + SLOPEPARAMS(*rover->t_slope, high1, highslope1, *rover->topheight) + SLOPEPARAMS(*rover->b_slope, low1, lowslope1, *rover->bottomheight) if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope)) continue; @@ -2240,16 +2183,8 @@ void R_StoreWallRange(INT32 start, INT32 stop) continue; } - if (*r2->t_slope) { - high2 = P_GetZAt(*r2->t_slope, segleft.x, segleft.y); - highslope2 = P_GetZAt(*r2->t_slope, segright.x, segright.y); - } else - high2 = highslope2 = *r2->topheight; - if (*r2->b_slope) { - low2 = P_GetZAt(*r2->b_slope, segleft.x, segleft.y); - lowslope2 = P_GetZAt(*r2->b_slope, segright.x, segright.y); - } else - low2 = lowslope2 = *r2->bottomheight; + SLOPEPARAMS(*r2->t_slope, high2, highslope2, *r2->topheight) + SLOPEPARAMS(*r2->b_slope, low2, lowslope2, *r2->bottomheight) if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope)) continue; @@ -2275,10 +2210,10 @@ void R_StoreWallRange(INT32 start, INT32 stop) continue; // Oy vey. - if (( (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) <= worldbottom+viewz - && (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover->topheight) <= worldbottomslope+viewz) - ||((*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) >= worldtop+viewz - && (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) >= worldtopslope+viewz)) + if ( ((P_GetFFloorTopZAt (rover, segleft .x, segleft .y)) <= worldbottom + viewz + && (P_GetFFloorTopZAt (rover, segright.x, segright.y)) <= worldbottomslope + viewz) + ||((P_GetFFloorBottomZAt(rover, segleft .x, segleft .y)) >= worldtop + viewz + && (P_GetFFloorBottomZAt(rover, segright.x, segright.y)) >= worldtopslope + viewz)) continue; ds_p->thicksides[i] = rover; @@ -2293,17 +2228,18 @@ void R_StoreWallRange(INT32 start, INT32 stop) continue; if (rover->norender == leveltime) continue; + // Oy vey. - if (( (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) <= worldbottom+viewz - && (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover->topheight) <= worldbottomslope+viewz) - ||((*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) >= worldtop+viewz - && (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) >= worldtopslope+viewz)) + if ( (P_GetFFloorTopZAt (rover, segleft .x, segleft .y) <= worldbottom + viewz + && P_GetFFloorTopZAt (rover, segright.x, segright.y) <= worldbottomslope + viewz) + ||(P_GetFFloorBottomZAt(rover, segleft .x, segleft .y) >= worldtop + viewz + && P_GetFFloorBottomZAt(rover, segright.x, segright.y) >= worldtopslope + viewz)) continue; - if (( (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) <= worldlow+viewz - && (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover->topheight) <= worldlowslope+viewz) - ||((*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) >= worldhigh+viewz - && (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) >= worldhighslope+viewz)) + if ( (P_GetFFloorTopZAt (rover, segleft .x, segleft .y) <= worldlow + viewz + && P_GetFFloorTopZAt (rover, segright.x, segright.y) <= worldlowslope + viewz) + ||(P_GetFFloorBottomZAt(rover, segleft .x, segleft .y) >= worldhigh + viewz + && P_GetFFloorBottomZAt(rover, segright.x, segright.y) >= worldhighslope + viewz)) continue; ds_p->thicksides[i] = rover; @@ -2313,6 +2249,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) ds_p->numthicksides = numthicksides = i; } + if (sidedef->midtexture > 0 && sidedef->midtexture < numtextures) { // masked midtexture @@ -2329,6 +2266,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (curline->polyseg) // use REAL front and back floors please, so midtexture rendering isn't mucked up { rw_midtextureslide = rw_midtexturebackslide = 0; + if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) rw_midtexturemid = rw_midtextureback = max(curline->frontsector->floorheight, curline->backsector->floorheight) - viewz; else @@ -2340,6 +2278,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (linedef->flags & ML_EFFECT2) // Ignore slopes when texturing { rw_midtextureslide = rw_midtexturebackslide = 0; + if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) rw_midtexturemid = rw_midtextureback = max(frontsector->floorheight, backsector->floorheight) - viewz; else @@ -2424,18 +2363,13 @@ void R_StoreWallRange(INT32 start, INT32 stop) // and doesn't need to be marked. if (frontsector->heightsec == -1) { - if (( - frontsector->f_slope ? P_GetZAt(frontsector->f_slope, viewx, viewy) : - frontsector->floorheight) >= viewz) + if (P_GetSectorFloorZAt(frontsector, viewx, viewy) >= viewz) { // above view plane markfloor = false; } - if (( - frontsector->c_slope ? P_GetZAt(frontsector->c_slope, viewx, viewy) : - frontsector->ceilingheight) <= viewz && - frontsector->ceilingpic != skyflatnum) + if (frontsector->ceilingpic != skyflatnum && P_GetSectorCeilingZAt(frontsector, viewx, viewy) <= viewz) { // below view plane markceiling = false; @@ -2492,14 +2426,12 @@ void R_StoreWallRange(INT32 start, INT32 stop) light = &frontsector->lightlist[i]; rlight = &dc_lightlist[p]; - if (light->slope) { - leftheight = P_GetZAt(light->slope, segleft.x, segleft.y); - rightheight = P_GetZAt(light->slope, segright.x, segright.y); + leftheight = P_GetLightZAt(light, segleft.x, segleft.y); + rightheight = P_GetLightZAt(light, segright.x, segright.y); - // Flag sector as having slopes + // Flag sector as having slopes + if (light->slope) frontsector->hasslope = true; - } else - leftheight = rightheight = light->height; leftheight -= viewz; rightheight -= viewz; @@ -2523,14 +2455,12 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (light->caster && light->caster->flags & FF_CUTSOLIDS) { - if (*light->caster->b_slope) { - leftheight = P_GetZAt(*light->caster->b_slope, segleft.x, segleft.y); - rightheight = P_GetZAt(*light->caster->b_slope, segright.x, segright.y); + leftheight = P_GetFFloorBottomZAt(light->caster, segleft.x, segleft.y); + rightheight = P_GetFFloorBottomZAt(light->caster, segright.x, segright.y); - // Flag sector as having slopes + // Flag sector as having slopes + if (*light->caster->b_slope) frontsector->hasslope = true; - } else - leftheight = rightheight = *light->caster->bottomheight; leftheight -= viewz; rightheight -= viewz; @@ -2623,9 +2553,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (*rover->b_slope || *rover->t_slope) backsector->hasslope = true; - roverleft = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; - roverright = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) - viewz; - planevistest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : *rover->bottomheight); + roverleft = P_GetFFloorBottomZAt(rover, segleft .x, segleft .y) - viewz; + roverright = P_GetFFloorBottomZAt(rover, segright.x, segright.y) - viewz; + planevistest = P_GetFFloorBottomZAt(rover, viewx, viewy); if ((roverleft>>4 <= worldhigh || roverright>>4 <= worldhighslope) && (roverleft>>4 >= worldlow || roverright>>4 >= worldlowslope) && @@ -2646,9 +2576,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (i >= MAXFFLOORS) break; - roverleft = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) - viewz; - roverright = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover->topheight) - viewz; - planevistest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : *rover->topheight); + roverleft = P_GetFFloorTopZAt(rover, segleft .x, segleft .y) - viewz; + roverright = P_GetFFloorTopZAt(rover, segright.x, segright.y) - viewz; + planevistest = P_GetFFloorTopZAt(rover, viewx, viewy); if ((roverleft>>4 <= worldhigh || roverright>>4 <= worldhighslope) && (roverleft>>4 >= worldlow || roverright>>4 >= worldlowslope) && @@ -2680,9 +2610,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (*rover->b_slope || *rover->t_slope) frontsector->hasslope = true; - roverleft = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; - roverright = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) - viewz; - planevistest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : *rover->bottomheight); + roverleft = P_GetFFloorBottomZAt(rover, segleft .x, segleft .y) - viewz; + roverright = P_GetFFloorBottomZAt(rover, segright.x, segright.y) - viewz; + planevistest = P_GetFFloorBottomZAt(rover, viewx, viewy); if ((roverleft>>4 <= worldhigh || roverright>>4 <= worldhighslope) && (roverleft>>4 >= worldlow || roverright>>4 >= worldlowslope) && @@ -2703,9 +2633,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (i >= MAXFFLOORS) break; - roverleft = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) - viewz; - roverright = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover->topheight) - viewz; - planevistest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : *rover->topheight); + roverleft = P_GetFFloorTopZAt(rover, segleft .x, segleft .y) - viewz; + roverright = P_GetFFloorTopZAt(rover, segright.x, segright.y) - viewz; + planevistest = P_GetFFloorTopZAt(rover, viewx, viewy); if ((roverleft>>4 <= worldhigh || roverright>>4 <= worldhighslope) && (roverleft>>4 >= worldlow || roverright>>4 >= worldlowslope) && @@ -2724,9 +2654,12 @@ void R_StoreWallRange(INT32 start, INT32 stop) } } } + if (curline->polyseg && frontsector && (curline->polyseg->flags & POF_RENDERPLANES)) { - while (i < numffloors && ffloor[i].polyobj != curline->polyseg) i++; + while (i < numffloors && ffloor[i].polyobj != curline->polyseg) + i++; + if (i < numffloors && backsector->floorheight <= frontsector->ceilingheight && backsector->floorheight >= frontsector->floorheight && (viewz < backsector->floorheight)) @@ -2744,6 +2677,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); i++; } + if (i < numffloors && backsector->ceilingheight >= frontsector->floorheight && backsector->ceilingheight <= frontsector->ceilingheight && (viewz > backsector->ceilingheight)) diff --git a/src/r_things.c b/src/r_things.c index f0538291c..ddae1d7ec 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -984,13 +984,12 @@ static void R_SplitSprite(vissprite_t *sprite) for (i = 1; i < sector->numlights; i++) { - fixed_t testheight = sector->lightlist[i].height; + fixed_t testheight; if (!(sector->lightlist[i].caster->flags & FF_CUTSPRITES)) continue; - if (sector->lightlist[i].slope) - testheight = P_GetZAt(sector->lightlist[i].slope, sprite->gx, sprite->gy); + testheight = P_GetLightZAt(§or->lightlist[i], sprite->gx, sprite->gy); if (testheight >= sprite->gzt) continue; @@ -1606,14 +1605,14 @@ static void R_ProjectSprite(mobj_t *thing) } else { - if (thing->subsector->sector->numlights) { light = thing->subsector->sector->numlights - 1; - for (lightnum = 1; lightnum < thing->subsector->sector->numlights; lightnum++) { - fixed_t h = thing->subsector->sector->lightlist[lightnum].slope ? P_GetZAt(thing->subsector->sector->lightlist[lightnum].slope, interp.x, interp.y) - : thing->subsector->sector->lightlist[lightnum].height; + for (lightnum = 1; lightnum < thing->subsector->sector->numlights; lightnum++) + { + fixed_t h = P_GetLightZAt(&thing->subsector->sector->lightlist[lightnum], interp.x, interp.y); + if (h <= gzt) { light = lightnum - 1; @@ -2283,6 +2282,7 @@ static void R_CreateDrawNodes(void) { if (!PolyObjects[i].visplane) continue; + plane = PolyObjects[i].visplane; R_PlaneBounds(plane); @@ -2291,6 +2291,7 @@ static void R_CreateDrawNodes(void) PolyObjects[i].visplane = NULL; continue; } + entry = R_CreateDrawNode(&nodehead); entry->plane = plane; // note: no seg is set, for what should be obvious reasons @@ -2301,6 +2302,7 @@ static void R_CreateDrawNodes(void) return; R_SortVisSprites(); + for (rover = vsprsortedhead.prev; rover != &vsprsortedhead; rover = rover->prev) { if (rover->szt > vid.height || rover->sz < 0) @@ -2319,13 +2321,8 @@ static void R_CreateDrawNodes(void) continue; // Effective height may be different for each comparison in the case of slopes - if (r2->plane->slope) - { - planeobjectz = P_GetZAt(r2->plane->slope, rover->gx, rover->gy); - planecameraz = P_GetZAt(r2->plane->slope, viewx, viewy); - } - else - planeobjectz = planecameraz = r2->plane->height; + planeobjectz = P_GetZAt(r2->plane->slope, rover->gx, rover->gy, r2->plane->height); + planecameraz = P_GetZAt(r2->plane->slope, viewx, viewy, r2->plane->height); if (rover->mobjflags & MF_NOCLIPHEIGHT) { @@ -2360,6 +2357,7 @@ static void R_CreateDrawNodes(void) if (r2->seg->frontscale[i] > rover->sortscale) break; } + if (i > x2) continue; } @@ -2373,31 +2371,22 @@ static void R_CreateDrawNodes(void) else if (r2->thickseg) { fixed_t topplaneobjectz, topplanecameraz, botplaneobjectz, botplanecameraz; + if (rover->x1 > r2->thickseg->x2 || rover->x2 < r2->thickseg->x1) continue; scale = r2->thickseg->scale1 > r2->thickseg->scale2 ? r2->thickseg->scale1 : r2->thickseg->scale2; if (scale <= rover->sortscale) continue; + scale = r2->thickseg->scale1 + (r2->thickseg->scalestep * (sintersect - r2->thickseg->x1)); if (scale <= rover->sortscale) continue; - if (*r2->ffloor->t_slope) - { - topplaneobjectz = P_GetZAt(*r2->ffloor->t_slope, rover->gx, rover->gy); - topplanecameraz = P_GetZAt(*r2->ffloor->t_slope, viewx, viewy); - } - else - topplaneobjectz = topplanecameraz = *r2->ffloor->topheight; - - if (*r2->ffloor->b_slope) - { - botplaneobjectz = P_GetZAt(*r2->ffloor->b_slope, rover->gx, rover->gy); - botplanecameraz = P_GetZAt(*r2->ffloor->b_slope, viewx, viewy); - } - else - botplaneobjectz = botplanecameraz = *r2->ffloor->bottomheight; + topplaneobjectz = P_GetFFloorTopZAt (r2->ffloor, rover->gx, rover->gy); + topplanecameraz = P_GetFFloorTopZAt (r2->ffloor, viewx, viewy); + botplaneobjectz = P_GetFFloorBottomZAt(r2->ffloor, rover->gx, rover->gy); + botplanecameraz = P_GetFFloorBottomZAt(r2->ffloor, viewx, viewy); if ((topplanecameraz > viewz && botplanecameraz < viewz) || (topplanecameraz < viewz && rover->gzt < topplaneobjectz) || From 00e59c480e545add3eeff6628f266a28a5e2b5bd Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 20 Apr 2025 23:19:15 +0200 Subject: [PATCH 4/5] remove lagless camera from the menu and change cvar name to reset it for everyone --- src/d_netcmd.c | 2 +- src/m_menu.c | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 9b68717db..8a6c17c1f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -303,7 +303,7 @@ static void UseMouse_OnChange(void) consvar_t cv_mouseturn = {"mouseturn", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; // Lagless camera! Yay! -consvar_t cv_laglesscam = {"laglesscamera", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_laglesscam = {"lagless_camera", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_verticallook[MAXSPLITSCREENPLAYERS] = { {"verticallook", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}, diff --git a/src/m_menu.c b/src/m_menu.c index b5a1bd8d2..f84d2a85a 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1934,19 +1934,16 @@ static menuitem_t OP_CamOptionsMenu[] = {IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Field of View",&cv_fov, 30}, - {IT_STRING | IT_CVAR, NULL, "Lagless Camera", &cv_laglesscam, 50}, - - {IT_STRING | IT_SUBMENU, NULL, "Player 1 Camera options...", &OP_Player1CamOptionsDef, 70}, - {IT_STRING | IT_SUBMENU, NULL, "Player 2 Camera options...", &OP_Player2CamOptionsDef, 80}, - {IT_STRING | IT_SUBMENU, NULL, "Player 3 Camera options...", &OP_Player3CamOptionsDef, 90}, - {IT_STRING | IT_SUBMENU, NULL, "Player 4 Camera options...", &OP_Player4CamOptionsDef, 100}, + {IT_STRING | IT_SUBMENU, NULL, "Player 1 Camera options...", &OP_Player1CamOptionsDef, 50}, + {IT_STRING | IT_SUBMENU, NULL, "Player 2 Camera options...", &OP_Player2CamOptionsDef, 60}, + {IT_STRING | IT_SUBMENU, NULL, "Player 3 Camera options...", &OP_Player3CamOptionsDef, 70}, + {IT_STRING | IT_SUBMENU, NULL, "Player 4 Camera options...", &OP_Player4CamOptionsDef, 80}, }; static const char* OP_CamOptionsTooltips[] = { NULL, "Player field of view.", - "Removes Camera Lag in netgames\nMay cause Camera stutters in poor net conditions.", NULL, NULL, NULL, From b622fbb6533067e0191e20682e3a88a1a08597e9 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 20 Apr 2025 23:34:59 +0200 Subject: [PATCH 5/5] add mindelay and gentlemens stuff to menu --- src/d_clisrv.c | 6 +++--- src/d_clisrv.h | 2 +- src/d_netcmd.c | 2 +- src/g_game.c | 2 +- src/m_menu.c | 51 ++++++++++++++++++++++++++++++++++++-------------- 5 files changed, 43 insertions(+), 20 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index df35d8375..66c71abfe 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -114,10 +114,10 @@ boolean server_lagless; static void Lagless_OnChange(void) { /* don't back out of dishonesty, or go lagless after playing honestly */ - if (cv_lagless.value && gamestate == GS_LEVEL) + if (!cv_gentlemens.value && gamestate == GS_LEVEL) server_lagless = true; - /*if (cv_lagless.value) + /*if (!cv_gentlemens.value) HU_AddChatText(M_GetText("\x82*Gentlemans Delay has been disabled for Serverplayer."), false); else HU_AddChatText(M_GetText("\x82*Gentlemans Delay will be enabled for Serverplayer."), false);*/ @@ -125,7 +125,7 @@ static void Lagless_OnChange(void) static CV_PossibleValue_t mindelay_cons_t[] = {{0, "MIN"}, {30, "MAX"}, {0, NULL}}; consvar_t cv_mindelay = {"mindelay", "0", CV_SAVE, mindelay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_lagless = {"serverlagless", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Lagless_OnChange, 0, NULL, NULL, 0, 0, NULL}; // this should be a netvar Zzz... +consvar_t cv_gentlemens = {"gentlemensdelay", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Lagless_OnChange, 0, NULL, NULL, 0, 0, NULL}; // this should be a netvar Zzz... SINT8 nodetoplayer[MAXNETNODES]; SINT8 nodetoplayer2[MAXNETNODES]; // say the numplayer for this node if any (splitscreen) diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 809cedd2e..8ad038a36 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -588,7 +588,7 @@ extern tic_t servermaxping; extern boolean server_lagless; extern tic_t simulated_lag; extern tic_t lowest_lag; -extern consvar_t cv_mindelay, cv_lagless; +extern consvar_t cv_mindelay, cv_gentlemens; extern consvar_t #ifdef VANILLAJOINNEXTROUND diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 8a6c17c1f..ebbf91736 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -928,7 +928,7 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_netstat); CV_RegisterVar(&cv_netticbuffer); CV_RegisterVar(&cv_mindelay); - CV_RegisterVar(&cv_lagless); + CV_RegisterVar(&cv_gentlemens); #ifdef NETGAME_DEVMODE CV_RegisterVar(&cv_fishcake); diff --git a/src/g_game.c b/src/g_game.c index bc6c162a5..7acda852e 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1289,7 +1289,7 @@ static void G_DoLoadLevel(boolean resetplayer) // clear hud messages remains (usually from game startup) CON_ClearHUD(); - server_lagless = cv_lagless.value; + server_lagless = !cv_gentlemens.value; G_ResetAllDeviceRumbles(); } diff --git a/src/m_menu.c b/src/m_menu.c index f84d2a85a..72c28857c 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2094,6 +2094,21 @@ static menuitem_t OP_GameOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "Restrict Character Changes", &cv_restrictskinchange, 150}, }; +enum +{ + op_game_ittggl, + op_game_spd, + op_game_frantic, + op_game_encore, + op_game_numlaps, + op_game_countdown, + op_game_timelimit, + op_game_startbump, + op_game_karma, + op_game_forcechar, + op_game_restrictchar, +}; + static const char* OP_GameTooltips[] = { "Toggles for all in-game items.", @@ -2282,33 +2297,39 @@ static menuitem_t OP_SaturnMenu[] = {IT_STRING | IT_CVAR, NULL, "Serverqueue waittime", &cv_connectawaittime, 10}, - {IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 20}, + {IT_STRING | IT_CVAR, NULL, "Minimum Input Delay", &cv_mindelay, 20}, + {IT_STRING | IT_CVAR, NULL, "Gentlemens Ping", &cv_gentlemens, 25}, - {IT_STRING | IT_CVAR, NULL, "Colorized Speedlines", &cv_coloredspeedlines, 30}, - {IT_STRING | IT_CVAR, NULL, "Colorized Sneakertrails", &cv_coloredsneakertrail, 35}, + {IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 35}, - {IT_STRING | IT_CVAR, NULL, "Player Blendeffects", &cv_playerblendeffects, 45}, + {IT_STRING | IT_CVAR, NULL, "Colorized Speedlines", &cv_coloredspeedlines, 45}, + {IT_STRING | IT_CVAR, NULL, "Colorized Sneakertrails", &cv_coloredsneakertrail, 40}, - {IT_STRING | IT_CVAR, NULL, "Bananadrag Jitter", &cv_bananajitter, 55}, + {IT_STRING | IT_CVAR, NULL, "Player Blendeffects", &cv_playerblendeffects, 50}, - {IT_STRING | IT_CVAR, NULL, "Midair Driftsparks", &cv_airsparks, 65}, + {IT_STRING | IT_CVAR, NULL, "Bananadrag Jitter", &cv_bananajitter, 60}, - {IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 75}, - {IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 85}, + {IT_STRING | IT_CVAR, NULL, "Midair Driftsparks", &cv_airsparks, 70}, - {IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 90}, + {IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 80}, - {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 100}, + {IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 90}, - {IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 110}, - {IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 115}, - {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 125}, // uwu + {IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 100}, + + {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 110}, + + {IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 120}, + {IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 125}, + {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 130}, // uwu }; static const char* OP_SaturnTooltips[] = { NULL, "How long can the game wait before it kicks you out from the server\nconnecting screen.", + "Practice for online play! 0 = instant response.", + "Simulate online input delay when hosting a server.\nValue choosen by Player with the lowest ping", "How much speen do you want?", "Colourize the speedlines in your skincolor if you go fast enough!", "Colourize the sneaker flame trails in your skincolor!", @@ -2328,6 +2349,8 @@ enum { sm_header, sm_waittime, + sm_mindelay, + sm_gentlemens, sm_skinselspeed, sm_colorlines, sm_colorflames, @@ -8030,7 +8053,7 @@ static void M_Options(INT32 choice) OP_DataOptionsMenu[3].status = (Playing()) ? (IT_GRAYEDOUT) : (IT_STRING|IT_SUBMENU); // Erase data #endif - OP_GameOptionsMenu[3].status = (M_SecretUnlocked(SECRET_ENCORE)) ? (IT_CVAR|IT_STRING) : IT_SECRET; // cv_kartencore + OP_GameOptionsMenu[op_game_encore].status = (M_SecretUnlocked(SECRET_ENCORE)) ? (IT_CVAR|IT_STRING) : IT_SECRET; // cv_kartencore OP_MainDef.prevMenu = currentMenu; M_SetupNextMenu(&OP_MainDef);