mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 21:01:04 +00:00
Quicksand now supports slopes and also reverse gravity.
This commit is contained in:
parent
04a38a683b
commit
d13ca362d6
1 changed files with 22 additions and 4 deletions
26
src/p_user.c
26
src/p_user.c
|
@ -1940,6 +1940,7 @@ static void P_CheckQuicksand(player_t *player)
|
|||
{
|
||||
ffloor_t *rover;
|
||||
fixed_t sinkspeed, friction;
|
||||
fixed_t topheight, bottomheight;
|
||||
|
||||
if (!(player->mo->subsector->sector->ffloors && player->mo->momz <= 0))
|
||||
return;
|
||||
|
@ -1951,16 +1952,33 @@ static void P_CheckQuicksand(player_t *player)
|
|||
if (!(rover->flags & FF_QUICKSAND))
|
||||
continue;
|
||||
|
||||
if (*rover->topheight >= player->mo->z && *rover->bottomheight < player->mo->z + player->mo->height)
|
||||
topheight = P_GetSpecialTopZ(player->mo, sectors + rover->secnum, player->mo->subsector->sector);
|
||||
bottomheight = P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, player->mo->subsector->sector);
|
||||
|
||||
if (topheight >= player->mo->z && bottomheight < player->mo->z + player->mo->height)
|
||||
{
|
||||
sinkspeed = abs(rover->master->v1->x - rover->master->v2->x)>>1;
|
||||
|
||||
sinkspeed = FixedDiv(sinkspeed,TICRATE*FRACUNIT);
|
||||
|
||||
player->mo->z -= sinkspeed;
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
fixed_t ceilingheight = P_GetCeilingZ(player->mo, player->mo->subsector->sector, player->mo->x, player->mo->y, NULL);
|
||||
|
||||
if (player->mo->z <= player->mo->subsector->sector->floorheight)
|
||||
player->mo->z = player->mo->subsector->sector->floorheight;
|
||||
player->mo->z += sinkspeed;
|
||||
|
||||
if (player->mo->z + player->mo->height >= ceilingheight)
|
||||
player->mo->z = ceilingheight - player->mo->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
fixed_t floorheight = P_GetFloorZ(player->mo, player->mo->subsector->sector, player->mo->x, player->mo->y, NULL);
|
||||
|
||||
player->mo->z -= sinkspeed;
|
||||
|
||||
if (player->mo->z <= floorheight)
|
||||
player->mo->z = floorheight;
|
||||
}
|
||||
|
||||
friction = abs(rover->master->v1->y - rover->master->v2->y)>>6;
|
||||
|
||||
|
|
Loading…
Reference in a new issue