Encapsulate plane height checks

This commit is contained in:
Louis-Antoine 2020-03-22 15:17:16 +01:00
parent 077543f2e9
commit 6f9422d380
14 changed files with 291 additions and 476 deletions

View File

@ -931,11 +931,8 @@ static inline void AM_drawWalls(void)
l.b.y = lines[i].v2->y >> FRACTOMAPBITS; l.b.y = lines[i].v2->y >> FRACTOMAPBITS;
#define SLOPEPARAMS(slope, end1, end2, normalheight) \ #define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \ end1 = P_GetZAt2(slope, lines[i].v1->x, lines[i].v1->y, normalheight); \
end1 = P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y); \ end2 = P_GetZAt2(slope, lines[i].v2->x, lines[i].v2->y, normalheight);
end2 = P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y); \
} else \
end1 = end2 = normalheight;
SLOPEPARAMS(lines[i].frontsector->f_slope, frontf1, frontf2, lines[i].frontsector->floorheight) SLOPEPARAMS(lines[i].frontsector->f_slope, frontf1, frontf2, lines[i].frontsector->floorheight)
SLOPEPARAMS(lines[i].frontsector->c_slope, frontc1, frontc2, lines[i].frontsector->ceilingheight) SLOPEPARAMS(lines[i].frontsector->c_slope, frontc1, frontc2, lines[i].frontsector->ceilingheight)

View File

@ -1126,26 +1126,16 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
else else
solid = false; solid = false;
if (list[i].slope) temp = P_GetLightZAt(&list[i], v1x, v1y);
{ height = FIXED_TO_FLOAT(temp);
temp = P_GetZAt(list[i].slope, v1x, v1y); temp = P_GetLightZAt(&list[i], v2x, v2y);
height = FIXED_TO_FLOAT(temp); endheight = FIXED_TO_FLOAT(temp);
temp = P_GetZAt(list[i].slope, v2x, v2y);
endheight = FIXED_TO_FLOAT(temp);
}
else
height = endheight = FIXED_TO_FLOAT(list[i].height);
if (solid) if (solid)
{ {
if (*list[i].caster->b_slope) temp = P_GetFFloorBottomZAt(list[i].caster, v1x, v1y);
{ bheight = FIXED_TO_FLOAT(temp);
temp = P_GetZAt(*list[i].caster->b_slope, v1x, v1y); temp = P_GetFFloorBottomZAt(list[i].caster, v2x, v2y);
bheight = FIXED_TO_FLOAT(temp); endbheight = FIXED_TO_FLOAT(temp);
temp = P_GetZAt(*list[i].caster->b_slope, v2x, v2y);
endbheight = FIXED_TO_FLOAT(temp);
}
else
bheight = endbheight = FIXED_TO_FLOAT(*list[i].caster->bottomheight);
} }
if (endheight >= endtop && height >= top) if (endheight >= endtop && height >= top)
@ -1158,15 +1148,10 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
if (i + 1 < sector->numlights) if (i + 1 < sector->numlights)
{ {
if (list[i+1].slope) temp = P_GetLightZAt(&list[i+1], v1x, v1y);
{ bheight = FIXED_TO_FLOAT(temp);
temp = P_GetZAt(list[i+1].slope, v1x, v1y); temp = P_GetLightZAt(&list[i+1], v2x, v2y);
bheight = FIXED_TO_FLOAT(temp); endbheight = FIXED_TO_FLOAT(temp);
temp = P_GetZAt(list[i+1].slope, v2x, v2y);
endbheight = FIXED_TO_FLOAT(temp);
}
else
bheight = endbheight = FIXED_TO_FLOAT(list[i+1].height);
} }
else else
{ {
@ -1305,11 +1290,8 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
v2y = FLOAT_TO_FIXED(ve.y); v2y = FLOAT_TO_FIXED(ve.y);
#define SLOPEPARAMS(slope, end1, end2, normalheight) \ #define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \ end1 = P_GetZAt2(slope, v1x, v1y, normalheight); \
end1 = P_GetZAt(slope, v1x, v1y); \ end2 = P_GetZAt2(slope, v2x, v2y, normalheight);
end2 = P_GetZAt(slope, v2x, v2y); \
} else \
end1 = end2 = normalheight;
SLOPEPARAMS(gr_frontsector->c_slope, worldtop, worldtopslope, gr_frontsector->ceilingheight) SLOPEPARAMS(gr_frontsector->c_slope, worldtop, worldtopslope, gr_frontsector->ceilingheight)
SLOPEPARAMS(gr_frontsector->f_slope, worldbottom, worldbottomslope, gr_frontsector->floorheight) SLOPEPARAMS(gr_frontsector->f_slope, worldbottom, worldbottomslope, gr_frontsector->floorheight)
@ -1916,10 +1898,10 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture); texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
} }
h = *rover->t_slope ? P_GetZAt(*rover->t_slope, v1x, v1y) : *rover->topheight; h = P_GetFFloorTopZAt (rover, v1x, v1y);
hS = *rover->t_slope ? P_GetZAt(*rover->t_slope, v2x, v2y) : *rover->topheight; hS = P_GetFFloorTopZAt (rover, v2x, v2y);
l = *rover->b_slope ? P_GetZAt(*rover->b_slope, v1x, v1y) : *rover->bottomheight; l = P_GetFFloorBottomZAt(rover, v1x, v1y);
lS = *rover->b_slope ? P_GetZAt(*rover->b_slope, v2x, v2y) : *rover->bottomheight; lS = P_GetFFloorBottomZAt(rover, v2x, v2y);
if (!(*rover->t_slope) && !gr_frontsector->c_slope && !gr_backsector->c_slope && h > highcut) if (!(*rover->t_slope) && !gr_frontsector->c_slope && !gr_backsector->c_slope && h > highcut)
h = hS = highcut; h = hS = highcut;
if (!(*rover->b_slope) && !gr_frontsector->f_slope && !gr_backsector->f_slope && l < lowcut) if (!(*rover->b_slope) && !gr_frontsector->f_slope && !gr_backsector->f_slope && l < lowcut)
@ -2055,10 +2037,10 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
newline = rover->master->frontsector->lines[0] + linenum; newline = rover->master->frontsector->lines[0] + linenum;
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture); texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
} }
h = *rover->t_slope ? P_GetZAt(*rover->t_slope, v1x, v1y) : *rover->topheight; h = P_GetFFloorTopZAt (rover, v1x, v1y);
hS = *rover->t_slope ? P_GetZAt(*rover->t_slope, v2x, v2y) : *rover->topheight; hS = P_GetFFloorTopZAt (rover, v2x, v2y);
l = *rover->b_slope ? P_GetZAt(*rover->b_slope, v1x, v1y) : *rover->bottomheight; l = P_GetFFloorBottomZAt(rover, v1x, v1y);
lS = *rover->b_slope ? P_GetZAt(*rover->b_slope, v2x, v2y) : *rover->bottomheight; lS = P_GetFFloorBottomZAt(rover, v2x, v2y);
if (!(*rover->t_slope) && !gr_frontsector->c_slope && !gr_backsector->c_slope && h > highcut) if (!(*rover->t_slope) && !gr_frontsector->c_slope && !gr_backsector->c_slope && h > highcut)
h = hS = highcut; h = hS = highcut;
if (!(*rover->b_slope) && !gr_frontsector->f_slope && !gr_backsector->f_slope && l < lowcut) if (!(*rover->b_slope) && !gr_frontsector->f_slope && !gr_backsector->f_slope && l < lowcut)
@ -2176,24 +2158,21 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks
v2x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->x); v2x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->x);
v2y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->y); v2y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->y);
#define SLOPEPARAMS(slope, end1, end2, normalheight) \ #define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \ end1 = P_GetZAt2(slope, v1x, v1y, normalheight); \
end1 = P_GetZAt(slope, v1x, v1y); \ end2 = P_GetZAt2(slope, v2x, v2y, normalheight);
end2 = P_GetZAt(slope, v2x, v2y); \
} else \
end1 = end2 = normalheight;
SLOPEPARAMS(afrontsector->f_slope, frontf1, frontf2, afrontsector->floorheight) SLOPEPARAMS(afrontsector->f_slope, frontf1, frontf2, afrontsector-> floorheight)
SLOPEPARAMS(afrontsector->c_slope, frontc1, frontc2, afrontsector->ceilingheight) SLOPEPARAMS(afrontsector->c_slope, frontc1, frontc2, afrontsector->ceilingheight)
SLOPEPARAMS( abacksector->f_slope, backf1, backf2, abacksector->floorheight) SLOPEPARAMS( abacksector->f_slope, backf1, backf2, abacksector-> floorheight)
SLOPEPARAMS( abacksector->c_slope, backc1, backc2, abacksector->ceilingheight) SLOPEPARAMS( abacksector->c_slope, backc1, backc2, abacksector->ceilingheight)
#undef SLOPEPARAMS #undef SLOPEPARAMS
} }
else else
{ {
frontf1 = frontf2 = afrontsector->floorheight; frontf1 = frontf2 = afrontsector-> floorheight;
frontc1 = frontc2 = afrontsector->ceilingheight; frontc1 = frontc2 = afrontsector->ceilingheight;
backf1 = backf2 = abacksector->floorheight; backf1 = backf2 = abacksector-> floorheight;
backc1 = backc2 = abacksector->ceilingheight; backc1 = backc2 = abacksector->ceilingheight;
} }
// properly render skies (consider door "open" if both ceilings are sky) // properly render skies (consider door "open" if both ceilings are sky)
// same for floors // same for floors
@ -2735,16 +2714,13 @@ static void HWR_AddLine(seg_t * line)
fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends
#define SLOPEPARAMS(slope, end1, end2, normalheight) \ #define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \ end1 = P_GetZAt2(slope, v1x, v1y, normalheight); \
end1 = P_GetZAt(slope, v1x, v1y); \ end2 = P_GetZAt2(slope, v2x, v2y, normalheight);
end2 = P_GetZAt(slope, v2x, v2y); \
} else \
end1 = end2 = normalheight;
SLOPEPARAMS(gr_frontsector->f_slope, frontf1, frontf2, gr_frontsector->floorheight) SLOPEPARAMS(gr_frontsector->f_slope, frontf1, frontf2, gr_frontsector-> floorheight)
SLOPEPARAMS(gr_frontsector->c_slope, frontc1, frontc2, gr_frontsector->ceilingheight) SLOPEPARAMS(gr_frontsector->c_slope, frontc1, frontc2, gr_frontsector->ceilingheight)
SLOPEPARAMS( gr_backsector->f_slope, backf1, backf2, gr_backsector->floorheight) SLOPEPARAMS( gr_backsector->f_slope, backf1, backf2, gr_backsector-> floorheight)
SLOPEPARAMS( gr_backsector->c_slope, backc1, backc2, gr_backsector->ceilingheight) SLOPEPARAMS( gr_backsector->c_slope, backc1, backc2, gr_backsector->ceilingheight)
#undef SLOPEPARAMS #undef SLOPEPARAMS
// if both ceilings are skies, consider it always "open" // if both ceilings are skies, consider it always "open"
// same for floors // same for floors
@ -3307,20 +3283,10 @@ static void HWR_Subsector(size_t num)
} }
else else
{ {
cullFloorHeight = locFloorHeight = gr_frontsector->floorheight; cullFloorHeight = P_GetSectorFloorZAt (gr_frontsector, viewx, viewy);
cullCeilingHeight = locCeilingHeight = gr_frontsector->ceilingheight; cullCeilingHeight = P_GetSectorCeilingZAt(gr_frontsector, viewx, viewy);
locFloorHeight = P_GetSectorFloorZAt (gr_frontsector, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
if (gr_frontsector->f_slope) locCeilingHeight = P_GetSectorCeilingZAt(gr_frontsector, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
{
cullFloorHeight = P_GetZAt(gr_frontsector->f_slope, viewx, viewy);
locFloorHeight = P_GetZAt(gr_frontsector->f_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
}
if (gr_frontsector->c_slope)
{
cullCeilingHeight = P_GetZAt(gr_frontsector->c_slope, viewx, viewy);
locCeilingHeight = P_GetZAt(gr_frontsector->c_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
}
} }
// ----- end special tricks ----- // ----- end special tricks -----
@ -3412,13 +3378,8 @@ static void HWR_Subsector(size_t num)
fixed_t cullHeight, centerHeight; fixed_t cullHeight, centerHeight;
// bottom plane // bottom plane
if (*rover->b_slope) cullHeight = P_GetFFloorBottomZAt(rover, viewx, viewy);
{ centerHeight = P_GetFFloorBottomZAt(rover, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
cullHeight = P_GetZAt(*rover->b_slope, viewx, viewy);
centerHeight = P_GetZAt(*rover->b_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
}
else
cullHeight = centerHeight = *rover->bottomheight;
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES)) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES))
continue; continue;
@ -3478,13 +3439,8 @@ static void HWR_Subsector(size_t num)
} }
// top plane // top plane
if (*rover->t_slope) cullHeight = P_GetFFloorTopZAt(rover, viewx, viewy);
{ centerHeight = P_GetFFloorTopZAt(rover, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
cullHeight = P_GetZAt(*rover->t_slope, viewx, viewy);
centerHeight = P_GetZAt(*rover->t_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
}
else
cullHeight = centerHeight = *rover->topheight;
if (centerHeight >= locFloorHeight && if (centerHeight >= locFloorHeight &&
centerHeight <= locCeilingHeight && centerHeight <= locCeilingHeight &&
@ -4175,8 +4131,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
for (i = 1; i < sector->numlights; i++) for (i = 1; i < sector->numlights; i++)
{ {
fixed_t h = sector->lightlist[i].slope ? P_GetZAt(sector->lightlist[i].slope, spr->mobj->x, spr->mobj->y) fixed_t h = P_GetLightZAt(&sector->lightlist[i], spr->mobj->x, spr->mobj->y);
: sector->lightlist[i].height;
if (h <= temp) if (h <= temp)
{ {
if (!(spr->mobj->frame & FF_FULLBRIGHT)) if (!(spr->mobj->frame & FF_FULLBRIGHT))
@ -4201,15 +4156,10 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
if (i + 1 < sector->numlights) if (i + 1 < sector->numlights)
{ {
if (list[i+1].slope) temp = P_GetLightZAt(&list[i+1], v1x, v1y);
{ bheight = FIXED_TO_FLOAT(temp);
temp = P_GetZAt(list[i+1].slope, v1x, v1y); temp = P_GetLightZAt(&list[i+1], v2x, v2y);
bheight = FIXED_TO_FLOAT(temp); endbheight = FIXED_TO_FLOAT(temp);
temp = P_GetZAt(list[i+1].slope, v2x, v2y);
endbheight = FIXED_TO_FLOAT(temp);
}
else
bheight = endbheight = FIXED_TO_FLOAT(list[i+1].height);
} }
else else
{ {

View File

@ -1027,7 +1027,7 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling)
{ {
// Truncate position to match where mapthing would be when spawned // Truncate position to match where mapthing would be when spawned
// (this applies to every further P_GetZAt call as well) // (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))) if (((cheight - player->mo->z - player->mo->height)>>FRACBITS) >= (1 << (16-ZSHIFT)))
{ {
@ -1038,7 +1038,7 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling)
} }
else 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))) 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"), CONS_Printf(M_GetText("Sorry, you're too %s to place this object (max: %d %s).\n"), M_GetText("high"),
@ -1085,12 +1085,12 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
mt->y = (INT16)(player->mo->y>>FRACBITS); mt->y = (INT16)(player->mo->y>>FRACBITS);
if (ceiling) 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->z = (UINT16)((cheight - player->mo->z - player->mo->height)>>FRACBITS); mt->z = (UINT16)((cheight - player->mo->z - player->mo->height)>>FRACBITS);
} }
else 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->z = (UINT16)((player->mo->z - fheight)>>FRACBITS); mt->z = (UINT16)((player->mo->z - fheight)>>FRACBITS);
} }
mt->angle = (INT16)(FixedInt(AngleFixed(player->mo->angle))); mt->angle = (INT16)(FixedInt(AngleFixed(player->mo->angle)));
@ -1336,12 +1336,12 @@ void OP_ObjectplaceMovement(player_t *player)
if (!!(mobjinfo[op_currentthing].flags & MF_SPAWNCEILING) ^ !!(cv_opflags.value & MTF_OBJECTFLIP)) 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); op_displayflags = (UINT16)((cheight - player->mo->z - mobjinfo[op_currentthing].height)>>FRACBITS);
} }
else 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 = (UINT16)((player->mo->z - fheight)>>FRACBITS);
} }
op_displayflags <<= ZSHIFT; op_displayflags <<= ZSHIFT;

View File

@ -3214,8 +3214,8 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
glidesector = R_PointInSubsector(player->mo->x + platx, player->mo->y + platy); glidesector = R_PointInSubsector(player->mo->x + platx, player->mo->y + platy);
floorz = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y) : glidesector->sector->floorheight; floorz = P_GetSectorFloorZAt (glidesector->sector, player->mo->x, player->mo->y);
ceilingz = glidesector->sector->c_slope ? P_GetZAt(glidesector->sector->c_slope, player->mo->x, player->mo->y) : glidesector->sector->ceilingheight; ceilingz = P_GetSectorCeilingZAt(glidesector->sector, player->mo->x, player->mo->y);
if (glidesector->sector != player->mo->subsector->sector) if (glidesector->sector != player->mo->subsector->sector)
{ {
@ -3230,13 +3230,8 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER)) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER))
continue; continue;
topheight = *rover->topheight; topheight = P_GetFFloorTopZAt (rover, player->mo->x, player->mo->y);
bottomheight = *rover->bottomheight; bottomheight = P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y);
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y);
floorclimb = true; floorclimb = true;
@ -3389,13 +3384,8 @@ isblocking:
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP)) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
continue; continue;
topheight = *rover->topheight; topheight = P_GetFFloorTopZAt (rover, slidemo->x, slidemo->y);
bottomheight = *rover->bottomheight; bottomheight = P_GetFFloorBottomZAt(rover, slidemo->x, slidemo->y);
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, slidemo->x, slidemo->y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, slidemo->x, slidemo->y);
if (topheight < slidemo->z) if (topheight < slidemo->z)
continue; continue;
@ -3600,9 +3590,7 @@ static void P_CheckLavaWall(mobj_t *mo, sector_t *sec)
if (rover->master->flags & ML_BLOCKMONSTERS) if (rover->master->flags & ML_BLOCKMONSTERS)
continue; continue;
topheight = *rover->t_slope ? topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y);
P_GetZAt(*rover->t_slope, mo->x, mo->y) :
*rover->topheight;
if (mo->eflags & MFE_VERTICALFLIP) if (mo->eflags & MFE_VERTICALFLIP)
{ {
@ -3615,9 +3603,7 @@ static void P_CheckLavaWall(mobj_t *mo, sector_t *sec)
continue; continue;
} }
bottomheight = *rover->b_slope ? bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
P_GetZAt(*rover->b_slope, mo->x, mo->y) :
*rover->bottomheight;
if (mo->eflags & MFE_VERTICALFLIP) if (mo->eflags & MFE_VERTICALFLIP)
{ {
@ -4203,11 +4189,8 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
topheight = *rover->topheight; topheight = *rover->topheight;
bottomheight = *rover->bottomheight; bottomheight = *rover->bottomheight;
//topheight = P_GetFFloorTopZAt (rover, thing->x, thing->y);
/*if (rover->t_slope) //bottomheight = P_GetFFloorBottomZAt(rover, thing->x, thing->y);
topheight = P_GetZAt(rover->t_slope, thing->x, thing->y);
if (rover->b_slope)
bottomheight = P_GetZAt(rover->b_slope, thing->x, thing->y);*/
delta1 = thing->z - (bottomheight + topheight)/2; delta1 = thing->z - (bottomheight + topheight)/2;
delta2 = thingtop - (bottomheight + topheight)/2; delta2 = thingtop - (bottomheight + topheight)/2;
@ -4986,10 +4969,7 @@ void P_MapEnd(void)
fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height) fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
{ {
sector_t *sec = R_PointInSubsector(x, y)->sector; sector_t *sec = R_PointInSubsector(x, y)->sector;
fixed_t floorz = sec->floorheight; fixed_t floorz = P_GetSectorFloorZAt(sec, x, y);
if (sec->f_slope)
floorz = P_GetZAt(sec->f_slope, x, y);
// Intercept the stupid 'fall through 3dfloors' bug Tails 03-17-2002 // Intercept the stupid 'fall through 3dfloors' bug Tails 03-17-2002
if (sec->ffloors) if (sec->ffloors)
@ -5006,13 +4986,8 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
if ((!(rover->flags & FF_SOLID || rover->flags & FF_QUICKSAND) || (rover->flags & FF_SWIMMABLE))) if ((!(rover->flags & FF_SOLID || rover->flags & FF_QUICKSAND) || (rover->flags & FF_SWIMMABLE)))
continue; continue;
topheight = *rover->topheight; topheight = P_GetFFloorTopZAt (rover, x, y);
bottomheight = *rover->bottomheight; bottomheight = P_GetFFloorBottomZAt(rover, x, y);
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, x, y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, x, y);
if (rover->flags & FF_QUICKSAND) if (rover->flags & FF_QUICKSAND)
{ {

View File

@ -303,45 +303,33 @@ void P_CameraLineOpening(line_t *linedef)
// If you can see through it, why not move the camera through it too? // If you can see through it, why not move the camera through it too?
if (front->camsec >= 0) if (front->camsec >= 0)
{ {
frontfloor = sectors[front->camsec].floorheight; // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontceiling = sectors[front->camsec].ceilingheight; frontfloor = P_GetSectorFloorZAt (&sectors[front->camsec], camera.x, camera.y);
if (sectors[front->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope) frontceiling = P_GetSectorCeilingZAt(&sectors[front->camsec], camera.x, camera.y);
frontfloor = P_GetZAt(sectors[front->camsec].f_slope, camera.x, camera.y);
if (sectors[front->camsec].c_slope)
frontceiling = P_GetZAt(sectors[front->camsec].c_slope, camera.x, camera.y);
} }
else if (front->heightsec >= 0) else if (front->heightsec >= 0)
{ {
frontfloor = sectors[front->heightsec].floorheight; // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontceiling = sectors[front->heightsec].ceilingheight; frontfloor = P_GetSectorFloorZAt (&sectors[front->heightsec], camera.x, camera.y);
if (sectors[front->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope) frontceiling = P_GetSectorCeilingZAt(&sectors[front->heightsec], camera.x, camera.y);
frontfloor = P_GetZAt(sectors[front->heightsec].f_slope, camera.x, camera.y);
if (sectors[front->heightsec].c_slope)
frontceiling = P_GetZAt(sectors[front->heightsec].c_slope, camera.x, camera.y);
} }
else else
{ {
frontfloor = P_CameraGetFloorZ(mapcampointer, front, tmx, tmy, linedef); frontfloor = P_CameraGetFloorZ (mapcampointer, front, tmx, tmy, linedef);
frontceiling = P_CameraGetCeilingZ(mapcampointer, front, tmx, tmy, linedef); frontceiling = P_CameraGetCeilingZ(mapcampointer, front, tmx, tmy, linedef);
} }
if (back->camsec >= 0) if (back->camsec >= 0)
{ {
backfloor = sectors[back->camsec].floorheight; // SRB2CBTODO: ESLOPE (sectors[back->heightsec].f_slope)
backceiling = sectors[back->camsec].ceilingheight; backfloor = P_GetSectorFloorZAt (&sectors[back->camsec], camera.x, camera.y);
if (sectors[back->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[back->heightsec].f_slope) backceiling = P_GetSectorCeilingZAt(&sectors[back->camsec], camera.x, camera.y);
backfloor = P_GetZAt(sectors[back->camsec].f_slope, camera.x, camera.y);
if (sectors[back->camsec].c_slope)
backceiling = P_GetZAt(sectors[back->camsec].c_slope, camera.x, camera.y);
} }
else if (back->heightsec >= 0) else if (back->heightsec >= 0)
{ {
backfloor = sectors[back->heightsec].floorheight; // SRB2CBTODO: ESLOPE (sectors[back->heightsec].f_slope)
backceiling = sectors[back->heightsec].ceilingheight; backfloor = P_GetSectorFloorZAt (&sectors[back->heightsec], camera.x, camera.y);
if (sectors[back->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[back->heightsec].f_slope) backceiling = P_GetSectorCeilingZAt(&sectors[back->heightsec], camera.x, camera.y);
backfloor = P_GetZAt(sectors[back->heightsec].f_slope, camera.x, camera.y);
if (sectors[back->heightsec].c_slope)
backceiling = P_GetZAt(sectors[back->heightsec].c_slope, camera.x, camera.y);
} }
else else
{ {

View File

@ -926,13 +926,8 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover)
|| ((rover->flags & FF_BLOCKOTHERS) && !mobj->player))) || ((rover->flags & FF_BLOCKOTHERS) && !mobj->player)))
return false; return false;
topheight = *rover->topheight; topheight = P_GetFFloorTopZAt (rover, mobj->x, mobj->y);
bottomheight = *rover->bottomheight; bottomheight = P_GetFFloorBottomZAt(rover, mobj->x, mobj->y);
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);
if (mobj->z > topheight) if (mobj->z > topheight)
return false; return false;
@ -3213,9 +3208,7 @@ static boolean P_SceneryZMovement(mobj_t *mo)
// //
boolean P_CanRunOnWater(player_t *player, ffloor_t *rover) boolean P_CanRunOnWater(player_t *player, ffloor_t *rover)
{ {
fixed_t topheight = *rover->t_slope ? fixed_t topheight = P_GetFFloorTopZAt(rover, player->mo->x, player->mo->y);
P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) :
*rover->topheight;
if (!player->powers[pw_carry] && !player->homing if (!player->powers[pw_carry] && !player->homing
&& ((player->powers[pw_super] || player->charflags & SF_RUNONWATER || player->dashmode >= DASHMODE_THRESHOLD) && player->mo->ceilingz-topheight >= player->mo->height) && ((player->powers[pw_super] || player->charflags & SF_RUNONWATER || player->dashmode >= DASHMODE_THRESHOLD) && player->mo->ceilingz-topheight >= player->mo->height)
@ -3258,14 +3251,8 @@ void P_MobjCheckWater(mobj_t *mobj)
|| ((rover->flags & FF_BLOCKOTHERS) && !mobj->player))) || ((rover->flags & FF_BLOCKOTHERS) && !mobj->player)))
continue; continue;
topheight = *rover->topheight; topheight = P_GetFFloorTopZAt (rover, mobj->x, mobj->y);
bottomheight = *rover->bottomheight; bottomheight = P_GetFFloorBottomZAt(rover, mobj->x, mobj->y);
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);
if (mobj->eflags & MFE_VERTICALFLIP) if (mobj->eflags & MFE_VERTICALFLIP)
{ {
@ -3512,14 +3499,8 @@ static void P_SceneryCheckWater(mobj_t *mobj)
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKOTHERS) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKOTHERS)
continue; continue;
topheight = *rover->topheight; topheight = P_GetFFloorTopZAt (rover, mobj->x, mobj->y);
bottomheight = *rover->bottomheight; bottomheight = P_GetFFloorBottomZAt(rover, mobj->x, mobj->y);
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);
if (topheight <= mobj->z if (topheight <= mobj->z
|| bottomheight > (mobj->z + (mobj->height>>1))) || bottomheight > (mobj->z + (mobj->height>>1)))
@ -3564,13 +3545,9 @@ static boolean P_CameraCheckHeat(camera_t *thiscam)
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS))
continue; continue;
if (halfheight >= (*rover->t_slope ? if (halfheight >= P_GetFFloorTopZAt(rover, thiscam->x, thiscam->y))
P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
*rover->topheight))
continue; continue;
if (halfheight <= (*rover->b_slope ? if (halfheight <= P_GetFFloorBottomZAt(rover, thiscam->x, thiscam->y))
P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) :
*rover->bottomheight))
continue; continue;
if (P_FindSpecialLineFromTag(13, rover->master->frontsector->tag, -1) != -1) if (P_FindSpecialLineFromTag(13, rover->master->frontsector->tag, -1) != -1)
@ -3598,13 +3575,9 @@ static boolean P_CameraCheckWater(camera_t *thiscam)
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKOTHERS) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKOTHERS)
continue; continue;
if (halfheight >= (*rover->t_slope ? if (halfheight >= P_GetFFloorTopZAt(rover, thiscam->x, thiscam->y))
P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
*rover->topheight))
continue; continue;
if (halfheight <= ( if (halfheight <= P_GetFFloorBottomZAt(rover, thiscam->x, thiscam->y))
*rover->b_slope ? P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) :
*rover->bottomheight))
continue; continue;
return true; return true;
@ -3952,9 +3925,7 @@ static void CalculatePrecipFloor(precipmobj_t *mobj)
mobjsecsubsec = mobj->subsector->sector; mobjsecsubsec = mobj->subsector->sector;
else else
return; return;
mobj->floorz = mobjsecsubsec->f_slope ? mobj->floorz = P_GetSectorFloorZAt(mobjsecsubsec, mobj->x, mobj->y);
P_GetZAt(mobjsecsubsec->f_slope, mobj->x, mobj->y) :
mobjsecsubsec->floorheight;
if (mobjsecsubsec->ffloors) if (mobjsecsubsec->ffloors)
{ {
ffloor_t *rover; ffloor_t *rover;
@ -3969,11 +3940,7 @@ static void CalculatePrecipFloor(precipmobj_t *mobj)
if (!(rover->flags & FF_BLOCKOTHERS) && !(rover->flags & FF_SWIMMABLE)) if (!(rover->flags & FF_BLOCKOTHERS) && !(rover->flags & FF_SWIMMABLE))
continue; continue;
if (*rover->t_slope) topheight = P_GetFFloorTopZAt(rover, mobj->x, mobj->y);
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
else
topheight = *rover->topheight;
if (topheight > mobj->floorz) if (topheight > mobj->floorz)
mobj->floorz = topheight; mobj->floorz = topheight;
} }
@ -10496,12 +10463,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 // Make sure scale matches destscale immediately when spawned
P_SetScale(mobj, mobj->destscale); P_SetScale(mobj, mobj->destscale);
mobj->floorz = mobj->subsector->sector->f_slope ? mobj->floorz = P_GetSectorFloorZAt (mobj->subsector->sector, x, y);
P_GetZAt(mobj->subsector->sector->f_slope, x, y) : mobj->ceilingz = P_GetSectorCeilingZAt(mobj->subsector->sector, 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->floorrover = NULL; mobj->floorrover = NULL;
mobj->ceilingrover = NULL; mobj->ceilingrover = NULL;
@ -10854,12 +10817,8 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
// set subsector and/or block links // set subsector and/or block links
P_SetPrecipitationThingPosition(mobj); P_SetPrecipitationThingPosition(mobj);
mobj->floorz = starting_floorz = mobj->subsector->sector->f_slope ? mobj->floorz = starting_floorz = P_GetSectorFloorZAt (mobj->subsector->sector, x, y);
P_GetZAt(mobj->subsector->sector->f_slope, x, y) : mobj->ceilingz = P_GetSectorCeilingZAt(mobj->subsector->sector, 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->floorrover = NULL; mobj->floorrover = NULL;
mobj->ceilingrover = NULL; mobj->ceilingrover = NULL;
@ -11494,12 +11453,8 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
// set Z height // set Z height
sector = R_PointInSubsector(x, y)->sector; sector = R_PointInSubsector(x, y)->sector;
floor = sector->f_slope ? floor = P_GetSectorFloorZAt (sector, x, y);
P_GetZAt(sector->f_slope, x, y) : ceiling = P_GetSectorCeilingZAt(sector, x, y);
sector->floorheight;
ceiling = sector->c_slope ?
P_GetZAt(sector->c_slope, x, y) :
sector->ceilingheight;
ceilingspawn = ceiling - mobjinfo[MT_PLAYER].height; ceilingspawn = ceiling - mobjinfo[MT_PLAYER].height;
if (mthing) if (mthing)
@ -11569,12 +11524,8 @@ void P_MovePlayerToStarpost(INT32 playernum)
P_SetThingPosition(mobj); P_SetThingPosition(mobj);
sector = R_PointInSubsector(mobj->x, mobj->y)->sector; sector = R_PointInSubsector(mobj->x, mobj->y)->sector;
floor = sector->f_slope ? floor = P_GetSectorFloorZAt (sector, mobj->x, mobj->y);
P_GetZAt(sector->f_slope, mobj->x, mobj->y) : ceiling = P_GetSectorCeilingZAt(sector, mobj->x, mobj->y);
sector->floorheight;
ceiling = sector->c_slope ?
P_GetZAt(sector->c_slope, mobj->x, mobj->y) :
sector->ceilingheight;
z = p->starpostz << FRACBITS; z = p->starpostz << FRACBITS;
@ -11623,11 +11574,9 @@ static fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x,
// Establish height. // Establish height.
if (flip) if (flip)
return (ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) : ss->sector->ceilingheight) return P_GetSectorCeilingZAt(ss->sector, x, y) - offset - mobjinfo[mobjtype].height;
- offset - mobjinfo[mobjtype].height;
else else
return (ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) : ss->sector->floorheight) return P_GetSectorFloorZAt(ss->sector, x, y) + offset;
+ offset;
} }
static fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mthing, const fixed_t x, const fixed_t y) static fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mthing, const fixed_t x, const fixed_t y)

View File

@ -265,10 +265,10 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
fracx = los->strace.x + FixedMul(los->strace.dx, frac); fracx = los->strace.x + FixedMul(los->strace.dx, frac);
fracy = los->strace.y + FixedMul(los->strace.dy, frac); fracy = los->strace.y + FixedMul(los->strace.dy, frac);
// calculate sector heights // calculate sector heights
frontf = (front->f_slope) ? P_GetZAt(front->f_slope, fracx, fracy) : front->floorheight; frontf = P_GetSectorFloorZAt (front, fracx, fracy);
frontc = (front->c_slope) ? P_GetZAt(front->c_slope, fracx, fracy) : front->ceilingheight; frontc = P_GetSectorCeilingZAt(front, fracx, fracy);
backf = (back->f_slope) ? P_GetZAt(back->f_slope, fracx, fracy) : back->floorheight; backf = P_GetSectorFloorZAt (back , fracx, fracy);
backc = (back->c_slope) ? P_GetZAt(back->c_slope, fracx, fracy) : back->ceilingheight; backc = P_GetSectorCeilingZAt(back , fracx, fracy);
// crosses a two sided line // crosses a two sided line
// no wall to block sight with? // no wall to block sight with?
if (frontf == backf && frontc == backc if (frontf == backf && frontc == backc
@ -318,10 +318,10 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
continue; continue;
} }
topz = (*rover->t_slope) ? P_GetZAt(*rover->t_slope, fracx, fracy) : *rover->topheight; topz = P_GetFFloorTopZAt (rover, fracx, fracy);
bottomz = (*rover->b_slope) ? P_GetZAt(*rover->b_slope, fracx, fracy) : *rover->bottomheight; bottomz = P_GetFFloorBottomZAt(rover, fracx, fracy);
topslope = FixedDiv(topz - los->sightzstart , frac); topslope = FixedDiv( topz - los->sightzstart, frac);
bottomslope = FixedDiv(bottomz - los->sightzstart , frac); bottomslope = FixedDiv(bottomz - los->sightzstart, frac);
if (topslope >= los->topslope && bottomslope <= los->bottomslope) if (topslope >= los->topslope && bottomslope <= los->bottomslope)
return false; // view completely blocked return false; // view completely blocked
} }
@ -334,10 +334,10 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
continue; continue;
} }
topz = (*rover->t_slope) ? P_GetZAt(*rover->t_slope, fracx, fracy) : *rover->topheight; topz = P_GetFFloorTopZAt (rover, fracx, fracy);
bottomz = (*rover->b_slope) ? P_GetZAt(*rover->b_slope, fracx, fracy) : *rover->bottomheight; bottomz = P_GetFFloorBottomZAt(rover, fracx, fracy);
topslope = FixedDiv(topz - los->sightzstart , frac); topslope = FixedDiv( topz - los->sightzstart, frac);
bottomslope = FixedDiv(bottomz - los->sightzstart , frac); bottomslope = FixedDiv(bottomz - los->sightzstart, frac);
if (topslope >= los->topslope && bottomslope <= los->bottomslope) if (topslope >= los->topslope && bottomslope <= los->bottomslope)
return false; // view completely blocked return false; // view completely blocked
} }
@ -468,21 +468,10 @@ boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
continue; continue;
} }
if (*rover->t_slope) topz1 = P_GetFFloorTopZAt (rover, t1->x, t1->y);
{ topz2 = P_GetFFloorTopZAt (rover, t2->x, t2->y);
topz1 = P_GetZAt(*rover->t_slope, t1->x, t1->y); bottomz1 = P_GetFFloorBottomZAt(rover, t1->x, t1->y);
topz2 = P_GetZAt(*rover->t_slope, t2->x, t2->y); bottomz2 = P_GetFFloorBottomZAt(rover, t2->x, t2->y);
}
else
topz1 = topz2 = *rover->topheight;
if (*rover->b_slope)
{
bottomz1 = P_GetZAt(*rover->b_slope, t1->x, t1->y);
bottomz2 = P_GetZAt(*rover->b_slope, t2->x, t2->y);
}
else
bottomz1 = bottomz2 = *rover->bottomheight;
// Check for blocking floors here. // Check for blocking floors here.
if ((los.sightzstart < bottomz1 && t2->z >= topz2) if ((los.sightzstart < bottomz1 && t2->z >= topz2)

View File

@ -655,17 +655,49 @@ void P_SpawnSlopes(const boolean fromsave) {
// Various utilities related to slopes // Various utilities related to slopes
// //
//
// P_GetZAt
//
// Returns the height of the sloped plane at (x, y) as a fixed_t // Returns the height of the sloped plane at (x, y) as a fixed_t
// fixed_t P_GetZAt(const pslope_t *slope, fixed_t x, fixed_t y)
fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y)
{ {
fixed_t dist = FixedMul(x - slope->o.x, slope->d.x) + fixed_t dist = FixedMul(x - slope->o.x, slope->d.x) +
FixedMul(y - slope->o.y, slope->d.y); FixedMul(y - slope->o.y, slope->d.y);
return slope->o.z + FixedMul(dist, slope->zdelta); return slope->o.z + FixedMul(dist, slope->zdelta);
}
// Like P_GetZAt but falls back to z if slope is NULL
fixed_t P_GetZAt2(const pslope_t *slope, fixed_t x, fixed_t y, fixed_t z)
{
return slope ? P_GetZAt(slope, x, y) : z;
}
// Returns the height of the sector floor at (x, y)
fixed_t P_GetSectorFloorZAt(const sector_t *sector, fixed_t x, fixed_t y)
{
return sector->f_slope ? P_GetZAt(sector->f_slope, x, y) : sector->floorheight;
}
// Returns the height of the sector ceiling at (x, y)
fixed_t P_GetSectorCeilingZAt(const sector_t *sector, fixed_t x, fixed_t y)
{
return sector->c_slope ? P_GetZAt(sector->c_slope, x, y) : sector->ceilingheight;
}
// Returns the height of the FOF top at (x, y)
fixed_t P_GetFFloorTopZAt(const ffloor_t *ffloor, fixed_t x, fixed_t y)
{
return *ffloor->t_slope ? P_GetZAt(*ffloor->t_slope, x, y) : *ffloor->topheight;
}
// Returns the height of the FOF bottom at (x, y)
fixed_t P_GetFFloorBottomZAt(const ffloor_t *ffloor, fixed_t x, fixed_t y)
{
return *ffloor->b_slope ? P_GetZAt(*ffloor->b_slope, x, y) : *ffloor->bottomheight;
}
// Returns the height of the light list at (x, y)
fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y)
{
return light->slope ? P_GetZAt(light->slope, x, y) : light->height;
} }

View File

@ -33,7 +33,21 @@ void P_CopySectorSlope(line_t *line);
pslope_t *P_SlopeById(UINT16 id); pslope_t *P_SlopeById(UINT16 id);
// Returns the height of the sloped plane at (x, y) as a fixed_t // Returns the height of the sloped plane at (x, y) as a fixed_t
fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y); fixed_t P_GetZAt(const pslope_t *slope, fixed_t x, fixed_t y);
// Like P_GetZAt but falls back to z if slope is NULL
fixed_t P_GetZAt2(const pslope_t *slope, fixed_t x, fixed_t y, fixed_t z);
// Returns the height of the sector at (x, y)
fixed_t P_GetSectorFloorZAt (const sector_t *sector, fixed_t x, fixed_t y);
fixed_t P_GetSectorCeilingZAt(const sector_t *sector, fixed_t x, fixed_t y);
// Returns the height of the FOF at (x, y)
fixed_t P_GetFFloorTopZAt (const ffloor_t *ffloor, fixed_t x, fixed_t y);
fixed_t P_GetFFloorBottomZAt(const ffloor_t *ffloor, fixed_t x, fixed_t y);
// Returns the height of the light list at (x, y)
fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y);
// Lots of physics-based bullshit // Lots of physics-based bullshit
void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope); void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope);

View File

@ -6272,10 +6272,8 @@ void T_LaserFlash(laserthink_t *flash)
sourcesec = fflr->master->frontsector; // Less to type! sourcesec = fflr->master->frontsector; // Less to type!
top = (*fflr->t_slope) ? P_GetZAt(*fflr->t_slope, sector->soundorg.x, sector->soundorg.y) top = P_GetFFloorTopZAt (fflr, sector->soundorg.x, sector->soundorg.y);
: *fflr->topheight; bottom = P_GetFFloorBottomZAt(fflr, sector->soundorg.x, sector->soundorg.y);
bottom = (*fflr->b_slope) ? P_GetZAt(*fflr->b_slope, sector->soundorg.x, sector->soundorg.y)
: *fflr->bottomheight;
sector->soundorg.z = (top + bottom)/2; sector->soundorg.z = (top + bottom)/2;
S_StartSound(&sector->soundorg, sfx_laser); S_StartSound(&sector->soundorg, sfx_laser);
@ -7921,10 +7919,7 @@ void T_Disappear(disappear_t *d)
if (!(lines[d->sourceline].flags & ML_NOCLIMB)) if (!(lines[d->sourceline].flags & ML_NOCLIMB))
{ {
if (*rover->t_slope) sectors[s].soundorg.z = P_GetFFloorTopZAt(rover, sectors[s].soundorg.x, sectors[s].soundorg.y);
sectors[s].soundorg.z = P_GetZAt(*rover->t_slope, sectors[s].soundorg.x, sectors[s].soundorg.y);
else
sectors[s].soundorg.z = *rover->topheight;
S_StartSound(&sectors[s].soundorg, sfx_appear); S_StartSound(&sectors[s].soundorg, sfx_appear);
} }
} }

View File

@ -2274,8 +2274,8 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space
if (GETSECSPECIAL(rover->master->frontsector->special, 1) != SPACESPECIAL) if (GETSECSPECIAL(rover->master->frontsector->special, 1) != SPACESPECIAL)
continue; continue;
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : *rover->topheight; topheight = P_GetFFloorTopZAt (rover, mo->x, mo->y);
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) : *rover->bottomheight; bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
if (mo->z + (mo->height/2) > topheight) if (mo->z + (mo->height/2) > topheight)
continue; continue;
@ -2512,8 +2512,8 @@ boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand
if (!(rover->flags & FF_QUICKSAND)) if (!(rover->flags & FF_QUICKSAND))
continue; continue;
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : *rover->topheight; topheight = P_GetFFloorTopZAt (rover, mo->x, mo->y);
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) : *rover->bottomheight; bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
if (mo->z + flipoffset > topheight) if (mo->z + flipoffset > topheight)
continue; continue;
@ -2839,8 +2839,8 @@ static void P_CheckQuicksand(player_t *player)
if (!(rover->flags & FF_QUICKSAND)) if (!(rover->flags & FF_QUICKSAND))
continue; continue;
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; topheight = P_GetFFloorTopZAt (rover, player->mo->x, player->mo->y);
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight; bottomheight = P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y);
if (topheight >= player->mo->z && bottomheight < player->mo->z + player->mo->height) if (topheight >= player->mo->z && bottomheight < player->mo->z + player->mo->height)
{ {
@ -3180,10 +3180,8 @@ static void P_DoClimbing(player_t *player)
floorclimb = true; floorclimb = true;
else else
{ {
floorheight = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y) floorheight = P_GetSectorFloorZAt (glidesector->sector, player->mo->x, player->mo->y);
: glidesector->sector->floorheight; ceilingheight = P_GetSectorCeilingZAt(glidesector->sector, player->mo->x, player->mo->y);
ceilingheight = glidesector->sector->c_slope ? P_GetZAt(glidesector->sector->c_slope, player->mo->x, player->mo->y)
: glidesector->sector->ceilingheight;
if (glidesector->sector->ffloors) if (glidesector->sector->ffloors)
{ {
@ -3197,8 +3195,8 @@ static void P_DoClimbing(player_t *player)
floorclimb = true; floorclimb = true;
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; topheight = P_GetFFloorTopZAt (rover, player->mo->x, player->mo->y);
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight; bottomheight = P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y);
// Only supports rovers that are moving like an 'elevator', not just the top or bottom. // Only supports rovers that are moving like an 'elevator', not just the top or bottom.
if (rover->master->frontsector->floorspeed && rover->master->frontsector->ceilspeed == 42) if (rover->master->frontsector->floorspeed && rover->master->frontsector->ceilspeed == 42)
@ -3239,8 +3237,7 @@ static void P_DoClimbing(player_t *player)
if (roverbelow == rover) if (roverbelow == rover)
continue; continue;
bottomheight2 = *roverbelow->b_slope ? P_GetZAt(*roverbelow->b_slope, player->mo->x, player->mo->y) : *roverbelow->bottomheight; bottomheight2 = P_GetFFloorBottomZAt(roverbelow, player->mo->x, player->mo->y);
if (bottomheight2 < topheight + FixedMul(16*FRACUNIT, player->mo->scale)) if (bottomheight2 < topheight + FixedMul(16*FRACUNIT, player->mo->scale))
foundfof = true; foundfof = true;
} }
@ -3285,8 +3282,7 @@ static void P_DoClimbing(player_t *player)
if (roverbelow == rover) if (roverbelow == rover)
continue; continue;
topheight2 = *roverbelow->t_slope ? P_GetZAt(*roverbelow->t_slope, player->mo->x, player->mo->y) : *roverbelow->topheight; topheight2 = P_GetFFloorTopZAt(roverbelow, player->mo->x, player->mo->y);
if (topheight2 > bottomheight - FixedMul(16*FRACUNIT, player->mo->scale)) if (topheight2 > bottomheight - FixedMul(16*FRACUNIT, player->mo->scale))
foundfof = true; foundfof = true;
} }
@ -3340,8 +3336,7 @@ static void P_DoClimbing(player_t *player)
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP)) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
continue; continue;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight; bottomheight = P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y);
if (bottomheight < floorheight + FixedMul(16*FRACUNIT, player->mo->scale)) if (bottomheight < floorheight + FixedMul(16*FRACUNIT, player->mo->scale))
{ {
foundfof = true; foundfof = true;
@ -3381,8 +3376,7 @@ static void P_DoClimbing(player_t *player)
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP)) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
continue; continue;
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; topheight = P_GetFFloorTopZAt(rover, player->mo->x, player->mo->y);
if (topheight > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale)) if (topheight > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
{ {
foundfof = true; foundfof = true;
@ -3754,12 +3748,8 @@ static void P_DoTeeter(player_t *player)
sec = R_PointInSubsector(checkx, checky)->sector; sec = R_PointInSubsector(checkx, checky)->sector;
ceilingheight = sec->ceilingheight; ceilingheight = P_GetSectorCeilingZAt(sec, checkx, checky);
floorheight = sec->floorheight; floorheight = P_GetSectorFloorZAt (sec, checkx, checky);
if (sec->c_slope)
ceilingheight = P_GetZAt(sec->c_slope, checkx, checky);
if (sec->f_slope)
floorheight = P_GetZAt(sec->f_slope, checkx, checky);
highestceilingheight = (ceilingheight > highestceilingheight) ? ceilingheight : highestceilingheight; highestceilingheight = (ceilingheight > highestceilingheight) ? ceilingheight : highestceilingheight;
lowestfloorheight = (floorheight < lowestfloorheight) ? floorheight : lowestfloorheight; lowestfloorheight = (floorheight < lowestfloorheight) ? floorheight : lowestfloorheight;
@ -3770,8 +3760,8 @@ static void P_DoTeeter(player_t *player)
{ {
if (!(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_EXISTS)) continue;
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; topheight = P_GetFFloorTopZAt (rover, player->mo->x, player->mo->y);
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight; bottomheight = P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y);
if (P_CheckSolidLava(rover)) if (P_CheckSolidLava(rover))
; ;
@ -10663,8 +10653,8 @@ static void P_CalcPostImg(player_t *player)
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS))
continue; continue;
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; topheight = P_GetFFloorTopZAt (rover, player->mo->x, player->mo->y);
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight; bottomheight = P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y);
if (pviewheight >= topheight || pviewheight <= bottomheight) if (pviewheight >= topheight || pviewheight <= bottomheight)
continue; continue;
@ -10686,8 +10676,8 @@ static void P_CalcPostImg(player_t *player)
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKPLAYER) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKPLAYER)
continue; continue;
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; topheight = P_GetFFloorTopZAt (rover, player->mo->x, player->mo->y);
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight; bottomheight = P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y);
if (pviewheight >= topheight || pviewheight <= bottomheight) if (pviewheight >= topheight || pviewheight <= bottomheight)
continue; continue;
@ -10749,7 +10739,7 @@ static sector_t *P_GetMinecartSector(fixed_t x, fixed_t y, fixed_t z, fixed_t *n
if (!(rover->flags & (FF_EXISTS|FF_BLOCKOTHERS))) if (!(rover->flags & (FF_EXISTS|FF_BLOCKOTHERS)))
continue; continue;
*nz = *rover->t_slope ? P_GetZAt(*rover->t_slope, x, y) : *rover->topheight; *nz = P_GetFFloorTopZAt(rover, x, y);
if (abs(z - *nz) <= 56*FRACUNIT) if (abs(z - *nz) <= 56*FRACUNIT)
{ {
sec = &sectors[rover->secnum]; sec = &sectors[rover->secnum];
@ -10759,7 +10749,7 @@ static sector_t *P_GetMinecartSector(fixed_t x, fixed_t y, fixed_t z, fixed_t *n
} }
*nz = sec->f_slope ? P_GetZAt(sec->f_slope, x, y) : sec->floorheight; *nz = P_GetSectorFloorZAt(sec, x, y);
if (abs(z - *nz) > 56*FRACUNIT) if (abs(z - *nz) > 56*FRACUNIT)
return NULL; return NULL;

View File

@ -500,16 +500,13 @@ static void R_AddLine(seg_t *line)
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends
#define SLOPEPARAMS(slope, end1, end2, normalheight) \ #define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \ end1 = P_GetZAt2(slope, line->v1->x, line->v1->y, normalheight); \
end1 = P_GetZAt(slope, line->v1->x, line->v1->y); \ end2 = P_GetZAt2(slope, line->v2->x, line->v2->y, normalheight);
end2 = P_GetZAt(slope, line->v2->x, line->v2->y); \
} else \
end1 = end2 = normalheight;
SLOPEPARAMS(frontsector->f_slope, frontf1, frontf2, frontsector->floorheight) SLOPEPARAMS(frontsector->f_slope, frontf1, frontf2, frontsector-> floorheight)
SLOPEPARAMS(frontsector->c_slope, frontc1, frontc2, frontsector->ceilingheight) SLOPEPARAMS(frontsector->c_slope, frontc1, frontc2, frontsector->ceilingheight)
SLOPEPARAMS( backsector->f_slope, backf1, backf2, backsector->floorheight) SLOPEPARAMS( backsector->f_slope, backf1, backf2, backsector-> floorheight)
SLOPEPARAMS( backsector->c_slope, backc1, backc2, backsector->ceilingheight) SLOPEPARAMS( backsector->c_slope, backc1, backc2, backsector->ceilingheight)
#undef SLOPEPARAMS #undef SLOPEPARAMS
// if both ceilings are skies, consider it always "open" // if both ceilings are skies, consider it always "open"
// same for floors // same for floors
@ -859,13 +856,8 @@ static void R_Subsector(size_t num)
floorcolormap = ceilingcolormap = frontsector->extra_colormap; floorcolormap = ceilingcolormap = frontsector->extra_colormap;
floorcenterz = frontsector->f_slope ? floorcenterz = P_GetSectorFloorZAt (frontsector, frontsector->soundorg.x, frontsector->soundorg.y);
P_GetZAt(frontsector->f_slope, frontsector->soundorg.x, frontsector->soundorg.y) : ceilingcenterz = P_GetSectorCeilingZAt(frontsector, 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;
// Check and prep all 3D floors. Set the sector floor/ceiling light levels and colormaps. // Check and prep all 3D floors. Set the sector floor/ceiling light levels and colormaps.
if (frontsector->ffloors) if (frontsector->ffloors)
@ -891,7 +883,7 @@ static void R_Subsector(size_t num)
sub->sector->extra_colormap = frontsector->extra_colormap; sub->sector->extra_colormap = frontsector->extra_colormap;
if ((frontsector->f_slope ? P_GetZAt(frontsector->f_slope, viewx, viewy) : frontsector->floorheight) < viewz if (P_GetSectorFloorZAt(frontsector, viewx, viewy) < viewz
|| frontsector->floorpic == skyflatnum || frontsector->floorpic == skyflatnum
|| (frontsector->heightsec != -1 && sectors[frontsector->heightsec].ceilingpic == skyflatnum)) || (frontsector->heightsec != -1 && sectors[frontsector->heightsec].ceilingpic == skyflatnum))
{ {
@ -905,7 +897,7 @@ static void R_Subsector(size_t num)
else else
floorplane = NULL; floorplane = NULL;
if ((frontsector->c_slope ? P_GetZAt(frontsector->c_slope, viewx, viewy) : frontsector->ceilingheight) > viewz if (P_GetSectorCeilingZAt(frontsector, viewx, viewy) > viewz
|| frontsector->ceilingpic == skyflatnum || frontsector->ceilingpic == skyflatnum
|| (frontsector->heightsec != -1 && sectors[frontsector->heightsec].floorpic == skyflatnum)) || (frontsector->heightsec != -1 && sectors[frontsector->heightsec].floorpic == skyflatnum))
{ {
@ -946,13 +938,9 @@ static void R_Subsector(size_t num)
ffloor[numffloors].plane = NULL; ffloor[numffloors].plane = NULL;
ffloor[numffloors].polyobj = NULL; ffloor[numffloors].polyobj = NULL;
heightcheck = *rover->b_slope ? heightcheck = P_GetFFloorBottomZAt(rover, viewx, viewy);
P_GetZAt(*rover->b_slope, viewx, viewy) :
*rover->bottomheight;
planecenterz = *rover->b_slope ? planecenterz = P_GetFFloorBottomZAt(rover, frontsector->soundorg.x, frontsector->soundorg.y);
P_GetZAt(*rover->b_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
*rover->bottomheight;
if (planecenterz <= ceilingcenterz if (planecenterz <= ceilingcenterz
&& planecenterz >= floorcenterz && planecenterz >= floorcenterz
&& ((viewz < heightcheck && !(rover->flags & FF_INVERTPLANES)) && ((viewz < heightcheck && !(rover->flags & FF_INVERTPLANES))
@ -984,13 +972,9 @@ static void R_Subsector(size_t num)
ffloor[numffloors].plane = NULL; ffloor[numffloors].plane = NULL;
ffloor[numffloors].polyobj = NULL; ffloor[numffloors].polyobj = NULL;
heightcheck = *rover->t_slope ? heightcheck = P_GetFFloorTopZAt(rover, viewx, viewy);
P_GetZAt(*rover->t_slope, viewx, viewy) :
*rover->topheight;
planecenterz = *rover->t_slope ? planecenterz = P_GetFFloorTopZAt(rover, frontsector->soundorg.x, frontsector->soundorg.y);
P_GetZAt(*rover->t_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
*rover->topheight;
if (planecenterz >= floorcenterz if (planecenterz >= floorcenterz
&& planecenterz <= ceilingcenterz && planecenterz <= ceilingcenterz
&& ((viewz > heightcheck && !(rover->flags & FF_INVERTPLANES)) && ((viewz > heightcheck && !(rover->flags & FF_INVERTPLANES))
@ -1165,7 +1149,7 @@ void R_Prep3DFloors(sector_t *sector)
else else
memset(sector->lightlist, 0, sizeof (lightlist_t) * count); 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].height = heighttest + 1;
sector->lightlist[0].slope = sector->c_slope; sector->lightlist[0].slope = sector->c_slope;
@ -1186,7 +1170,7 @@ void R_Prep3DFloors(sector_t *sector)
&& !(rover->flags & FF_CUTLEVEL) && !(rover->flags & FF_CUTSPRITES))) && !(rover->flags & FF_CUTLEVEL) && !(rover->flags & FF_CUTSPRITES)))
continue; 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) if (heighttest > bestheight && heighttest < maxheight)
{ {
@ -1196,7 +1180,7 @@ void R_Prep3DFloors(sector_t *sector)
continue; continue;
} }
if (rover->flags & FF_DOUBLESHADOW) { if (rover->flags & FF_DOUBLESHADOW) {
heighttest = *rover->b_slope ? P_GetZAt(*rover->b_slope, sector->soundorg.x, sector->soundorg.y) : *rover->bottomheight; heighttest = P_GetFFloorBottomZAt(rover, sector->soundorg.x, sector->soundorg.y);
if (heighttest > bestheight if (heighttest > bestheight
&& heighttest < maxheight) && heighttest < maxheight)
@ -1238,7 +1222,7 @@ void R_Prep3DFloors(sector_t *sector)
if (best->flags & FF_DOUBLESHADOW) 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 if (bestheight == heighttest) ///TODO: do this in a more efficient way -Red
{ {
sector->lightlist[i].lightlevel = sector->lightlist[best->lastlight].lightlevel; sector->lightlist[i].lightlevel = sector->lightlist[best->lastlight].lightlevel;

View File

@ -384,16 +384,13 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
fixed_t leftheight, rightheight; fixed_t leftheight, rightheight;
light = &frontsector->lightlist[i]; light = &frontsector->lightlist[i];
rlight = &dc_lightlist[i]; rlight = &dc_lightlist[i];
if (light->slope) { leftheight = P_GetLightZAt(light, ds-> leftpos.x, ds-> leftpos.y);
leftheight = P_GetZAt(light->slope, ds->leftpos.x, ds->leftpos.y); rightheight = P_GetLightZAt(light, ds->rightpos.x, ds->rightpos.y);
rightheight = P_GetZAt(light->slope, ds->rightpos.x, ds->rightpos.y);
} else
leftheight = rightheight = light->height;
leftheight -= viewz; leftheight -= viewz;
rightheight -= viewz; rightheight -= viewz;
rlight->height = (centeryfrac) - FixedMul(leftheight, ds->scale1); rlight->height = (centeryfrac) - FixedMul(leftheight , ds->scale1);
rlight->heightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2); rlight->heightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2);
rlight->heightstep = (rlight->heightstep-rlight->height)/(range); rlight->heightstep = (rlight->heightstep-rlight->height)/(range);
//if (x1 > ds->x1) //if (x1 > ds->x1)
@ -808,11 +805,8 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
rlight = &dc_lightlist[p]; rlight = &dc_lightlist[p];
#define SLOPEPARAMS(slope, end1, end2, normalheight) \ #define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \ end1 = P_GetZAt2(slope, ds-> leftpos.x, ds-> leftpos.y, normalheight); \
end1 = P_GetZAt(slope, ds->leftpos.x, ds->leftpos.y); \ end2 = P_GetZAt2(slope, ds->rightpos.x, ds->rightpos.y, normalheight);
end2 = P_GetZAt(slope, ds->rightpos.x, ds->rightpos.y); \
} else \
end1 = end2 = normalheight;
SLOPEPARAMS(light->slope, leftheight, rightheight, light->height) SLOPEPARAMS(light->slope, leftheight, rightheight, light->height)
SLOPEPARAMS(*pfloor->b_slope, pfloorleft, pfloorright, *pfloor->bottomheight) SLOPEPARAMS(*pfloor->b_slope, pfloorleft, pfloorright, *pfloor->bottomheight)
@ -825,8 +819,8 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
if (leftheight > pfloorleft && rightheight > pfloorright && i+1 < dc_numlights) if (leftheight > pfloorleft && rightheight > pfloorright && i+1 < dc_numlights)
{ {
lightlist_t *nextlight = &frontsector->lightlist[i+1]; lightlist_t *nextlight = &frontsector->lightlist[i+1];
if ((nextlight->slope ? P_GetZAt(nextlight->slope, ds->leftpos.x, ds->leftpos.y) : nextlight->height) > pfloorleft if (P_GetZAt2(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) && P_GetZAt2(nextlight->slope, ds->rightpos.x, ds->rightpos.y, nextlight->height) > pfloorright)
continue; continue;
} }
@ -922,15 +916,9 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
dc_texheight = textureheight[texnum]>>FRACBITS; dc_texheight = textureheight[texnum]>>FRACBITS;
// calculate both left ends // calculate both left ends
if (*pfloor->t_slope) left_top = P_GetFFloorTopZAt (pfloor, ds->leftpos.x, ds->leftpos.y) - viewz;
left_top = P_GetZAt(*pfloor->t_slope, ds->leftpos.x, ds->leftpos.y) - viewz; left_bottom = P_GetFFloorBottomZAt(pfloor, ds->leftpos.x, ds->leftpos.y) - viewz;
else
left_top = *pfloor->topheight - 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 skewslope = *pfloor->t_slope; // skew using top slope by default
if (newline) if (newline)
{ {
@ -1006,15 +994,8 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
fixed_t right_top, right_bottom; fixed_t right_top, right_bottom;
// calculate right ends now // calculate right ends now
if (*pfloor->t_slope) right_top = P_GetFFloorTopZAt (pfloor, ds->rightpos.x, ds->rightpos.y) - viewz;
right_top = P_GetZAt(*pfloor->t_slope, ds->rightpos.x, ds->rightpos.y) - viewz; right_bottom = P_GetFFloorBottomZAt(pfloor, 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;
// using INT64 to avoid 32bit overflow // using INT64 to avoid 32bit overflow
top_frac = (INT64)centeryfrac - (((INT64)left_top * ds->scale1) >> FRACBITS); top_frac = (INT64)centeryfrac - (((INT64)left_top * ds->scale1) >> FRACBITS);
@ -1796,11 +1777,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
#define SLOPEPARAMS(slope, end1, end2, normalheight) \ #define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \ end1 = P_GetZAt2(slope, segleft.x, segleft.y, normalheight); \
end1 = P_GetZAt(slope, segleft.x, segleft.y); \ end2 = P_GetZAt2(slope, segright.x, segright.y, normalheight);
end2 = P_GetZAt(slope, segright.x, segright.y); \
} else \
end1 = end2 = normalheight;
SLOPEPARAMS(frontsector->c_slope, worldtop, worldtopslope, frontsector->ceilingheight) SLOPEPARAMS(frontsector->c_slope, worldtop, worldtopslope, frontsector->ceilingheight)
SLOPEPARAMS(frontsector->f_slope, worldbottom, worldbottomslope, frontsector->floorheight) SLOPEPARAMS(frontsector->f_slope, worldbottom, worldbottomslope, frontsector->floorheight)
@ -1831,12 +1809,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
continue; continue;
#endif #endif
if (ffloor[i].slope) { ffloor[i].f_pos = P_GetZAt2(ffloor[i].slope, segleft .x, segleft .y, ffloor[i].height) - viewz;
ffloor[i].f_pos = P_GetZAt(ffloor[i].slope, segleft.x, segleft.y) - viewz; ffloor[i].f_pos_slope = P_GetZAt2(ffloor[i].slope, segright.x, segright.y, ffloor[i].height) - 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;
} }
} }
@ -1929,12 +1903,12 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (worldbottomslope > worldlowslope || worldbottom > worldlow) if (worldbottomslope > worldlowslope || worldbottom > worldlow)
{ {
ds_p->silhouette = SIL_BOTTOM; 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; ds_p->bsilheight = INT32_MAX;
else else
ds_p->bsilheight = (frontsector->f_slope ? INT32_MAX : frontsector->floorheight); 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->silhouette = SIL_BOTTOM;
ds_p->bsilheight = INT32_MAX; ds_p->bsilheight = INT32_MAX;
@ -1947,12 +1921,12 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (worldtopslope < worldhighslope || worldtop < worldhigh) if (worldtopslope < worldhighslope || worldtop < worldhigh)
{ {
ds_p->silhouette |= SIL_TOP; 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; ds_p->tsilheight = INT32_MIN;
else else
ds_p->tsilheight = (frontsector->c_slope ? INT32_MIN : frontsector->ceilingheight); 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->silhouette |= SIL_TOP;
ds_p->tsilheight = INT32_MIN; ds_p->tsilheight = INT32_MIN;
@ -2281,10 +2255,10 @@ void R_StoreWallRange(INT32 start, INT32 stop)
continue; continue;
// Oy vey. // Oy vey.
if ( ((*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft .x, segleft .y) : *rover-> topheight) <= worldbottom + viewz if ( ((P_GetFFloorTopZAt (rover, segleft .x, segleft .y)) <= worldbottom + viewz
&& (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover-> topheight) <= worldbottomslope + viewz) && (P_GetFFloorTopZAt (rover, segright.x, segright.y)) <= worldbottomslope + viewz)
||((*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft .x, segleft .y) : *rover->bottomheight) >= worldtop + viewz ||((P_GetFFloorBottomZAt(rover, segleft .x, segleft .y)) >= worldtop + viewz
&& (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) >= worldtopslope + viewz)) && (P_GetFFloorBottomZAt(rover, segright.x, segright.y)) >= worldtopslope + viewz))
continue; continue;
ds_p->thicksides[i] = rover; ds_p->thicksides[i] = rover;
@ -2300,16 +2274,16 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (rover->norender == leveltime) if (rover->norender == leveltime)
continue; continue;
// Oy vey. // Oy vey.
if ( ((*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft .x, segleft .y) : *rover-> topheight) <= worldbottom + viewz if ( (P_GetFFloorTopZAt (rover, segleft .x, segleft .y) <= worldbottom + viewz
&& (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover-> topheight) <= worldbottomslope + viewz) && P_GetFFloorTopZAt (rover, segright.x, segright.y) <= worldbottomslope + viewz)
||((*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft .x, segleft .y) : *rover->bottomheight) >= worldtop + viewz ||(P_GetFFloorBottomZAt(rover, segleft .x, segleft .y) >= worldtop + viewz
&& (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) >= worldtopslope + viewz)) && P_GetFFloorBottomZAt(rover, segright.x, segright.y) >= worldtopslope + viewz))
continue; continue;
if ( ((*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft .x, segleft .y) : *rover-> topheight) <= worldlow + viewz if ( (P_GetFFloorTopZAt (rover, segleft .x, segleft .y) <= worldlow + viewz
&& (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover-> topheight) <= worldlowslope + viewz) && P_GetFFloorTopZAt (rover, segright.x, segright.y) <= worldlowslope + viewz)
||((*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft .x, segleft .y) : *rover->bottomheight) >= worldhigh + viewz ||(P_GetFFloorBottomZAt(rover, segleft .x, segleft .y) >= worldhigh + viewz
&& (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) >= worldhighslope + viewz)) && P_GetFFloorBottomZAt(rover, segright.x, segright.y) >= worldhighslope + viewz))
continue; continue;
ds_p->thicksides[i] = rover; ds_p->thicksides[i] = rover;
@ -2425,17 +2399,13 @@ void R_StoreWallRange(INT32 start, INT32 stop)
// and doesn't need to be marked. // and doesn't need to be marked.
if (frontsector->heightsec == -1) if (frontsector->heightsec == -1)
{ {
if (frontsector->floorpic != skyflatnum && (frontsector->f_slope ? if (frontsector->floorpic != skyflatnum && P_GetSectorFloorZAt(frontsector, viewx, viewy) >= viewz)
P_GetZAt(frontsector->f_slope, viewx, viewy) :
frontsector->floorheight) >= viewz)
{ {
// above view plane // above view plane
markfloor = false; markfloor = false;
} }
if (frontsector->ceilingpic != skyflatnum && (frontsector->c_slope ? if (frontsector->ceilingpic != skyflatnum && P_GetSectorCeilingZAt(frontsector, viewx, viewy) <= viewz)
P_GetZAt(frontsector->c_slope, viewx, viewy) :
frontsector->ceilingheight) <= viewz)
{ {
// below view plane // below view plane
markceiling = false; markceiling = false;
@ -2487,14 +2457,12 @@ void R_StoreWallRange(INT32 start, INT32 stop)
light = &frontsector->lightlist[i]; light = &frontsector->lightlist[i];
rlight = &dc_lightlist[p]; rlight = &dc_lightlist[p];
if (light->slope) { leftheight = P_GetLightZAt(light, segleft.x, segleft.y);
leftheight = P_GetZAt(light->slope, segleft.x, segleft.y); rightheight = P_GetLightZAt(light, segright.x, segright.y);
rightheight = P_GetZAt(light->slope, segright.x, segright.y);
if (light->slope)
// Flag sector as having slopes // Flag sector as having slopes
frontsector->hasslope = true; frontsector->hasslope = true;
} else
leftheight = rightheight = light->height;
leftheight -= viewz; leftheight -= viewz;
rightheight -= viewz; rightheight -= viewz;
@ -2518,19 +2486,17 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (light->caster && light->caster->flags & FF_CUTSOLIDS) if (light->caster && light->caster->flags & FF_CUTSOLIDS)
{ {
if (*light->caster->b_slope) { leftheight = P_GetFFloorBottomZAt(light->caster, segleft.x, segleft.y);
leftheight = P_GetZAt(*light->caster->b_slope, segleft.x, segleft.y); rightheight = P_GetFFloorBottomZAt(light->caster, segright.x, segright.y);
rightheight = P_GetZAt(*light->caster->b_slope, segright.x, segright.y);
if (*light->caster->b_slope)
// Flag sector as having slopes // Flag sector as having slopes
frontsector->hasslope = true; frontsector->hasslope = true;
} else
leftheight = rightheight = *light->caster->bottomheight;
leftheight -= viewz; leftheight -= viewz;
rightheight -= viewz; rightheight -= viewz;
leftheight >>= 4; leftheight >>= 4;
rightheight >>= 4; rightheight >>= 4;
rlight->botheight = (centeryfrac>>4) - FixedMul(leftheight, rw_scale); rlight->botheight = (centeryfrac>>4) - FixedMul(leftheight, rw_scale);
@ -2614,9 +2580,9 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (*rover->b_slope || *rover->t_slope) if (*rover->b_slope || *rover->t_slope)
backsector->hasslope = true; backsector->hasslope = true;
roverleft = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; roverleft = P_GetFFloorBottomZAt(rover, segleft .x, segleft .y) - viewz;
roverright = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) - viewz; roverright = P_GetFFloorBottomZAt(rover, segright.x, segright.y) - viewz;
planevistest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : *rover->bottomheight); planevistest = P_GetFFloorBottomZAt(rover, viewx, viewy);
if ((roverleft>>4 <= worldhigh || roverright>>4 <= worldhighslope) && if ((roverleft>>4 <= worldhigh || roverright>>4 <= worldhighslope) &&
(roverleft>>4 >= worldlow || roverright>>4 >= worldlowslope) && (roverleft>>4 >= worldlow || roverright>>4 >= worldlowslope) &&
@ -2637,9 +2603,9 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (i >= MAXFFLOORS) if (i >= MAXFFLOORS)
break; break;
roverleft = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) - viewz; roverleft = P_GetFFloorTopZAt(rover, segleft .x, segleft .y) - viewz;
roverright = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover->topheight) - viewz; roverright = P_GetFFloorTopZAt(rover, segright.x, segright.y) - viewz;
planevistest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : *rover->topheight); planevistest = P_GetFFloorTopZAt(rover, viewx, viewy);
if ((roverleft>>4 <= worldhigh || roverright>>4 <= worldhighslope) && if ((roverleft>>4 <= worldhigh || roverright>>4 <= worldhighslope) &&
(roverleft>>4 >= worldlow || roverright>>4 >= worldlowslope) && (roverleft>>4 >= worldlow || roverright>>4 >= worldlowslope) &&
@ -2671,9 +2637,9 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (*rover->b_slope || *rover->t_slope) if (*rover->b_slope || *rover->t_slope)
frontsector->hasslope = true; frontsector->hasslope = true;
roverleft = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; roverleft = P_GetFFloorBottomZAt(rover, segleft .x, segleft .y) - viewz;
roverright = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) - viewz; roverright = P_GetFFloorBottomZAt(rover, segright.x, segright.y) - viewz;
planevistest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : *rover->bottomheight); planevistest = P_GetFFloorBottomZAt(rover, viewx, viewy);
if ((roverleft>>4 <= worldhigh || roverright>>4 <= worldhighslope) && if ((roverleft>>4 <= worldhigh || roverright>>4 <= worldhighslope) &&
(roverleft>>4 >= worldlow || roverright>>4 >= worldlowslope) && (roverleft>>4 >= worldlow || roverright>>4 >= worldlowslope) &&
@ -2694,9 +2660,9 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (i >= MAXFFLOORS) if (i >= MAXFFLOORS)
break; break;
roverleft = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) - viewz; roverleft = P_GetFFloorTopZAt(rover, segleft .x, segleft .y) - viewz;
roverright = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover->topheight) - viewz; roverright = P_GetFFloorTopZAt(rover, segright.x, segright.y) - viewz;
planevistest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : *rover->topheight); planevistest = P_GetFFloorTopZAt(rover, viewx, viewy);
if ((roverleft>>4 <= worldhigh || roverright>>4 <= worldhighslope) && if ((roverleft>>4 <= worldhigh || roverright>>4 <= worldhighslope) &&
(roverleft>>4 >= worldlow || roverright>>4 >= worldlowslope) && (roverleft>>4 >= worldlow || roverright>>4 >= worldlowslope) &&

View File

@ -1025,13 +1025,12 @@ static void R_SplitSprite(vissprite_t *sprite)
for (i = 1; i < sector->numlights; i++) 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)) if (!(sector->lightlist[i].caster->flags & FF_CUTSPRITES))
continue; continue;
if (sector->lightlist[i].slope) testheight = P_GetLightZAt(&sector->lightlist[i], sprite->gx, sprite->gy);
testheight = P_GetZAt(sector->lightlist[i].slope, sprite->gx, sprite->gy);
if (testheight >= sprite->gzt) if (testheight >= sprite->gzt)
continue; continue;
@ -1113,10 +1112,12 @@ fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope)
{ {
sector = node->m_sector; sector = node->m_sector;
slope = (sector->heightsec != -1) ? NULL : sector->f_slope; slope = sector->heightsec != -1 ? NULL : sector->f_slope;
z = slope ? P_GetZAt(slope, thing->x, thing->y) : (
(sector->heightsec != -1) ? sectors[sector->heightsec].floorheight : sector->floorheight if (sector->heightsec != -1)
); z = sectors[sector->heightsec].floorheight;
else
z = P_GetSectorFloorZAt(sector, thing->x, thing->y);
if (z < thing->z+thing->height/2 && z > floorz) if (z < thing->z+thing->height/2 && z > floorz)
{ {
@ -1130,7 +1131,7 @@ fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope)
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES) || (rover->alpha < 90 && !(rover->flags & FF_SWIMMABLE))) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES) || (rover->alpha < 90 && !(rover->flags & FF_SWIMMABLE)))
continue; continue;
z = *rover->t_slope ? P_GetZAt(*rover->t_slope, thing->x, thing->y) : *rover->topheight; z = P_GetFFloorTopZAt(rover, thing->x, thing->y);
if (z < thing->z+thing->height/2 && z > floorz) if (z < thing->z+thing->height/2 && z > floorz)
{ {
floorz = z; floorz = z;
@ -1323,8 +1324,7 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
// R_GetPlaneLight won't work on sloped lights! // R_GetPlaneLight won't work on sloped lights!
for (lightnum = 1; lightnum < thing->subsector->sector->numlights; lightnum++) { 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, thing->x, thing->y) fixed_t h = P_GetLightZAt(&thing->subsector->sector->lightlist[lightnum], thing->x, thing->y);
: thing->subsector->sector->lightlist[lightnum].height;
if (h <= shadow->gzt) { if (h <= shadow->gzt) {
light = lightnum - 1; light = lightnum - 1;
break; break;
@ -1730,8 +1730,7 @@ static void R_ProjectSprite(mobj_t *thing)
// R_GetPlaneLight won't work on sloped lights! // R_GetPlaneLight won't work on sloped lights!
for (lightnum = 1; lightnum < thing->subsector->sector->numlights; lightnum++) { 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, thing->x, thing->y) fixed_t h = P_GetLightZAt(&thing->subsector->sector->lightlist[lightnum], thing->x, thing->y);
: thing->subsector->sector->lightlist[lightnum].height;
if (h <= gzt) { if (h <= gzt) {
light = lightnum - 1; light = lightnum - 1;
break; break;
@ -2388,12 +2387,8 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps
continue; continue;
// Effective height may be different for each comparison in the case of slopes // Effective height may be different for each comparison in the case of slopes
if (r2->plane->slope) { planeobjectz = P_GetZAt2(r2->plane->slope, rover->gx, rover->gy, r2->plane->height);
planeobjectz = P_GetZAt(r2->plane->slope, rover->gx, rover->gy); planecameraz = P_GetZAt2(r2->plane->slope, viewx, viewy, r2->plane->height);
planecameraz = P_GetZAt(r2->plane->slope, viewx, viewy);
}
else
planeobjectz = planecameraz = r2->plane->height;
if (rover->mobjflags & MF_NOCLIPHEIGHT) if (rover->mobjflags & MF_NOCLIPHEIGHT)
{ {
@ -2451,19 +2446,10 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps
if (scale <= rover->sortscale) if (scale <= rover->sortscale)
continue; continue;
if (*r2->ffloor->t_slope) { topplaneobjectz = P_GetFFloorTopZAt (r2->ffloor, rover->gx, rover->gy);
topplaneobjectz = P_GetZAt(*r2->ffloor->t_slope, rover->gx, rover->gy); topplanecameraz = P_GetFFloorTopZAt (r2->ffloor, viewx, viewy);
topplanecameraz = P_GetZAt(*r2->ffloor->t_slope, viewx, viewy); botplaneobjectz = P_GetFFloorBottomZAt(r2->ffloor, rover->gx, rover->gy);
} botplanecameraz = P_GetFFloorBottomZAt(r2->ffloor, 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;
if ((topplanecameraz > viewz && botplanecameraz < viewz) || if ((topplanecameraz > viewz && botplanecameraz < viewz) ||
(topplanecameraz < viewz && rover->gzt < topplaneobjectz) || (topplanecameraz < viewz && rover->gzt < topplaneobjectz) ||