mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-31 21:50:48 +00:00
Refactor PTR_SlideTraverse
This commit is contained in:
parent
a67c8786ae
commit
929064b998
1 changed files with 139 additions and 140 deletions
65
src/p_map.c
65
src/p_map.c
|
@ -3310,61 +3310,37 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
static boolean PTR_LineIsBlocking(line_t *li)
|
||||||
// PTR_SlideTraverse
|
|
||||||
//
|
|
||||||
static boolean PTR_SlideTraverse(intercept_t *in)
|
|
||||||
{
|
{
|
||||||
line_t *li;
|
|
||||||
|
|
||||||
I_Assert(in->isaline);
|
|
||||||
|
|
||||||
li = in->d.line;
|
|
||||||
|
|
||||||
// one-sided linedefs are always solid to sliding movement.
|
// one-sided linedefs are always solid to sliding movement.
|
||||||
// one-sided linedef
|
|
||||||
if (!li->backsector)
|
if (!li->backsector)
|
||||||
{
|
return !P_PointOnLineSide(slidemo->x, slidemo->y, li);
|
||||||
if (P_PointOnLineSide(slidemo->x, slidemo->y, li))
|
|
||||||
return true; // don't hit the back side
|
|
||||||
goto isblocking;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(slidemo->flags & MF_MISSILE))
|
if (!(slidemo->flags & MF_MISSILE))
|
||||||
{
|
{
|
||||||
if (li->flags & ML_IMPASSIBLE)
|
if (li->flags & ML_IMPASSIBLE)
|
||||||
goto isblocking;
|
return true;
|
||||||
|
|
||||||
if ((slidemo->flags & (MF_ENEMY|MF_BOSS)) && li->flags & ML_BLOCKMONSTERS)
|
if ((slidemo->flags & (MF_ENEMY|MF_BOSS)) && li->flags & ML_BLOCKMONSTERS)
|
||||||
goto isblocking;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set openrange, opentop, openbottom
|
// set openrange, opentop, openbottom
|
||||||
P_LineOpening(li, slidemo);
|
P_LineOpening(li, slidemo);
|
||||||
|
|
||||||
if (openrange < slidemo->height)
|
if (openrange < slidemo->height)
|
||||||
goto isblocking; // doesn't fit
|
return true; // doesn't fit
|
||||||
|
|
||||||
if (opentop - slidemo->z < slidemo->height)
|
if (opentop - slidemo->z < slidemo->height)
|
||||||
goto isblocking; // mobj is too high
|
return true; // mobj is too high
|
||||||
|
|
||||||
if (openbottom - slidemo->z > FixedMul(MAXSTEPMOVE, slidemo->scale))
|
if (openbottom - slidemo->z > FixedMul(MAXSTEPMOVE, slidemo->scale))
|
||||||
goto isblocking; // too big a step up
|
return true; // too big a step up
|
||||||
|
|
||||||
// this line doesn't block movement
|
return false;
|
||||||
return true;
|
|
||||||
|
|
||||||
// the line does block movement,
|
|
||||||
// see if it is closer than best so far
|
|
||||||
isblocking:
|
|
||||||
if (li->polyobj && slidemo->player)
|
|
||||||
{
|
|
||||||
if ((li->polyobj->lines[0]->backsector->flags & SF_TRIGGERSPECIAL_TOUCH) && !(li->polyobj->flags & POF_NOSPECIALS))
|
|
||||||
P_ProcessSpecialSector(slidemo->player, slidemo->subsector->sector, li->polyobj->lines[0]->backsector);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slidemo->player && (slidemo->player->pflags & PF_GLIDING || slidemo->player->climbing)
|
static void PTR_GlideClimbTraverse(line_t *li)
|
||||||
&& slidemo->player->charability == CA_GLIDEANDCLIMB)
|
|
||||||
{
|
{
|
||||||
line_t *checkline = li;
|
line_t *checkline = li;
|
||||||
sector_t *checksector;
|
sector_t *checksector;
|
||||||
|
@ -3467,6 +3443,29 @@ isblocking:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boolean PTR_SlideTraverse(intercept_t *in)
|
||||||
|
{
|
||||||
|
line_t *li;
|
||||||
|
|
||||||
|
I_Assert(in->isaline);
|
||||||
|
|
||||||
|
li = in->d.line;
|
||||||
|
|
||||||
|
if (!PTR_LineIsBlocking(li))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// the line blocks movement,
|
||||||
|
// see if it is closer than best so far
|
||||||
|
if (li->polyobj && slidemo->player)
|
||||||
|
{
|
||||||
|
if ((li->polyobj->lines[0]->backsector->flags & SF_TRIGGERSPECIAL_TOUCH) && !(li->polyobj->flags & POF_NOSPECIALS))
|
||||||
|
P_ProcessSpecialSector(slidemo->player, slidemo->subsector->sector, li->polyobj->lines[0]->backsector);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slidemo->player && slidemo->player->charability == CA_GLIDEANDCLIMB
|
||||||
|
&& (slidemo->player->pflags & PF_GLIDING || slidemo->player->climbing))
|
||||||
|
PTR_GlideClimbTraverse(li);
|
||||||
|
|
||||||
if (in->frac < bestslidefrac && (!slidemo->player || !slidemo->player->climbing))
|
if (in->frac < bestslidefrac && (!slidemo->player || !slidemo->player->climbing))
|
||||||
{
|
{
|
||||||
secondslidefrac = bestslidefrac;
|
secondslidefrac = bestslidefrac;
|
||||||
|
|
Loading…
Reference in a new issue