mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 13:21:10 +00:00
Climbing now supports one-sided linedefs.
The whole thing needs a refactor in general, but it's almost 2am here, I need my sleeb, and this fix would probably break something with 2.1 climbing if I made it any more/less (depending on viewpoint) complicated.
This commit is contained in:
parent
95269ab44b
commit
20ffbbdc41
2 changed files with 245 additions and 236 deletions
|
@ -2423,6 +2423,8 @@ isblocking:
|
||||||
//
|
//
|
||||||
// P_IsClimbingValid
|
// P_IsClimbingValid
|
||||||
//
|
//
|
||||||
|
// Unlike P_DoClimbing, don't use when up against a one-sided linedef.
|
||||||
|
//
|
||||||
static boolean P_IsClimbingValid(player_t *player, angle_t angle)
|
static boolean P_IsClimbingValid(player_t *player, angle_t angle)
|
||||||
{
|
{
|
||||||
fixed_t platx, platy;
|
fixed_t platx, platy;
|
||||||
|
@ -2657,9 +2659,11 @@ isblocking:
|
||||||
|
|
||||||
climbangle += (ANGLE_90 * (whichside ? -1 : 1));
|
climbangle += (ANGLE_90 * (whichside ? -1 : 1));
|
||||||
|
|
||||||
|
boolean canclimb = (li->backsector ? P_IsClimbingValid(slidemo->player, climbangle) : true);
|
||||||
|
|
||||||
if (((!slidemo->player->climbing && abs((signed)(slidemo->angle - ANGLE_90 - climbline)) < ANGLE_45)
|
if (((!slidemo->player->climbing && abs((signed)(slidemo->angle - ANGLE_90 - climbline)) < ANGLE_45)
|
||||||
|| (slidemo->player->climbing == 1 && abs((signed)(slidemo->angle - climbline)) < ANGLE_135))
|
|| (slidemo->player->climbing == 1 && abs((signed)(slidemo->angle - climbline)) < ANGLE_135))
|
||||||
&& P_IsClimbingValid(slidemo->player, climbangle))
|
&& canclimb)
|
||||||
{
|
{
|
||||||
slidemo->angle = climbangle;
|
slidemo->angle = climbangle;
|
||||||
if (!demoplayback || P_AnalogMove(slidemo->player))
|
if (!demoplayback || P_AnalogMove(slidemo->player))
|
||||||
|
|
475
src/p_user.c
475
src/p_user.c
|
@ -2284,9 +2284,9 @@ static void P_DoClimbing(player_t *player)
|
||||||
platx = P_ReturnThrustX(player->mo, player->mo->angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale));
|
platx = P_ReturnThrustX(player->mo, player->mo->angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale));
|
||||||
platy = P_ReturnThrustY(player->mo, player->mo->angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale));
|
platy = P_ReturnThrustY(player->mo, player->mo->angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale));
|
||||||
|
|
||||||
glidesector = R_PointInSubsector(player->mo->x + platx, player->mo->y + platy);
|
glidesector = R_IsPointInSubsector(player->mo->x + platx, player->mo->y + platy);
|
||||||
|
|
||||||
if (glidesector->sector != player->mo->subsector->sector)
|
if (!glidesector || glidesector->sector != player->mo->subsector->sector)
|
||||||
{
|
{
|
||||||
boolean floorclimb;
|
boolean floorclimb;
|
||||||
boolean thrust;
|
boolean thrust;
|
||||||
|
@ -2298,299 +2298,304 @@ static void P_DoClimbing(player_t *player)
|
||||||
boostup = false;
|
boostup = false;
|
||||||
skyclimber = false;
|
skyclimber = false;
|
||||||
|
|
||||||
#ifdef ESLOPE
|
if (glidesector)
|
||||||
floorheight = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y)
|
|
||||||
: glidesector->sector->floorheight;
|
|
||||||
ceilingheight = glidesector->sector->c_slope ? P_GetZAt(glidesector->sector->c_slope, player->mo->x, player->mo->y)
|
|
||||||
: glidesector->sector->ceilingheight;
|
|
||||||
#else
|
|
||||||
floorheight = glidesector->sector->floorheight;
|
|
||||||
ceilingheight = glidesector->sector->ceilingheight;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (glidesector->sector->ffloors)
|
|
||||||
{
|
{
|
||||||
ffloor_t *rover;
|
#ifdef ESLOPE
|
||||||
fixed_t topheight, bottomheight; // ESLOPE
|
floorheight = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y)
|
||||||
|
: glidesector->sector->floorheight;
|
||||||
|
ceilingheight = glidesector->sector->c_slope ? P_GetZAt(glidesector->sector->c_slope, player->mo->x, player->mo->y)
|
||||||
|
: glidesector->sector->ceilingheight;
|
||||||
|
#else
|
||||||
|
floorheight = glidesector->sector->floorheight;
|
||||||
|
ceilingheight = glidesector->sector->ceilingheight;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
|
if (glidesector->sector->ffloors)
|
||||||
{
|
{
|
||||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
ffloor_t *rover;
|
||||||
continue;
|
fixed_t topheight, bottomheight; // ESLOPE
|
||||||
|
|
||||||
floorclimb = true;
|
for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
|
||||||
|
{
|
||||||
|
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
floorclimb = true;
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
|
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
|
||||||
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
|
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
|
||||||
#else
|
#else
|
||||||
bottomheight = *rover->bottomheight;
|
bottomheight = *rover->bottomheight;
|
||||||
topheight = *rover->topheight;
|
topheight = *rover->topheight;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 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)
|
||||||
{
|
|
||||||
if ((!(player->mo->eflags & MFE_VERTICALFLIP) && (bottomheight < player->mo->z+player->mo->height)
|
|
||||||
&& (topheight >= player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale)))
|
|
||||||
|| ((player->mo->eflags & MFE_VERTICALFLIP) && (topheight > player->mo->z)
|
|
||||||
&& (bottomheight <= player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale))))
|
|
||||||
{
|
{
|
||||||
if (cmd->forwardmove != 0)
|
if ((!(player->mo->eflags & MFE_VERTICALFLIP) && (bottomheight < player->mo->z+player->mo->height)
|
||||||
player->mo->momz += rover->master->frontsector->floorspeed;
|
&& (topheight >= player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale)))
|
||||||
else
|
|| ((player->mo->eflags & MFE_VERTICALFLIP) && (topheight > player->mo->z)
|
||||||
|
&& (bottomheight <= player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale))))
|
||||||
{
|
{
|
||||||
player->mo->momz = rover->master->frontsector->floorspeed;
|
if (cmd->forwardmove != 0)
|
||||||
climb = false;
|
player->mo->momz += rover->master->frontsector->floorspeed;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player->mo->momz = rover->master->frontsector->floorspeed;
|
||||||
|
climb = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Gravity is flipped, so the comments are, too.
|
// Gravity is flipped, so the comments are, too.
|
||||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
|
||||||
// Trying to climb down past the bottom of the FOF
|
|
||||||
if ((topheight >= player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) >= topheight))
|
|
||||||
{
|
{
|
||||||
fixed_t bottomheight2;
|
// Trying to climb down past the bottom of the FOF
|
||||||
ffloor_t *roverbelow;
|
if ((topheight >= player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) >= topheight))
|
||||||
boolean foundfof = false;
|
|
||||||
floorclimb = true;
|
|
||||||
boostup = false;
|
|
||||||
|
|
||||||
// Is there a FOF directly below this one that we can move onto?
|
|
||||||
for (roverbelow = glidesector->sector->ffloors; roverbelow; roverbelow = roverbelow->next)
|
|
||||||
{
|
{
|
||||||
if (!(roverbelow->flags & FF_EXISTS) || !(roverbelow->flags & FF_BLOCKPLAYER) || (roverbelow->flags & FF_BUSTUP))
|
fixed_t bottomheight2;
|
||||||
continue;
|
ffloor_t *roverbelow;
|
||||||
|
boolean foundfof = false;
|
||||||
|
floorclimb = true;
|
||||||
|
boostup = false;
|
||||||
|
|
||||||
if (roverbelow == rover)
|
// Is there a FOF directly below this one that we can move onto?
|
||||||
continue;
|
for (roverbelow = glidesector->sector->ffloors; roverbelow; roverbelow = roverbelow->next)
|
||||||
|
{
|
||||||
|
if (!(roverbelow->flags & FF_EXISTS) || !(roverbelow->flags & FF_BLOCKPLAYER) || (roverbelow->flags & FF_BUSTUP))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (roverbelow == rover)
|
||||||
|
continue;
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
bottomheight2 = *roverbelow->b_slope ? P_GetZAt(*roverbelow->b_slope, player->mo->x, player->mo->y) : *roverbelow->bottomheight;
|
bottomheight2 = *roverbelow->b_slope ? P_GetZAt(*roverbelow->b_slope, player->mo->x, player->mo->y) : *roverbelow->bottomheight;
|
||||||
#else
|
#else
|
||||||
bottomheight2 = *roverbelow->bottomheight;
|
bottomheight2 = *roverbelow->bottomheight;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (bottomheight2 < topheight + FixedMul(16*FRACUNIT, player->mo->scale))
|
if (bottomheight2 < topheight + FixedMul(16*FRACUNIT, player->mo->scale))
|
||||||
foundfof = true;
|
foundfof = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!foundfof)
|
||||||
|
player->mo->momz = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foundfof)
|
// Below the FOF
|
||||||
player->mo->momz = 0;
|
if (topheight <= player->mo->z)
|
||||||
}
|
|
||||||
|
|
||||||
// Below the FOF
|
|
||||||
if (topheight <= player->mo->z)
|
|
||||||
{
|
|
||||||
floorclimb = false;
|
|
||||||
boostup = false;
|
|
||||||
thrust = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Above the FOF
|
|
||||||
if (bottomheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale))
|
|
||||||
{
|
|
||||||
floorclimb = false;
|
|
||||||
thrust = true;
|
|
||||||
boostup = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Trying to climb down past the bottom of a FOF
|
|
||||||
if ((bottomheight <= player->mo->z) && ((player->mo->z + player->mo->momz) <= bottomheight))
|
|
||||||
{
|
|
||||||
fixed_t topheight2;
|
|
||||||
ffloor_t *roverbelow;
|
|
||||||
boolean foundfof = false;
|
|
||||||
floorclimb = true;
|
|
||||||
boostup = false;
|
|
||||||
|
|
||||||
// Is there a FOF directly below this one that we can move onto?
|
|
||||||
for (roverbelow = glidesector->sector->ffloors; roverbelow; roverbelow = roverbelow->next)
|
|
||||||
{
|
{
|
||||||
if (!(roverbelow->flags & FF_EXISTS) || !(roverbelow->flags & FF_BLOCKPLAYER) || (roverbelow->flags & FF_BUSTUP))
|
floorclimb = false;
|
||||||
continue;
|
boostup = false;
|
||||||
|
thrust = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (roverbelow == rover)
|
// Above the FOF
|
||||||
continue;
|
if (bottomheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale))
|
||||||
|
{
|
||||||
|
floorclimb = false;
|
||||||
|
thrust = true;
|
||||||
|
boostup = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Trying to climb down past the bottom of a FOF
|
||||||
|
if ((bottomheight <= player->mo->z) && ((player->mo->z + player->mo->momz) <= bottomheight))
|
||||||
|
{
|
||||||
|
fixed_t topheight2;
|
||||||
|
ffloor_t *roverbelow;
|
||||||
|
boolean foundfof = false;
|
||||||
|
floorclimb = true;
|
||||||
|
boostup = false;
|
||||||
|
|
||||||
|
// Is there a FOF directly below this one that we can move onto?
|
||||||
|
for (roverbelow = glidesector->sector->ffloors; roverbelow; roverbelow = roverbelow->next)
|
||||||
|
{
|
||||||
|
if (!(roverbelow->flags & FF_EXISTS) || !(roverbelow->flags & FF_BLOCKPLAYER) || (roverbelow->flags & FF_BUSTUP))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (roverbelow == rover)
|
||||||
|
continue;
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
topheight2 = *roverbelow->t_slope ? P_GetZAt(*roverbelow->t_slope, player->mo->x, player->mo->y) : *roverbelow->topheight;
|
topheight2 = *roverbelow->t_slope ? P_GetZAt(*roverbelow->t_slope, player->mo->x, player->mo->y) : *roverbelow->topheight;
|
||||||
#else
|
#else
|
||||||
topheight2 = *roverbelow->topheight;
|
topheight2 = *roverbelow->topheight;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (topheight2 > bottomheight - FixedMul(16*FRACUNIT, player->mo->scale))
|
if (topheight2 > bottomheight - FixedMul(16*FRACUNIT, player->mo->scale))
|
||||||
foundfof = true;
|
foundfof = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!foundfof)
|
||||||
|
player->mo->momz = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foundfof)
|
// Below the FOF
|
||||||
player->mo->momz = 0;
|
if (bottomheight >= player->mo->z + player->mo->height)
|
||||||
|
{
|
||||||
|
floorclimb = false;
|
||||||
|
boostup = false;
|
||||||
|
thrust = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Above the FOF
|
||||||
|
if (topheight < player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale))
|
||||||
|
{
|
||||||
|
floorclimb = false;
|
||||||
|
thrust = true;
|
||||||
|
boostup = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Below the FOF
|
if (floorclimb)
|
||||||
if (bottomheight >= player->mo->z + player->mo->height)
|
|
||||||
{
|
{
|
||||||
floorclimb = false;
|
if (rover->flags & FF_CRUMBLE && !(netgame && player->spectator))
|
||||||
boostup = false;
|
EV_StartCrumble(rover->master->frontsector, rover, (rover->flags & FF_FLOATBOB), player, rover->alpha, !(rover->flags & FF_NORETURN));
|
||||||
thrust = false;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Above the FOF
|
|
||||||
if (topheight < player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale))
|
|
||||||
{
|
|
||||||
floorclimb = false;
|
|
||||||
thrust = true;
|
|
||||||
boostup = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (floorclimb)
|
|
||||||
{
|
|
||||||
if (rover->flags & FF_CRUMBLE && !(netgame && player->spectator))
|
|
||||||
EV_StartCrumble(rover->master->frontsector, rover, (rover->flags & FF_FLOATBOB), player, rover->alpha, !(rover->flags & FF_NORETURN));
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Gravity is flipped, so are comments.
|
// Gravity is flipped, so are comments.
|
||||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
|
||||||
// Trying to climb down past the upper texture area
|
|
||||||
if ((floorheight >= player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) >= floorheight))
|
|
||||||
{
|
{
|
||||||
boolean foundfof = false;
|
// Trying to climb down past the upper texture area
|
||||||
floorclimb = true;
|
if ((floorheight >= player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) >= floorheight))
|
||||||
|
|
||||||
// Is there a FOF directly below that we can move onto?
|
|
||||||
if (glidesector->sector->ffloors)
|
|
||||||
{
|
{
|
||||||
fixed_t bottomheight;
|
boolean foundfof = false;
|
||||||
ffloor_t *rover;
|
floorclimb = true;
|
||||||
for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
|
|
||||||
|
// Is there a FOF directly below that we can move onto?
|
||||||
|
if (glidesector->sector->ffloors)
|
||||||
{
|
{
|
||||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
fixed_t bottomheight;
|
||||||
continue;
|
ffloor_t *rover;
|
||||||
|
for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
|
||||||
|
{
|
||||||
|
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
||||||
|
continue;
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
|
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
|
||||||
#else
|
#else
|
||||||
bottomheight = *rover->bottomheight;
|
bottomheight = *rover->bottomheight;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (bottomheight < floorheight + FixedMul(16*FRACUNIT, player->mo->scale))
|
if (bottomheight < floorheight + FixedMul(16*FRACUNIT, player->mo->scale))
|
||||||
{
|
{
|
||||||
foundfof = true;
|
foundfof = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!foundfof)
|
||||||
|
player->mo->momz = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foundfof)
|
// Reached the top of the lower texture area
|
||||||
player->mo->momz = 0;
|
if (!floorclimb && ceilingheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale)
|
||||||
|
&& (glidesector->sector->ceilingpic == skyflatnum || floorheight < (player->mo->z - FixedMul(8*FRACUNIT, player->mo->scale))))
|
||||||
|
{
|
||||||
|
thrust = true;
|
||||||
|
boostup = true;
|
||||||
|
// Play climb-up animation here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Trying to climb down past the upper texture area
|
||||||
|
if ((ceilingheight <= player->mo->z) && ((player->mo->z + player->mo->momz) <= ceilingheight))
|
||||||
|
{
|
||||||
|
boolean foundfof = false;
|
||||||
|
floorclimb = true;
|
||||||
|
|
||||||
|
// Is there a FOF directly below that we can move onto?
|
||||||
|
if (glidesector->sector->ffloors)
|
||||||
|
{
|
||||||
|
ffloor_t *rover;
|
||||||
|
for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
|
||||||
|
{
|
||||||
|
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (*rover->topheight > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
|
||||||
|
{
|
||||||
|
foundfof = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!foundfof)
|
||||||
|
player->mo->momz = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow climbing from a FOF or lower texture onto the upper texture and vice versa.
|
||||||
|
if (player->mo->z > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
|
||||||
|
{
|
||||||
|
floorclimb = true;
|
||||||
|
thrust = false;
|
||||||
|
boostup = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reached the top of the lower texture area
|
||||||
|
if (!floorclimb && floorheight < player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale)
|
||||||
|
&& (glidesector->sector->ceilingpic == skyflatnum || ceilingheight > (player->mo->z + player->mo->height + FixedMul(8*FRACUNIT, player->mo->scale))))
|
||||||
|
{
|
||||||
|
thrust = true;
|
||||||
|
boostup = true;
|
||||||
|
// Play climb-up animation here
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reached the top of the lower texture area
|
// Trying to climb on the sky
|
||||||
if (!floorclimb && ceilingheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale)
|
if ((ceilingheight < player->mo->z) && glidesector->sector->ceilingpic == skyflatnum)
|
||||||
&& (glidesector->sector->ceilingpic == skyflatnum || floorheight < (player->mo->z - FixedMul(8*FRACUNIT, player->mo->scale))))
|
|
||||||
{
|
{
|
||||||
thrust = true;
|
skyclimber = true;
|
||||||
boostup = true;
|
}
|
||||||
// Play climb-up animation here
|
|
||||||
|
// Climbing on the lower texture area?
|
||||||
|
if ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale) < floorheight)
|
||||||
|
|| ((player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height <= floorheight))
|
||||||
|
{
|
||||||
|
floorclimb = true;
|
||||||
|
|
||||||
|
if (glidesector->sector->floorspeed)
|
||||||
|
{
|
||||||
|
if (cmd->forwardmove != 0)
|
||||||
|
player->mo->momz += glidesector->sector->floorspeed;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player->mo->momz = glidesector->sector->floorspeed;
|
||||||
|
climb = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Climbing on the upper texture area?
|
||||||
|
else if ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z >= ceilingheight)
|
||||||
|
|| ((player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale) > ceilingheight))
|
||||||
|
{
|
||||||
|
floorclimb = true;
|
||||||
|
|
||||||
|
if (glidesector->sector->ceilspeed)
|
||||||
|
{
|
||||||
|
if (cmd->forwardmove != 0)
|
||||||
|
player->mo->momz += glidesector->sector->ceilspeed;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player->mo->momz = glidesector->sector->ceilspeed;
|
||||||
|
climb = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
// Trying to climb down past the upper texture area
|
|
||||||
if ((ceilingheight <= player->mo->z) && ((player->mo->z + player->mo->momz) <= ceilingheight))
|
|
||||||
{
|
|
||||||
boolean foundfof = false;
|
|
||||||
floorclimb = true;
|
|
||||||
|
|
||||||
// Is there a FOF directly below that we can move onto?
|
|
||||||
if (glidesector->sector->ffloors)
|
|
||||||
{
|
|
||||||
ffloor_t *rover;
|
|
||||||
for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
|
|
||||||
{
|
|
||||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (*rover->topheight > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
|
|
||||||
{
|
|
||||||
foundfof = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!foundfof)
|
|
||||||
player->mo->momz = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allow climbing from a FOF or lower texture onto the upper texture and vice versa.
|
|
||||||
if (player->mo->z > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
|
|
||||||
{
|
|
||||||
floorclimb = true;
|
|
||||||
thrust = false;
|
|
||||||
boostup = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reached the top of the lower texture area
|
|
||||||
if (!floorclimb && floorheight < player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale)
|
|
||||||
&& (glidesector->sector->ceilingpic == skyflatnum || ceilingheight > (player->mo->z + player->mo->height + FixedMul(8*FRACUNIT, player->mo->scale))))
|
|
||||||
{
|
|
||||||
thrust = true;
|
|
||||||
boostup = true;
|
|
||||||
// Play climb-up animation here
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Trying to climb on the sky
|
|
||||||
if ((ceilingheight < player->mo->z) && glidesector->sector->ceilingpic == skyflatnum)
|
|
||||||
{
|
|
||||||
skyclimber = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Climbing on the lower texture area?
|
|
||||||
if ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale) < floorheight)
|
|
||||||
|| ((player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height <= floorheight))
|
|
||||||
{
|
|
||||||
floorclimb = true;
|
floorclimb = true;
|
||||||
|
|
||||||
if (glidesector->sector->floorspeed)
|
|
||||||
{
|
|
||||||
if (cmd->forwardmove != 0)
|
|
||||||
player->mo->momz += glidesector->sector->floorspeed;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player->mo->momz = glidesector->sector->floorspeed;
|
|
||||||
climb = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Climbing on the upper texture area?
|
|
||||||
else if ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z >= ceilingheight)
|
|
||||||
|| ((player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale) > ceilingheight))
|
|
||||||
{
|
|
||||||
floorclimb = true;
|
|
||||||
|
|
||||||
if (glidesector->sector->ceilspeed)
|
|
||||||
{
|
|
||||||
if (cmd->forwardmove != 0)
|
|
||||||
player->mo->momz += glidesector->sector->ceilspeed;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player->mo->momz = glidesector->sector->ceilspeed;
|
|
||||||
climb = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player->lastsidehit != -1 && player->lastlinehit != -1)
|
if (player->lastsidehit != -1 && player->lastlinehit != -1)
|
||||||
{
|
{
|
||||||
thinker_t *think;
|
thinker_t *think;
|
||||||
|
|
Loading…
Reference in a new issue