big cleanup "GetZAt" stuff
GetZAt now takes 4 parameters (slope, x, y, normalheight) and everything now uses their designated getzatfunction
This commit is contained in:
1 parent
b13f104fde
commit
0f0bef2a04
16 files changed
+442
-593
No files matched your search
+2
-5
@@ -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)
|
||||
{
|
||||
|
||||
+191
-197
@@ -581,9 +581,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)
|
||||
@@ -637,14 +637,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;
|
||||
}
|
||||
}
|
||||
@@ -652,14 +652,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;
|
||||
}
|
||||
}
|
||||
@@ -670,10 +670,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) {\
|
||||
@@ -684,10 +684,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);\
|
||||
@@ -696,8 +696,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++)
|
||||
@@ -782,7 +782,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)
|
||||
{
|
||||
@@ -791,8 +791,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)
|
||||
@@ -802,8 +802,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
|
||||
@@ -867,11 +867,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)
|
||||
@@ -884,17 +884,17 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf)
|
||||
gpatch = W_CachePatchNum(splat->patch, PU_SPRITE);
|
||||
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;
|
||||
@@ -1370,13 +1370,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;
|
||||
}
|
||||
@@ -1385,23 +1385,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)
|
||||
@@ -1449,7 +1446,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)
|
||||
{
|
||||
@@ -1461,29 +1458,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)
|
||||
{
|
||||
@@ -1497,24 +1494,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);
|
||||
}
|
||||
}
|
||||
@@ -1577,10 +1574,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);
|
||||
@@ -1638,10 +1635,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);
|
||||
@@ -1802,10 +1799,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;
|
||||
@@ -1864,10 +1861,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)
|
||||
{
|
||||
@@ -1884,10 +1881,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);
|
||||
@@ -1897,17 +1894,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);
|
||||
}
|
||||
@@ -1977,10 +1974,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)
|
||||
{
|
||||
@@ -2127,10 +2124,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)
|
||||
{
|
||||
@@ -2224,8 +2221,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
|
||||
{
|
||||
@@ -2235,8 +2232,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
|
||||
{
|
||||
@@ -2245,11 +2242,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)
|
||||
@@ -2363,8 +2357,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
|
||||
{
|
||||
@@ -2374,8 +2368,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
|
||||
{
|
||||
@@ -2623,7 +2617,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);
|
||||
|
||||
@@ -2660,8 +2654,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);
|
||||
@@ -2673,14 +2667,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;
|
||||
}
|
||||
}
|
||||
@@ -2688,14 +2682,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;
|
||||
}
|
||||
}
|
||||
@@ -2703,37 +2697,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));
|
||||
@@ -2833,7 +2827,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
|
||||
{
|
||||
@@ -3031,7 +3025,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;
|
||||
}
|
||||
|
||||
@@ -3365,9 +3359,9 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
|
||||
// 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);
|
||||
|
||||
@@ -3469,8 +3463,8 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3563,11 +3557,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;
|
||||
@@ -3664,10 +3658,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)
|
||||
{
|
||||
@@ -3753,7 +3747,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);
|
||||
|
||||
@@ -3792,9 +3786,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
|
||||
{
|
||||
@@ -4691,8 +4685,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);
|
||||
@@ -4705,9 +4699,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
|
||||
@@ -4808,7 +4802,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;
|
||||
@@ -4864,13 +4858,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;
|
||||
@@ -4880,13 +4874,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;
|
||||
@@ -4896,13 +4890,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)
|
||||
@@ -4919,13 +4913,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;
|
||||
}
|
||||
|
||||
@@ -4944,8 +4938,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)
|
||||
@@ -5047,8 +5041,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);
|
||||
@@ -5080,7 +5074,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];
|
||||
|
||||
@@ -5088,18 +5082,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;
|
||||
@@ -5132,8 +5126,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;
|
||||
}
|
||||
@@ -5368,7 +5362,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;
|
||||
}
|
||||
@@ -5385,11 +5379,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));
|
||||
|
||||
@@ -5405,8 +5399,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);
|
||||
@@ -6044,7 +6038,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;
|
||||
|
||||
+3
-7
@@ -3773,7 +3773,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);
|
||||
}
|
||||
@@ -4929,12 +4930,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;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1767,7 +1767,7 @@ FUNCINLINE static ATTRINLINE 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;
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -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;
|
||||
|
||||
+6
-12
@@ -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);
|
||||
@@ -4103,10 +4103,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)
|
||||
@@ -4117,19 +4114,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)
|
||||
{
|
||||
@@ -4143,6 +4136,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;
|
||||
}
|
||||
|
||||
+45
-95
@@ -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);
|
||||
}
|
||||
@@ -1919,9 +1919,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)
|
||||
@@ -2879,14 +2877,8 @@ static boolean P_SceneryZMovement(mobj_t *mo)
|
||||
|| ((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)
|
||||
{
|
||||
@@ -2955,14 +2947,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)
|
||||
{
|
||||
@@ -3183,14 +3169,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)))
|
||||
@@ -9681,12 +9661,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;
|
||||
@@ -10752,9 +10728,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;
|
||||
@@ -10762,9 +10737,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;
|
||||
@@ -11063,14 +11037,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)
|
||||
{
|
||||
@@ -11138,14 +11107,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<<FRACBITS) - FixedMul(128<<FRACBITS, mapobjectscale) - mobj->height;
|
||||
@@ -11317,10 +11283,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;
|
||||
@@ -11434,18 +11398,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;
|
||||
@@ -11456,9 +11416,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;
|
||||
@@ -11478,13 +11436,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)
|
||||
@@ -12057,9 +12011,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;
|
||||
|
||||
@@ -12190,9 +12142,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);
|
||||
|
||||
+3
-4
@@ -1000,14 +1000,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
|
||||
|
||||
+5
-5
@@ -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;
|
||||
|
||||
+11
-6
@@ -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
|
||||
|
||||
+4
-8
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+19
-10
@@ -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;
|
||||
|
||||
|
||||
+21
-35
@@ -483,11 +483,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)
|
||||
@@ -850,13 +847,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)
|
||||
@@ -901,9 +893,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,
|
||||
@@ -915,9 +905,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)))
|
||||
{
|
||||
@@ -935,6 +923,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;
|
||||
@@ -956,13 +945,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))
|
||||
@@ -988,18 +973,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))
|
||||
@@ -1167,7 +1150,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;
|
||||
@@ -1188,7 +1171,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)
|
||||
{
|
||||
@@ -1197,8 +1180,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)
|
||||
@@ -1222,6 +1206,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
|
||||
@@ -1245,7 +1230,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;
|
||||
|
||||
+5
-5
@@ -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);
|
||||
|
||||
|
||||
+100
-166
@@ -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))
|
||||
|
||||
+18
-29
@@ -988,13 +988,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;
|
||||
@@ -1618,14 +1617,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;
|
||||
@@ -2295,6 +2294,7 @@ static void R_CreateDrawNodes(void)
|
||||
{
|
||||
if (!PolyObjects[i].visplane)
|
||||
continue;
|
||||
|
||||
plane = PolyObjects[i].visplane;
|
||||
R_PlaneBounds(plane);
|
||||
|
||||
@@ -2303,6 +2303,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
|
||||
@@ -2313,6 +2314,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)
|
||||
@@ -2331,13 +2333,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)
|
||||
{
|
||||
@@ -2372,6 +2369,7 @@ static void R_CreateDrawNodes(void)
|
||||
if (r2->seg->frontscale[i] > rover->sortscale)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i > x2)
|
||||
continue;
|
||||
}
|
||||
@@ -2385,31 +2383,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) ||
|
||||
|
||||
Reference in new issue
Block a user