mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Clip watertop and waterbottom between other sector and FOFs
This commit is contained in:
parent
be34cd699b
commit
f0c9e49a2b
1 changed files with 19 additions and 4 deletions
23
src/p_mobj.c
23
src/p_mobj.c
|
|
@ -2956,6 +2956,8 @@ void P_MobjCheckWater(mobj_t *mobj)
|
||||||
player_t *p = mobj->player; // Will just be null if not a player.
|
player_t *p = mobj->player; // Will just be null if not a player.
|
||||||
fixed_t height = mobj->height;
|
fixed_t height = mobj->height;
|
||||||
boolean wasgroundpounding = false;
|
boolean wasgroundpounding = false;
|
||||||
|
fixed_t top2 = P_GetSectorCeilingZAt(sector, mobj->x, mobj->y);
|
||||||
|
fixed_t bot2 = P_GetSectorFloorZAt(sector, mobj->x, mobj->y);
|
||||||
|
|
||||||
// Default if no water exists.
|
// Default if no water exists.
|
||||||
mobj->watertop = mobj->waterbottom = mobj->z - 1000*FRACUNIT;
|
mobj->watertop = mobj->waterbottom = mobj->z - 1000*FRACUNIT;
|
||||||
|
|
@ -2966,14 +2968,21 @@ void P_MobjCheckWater(mobj_t *mobj)
|
||||||
for (rover = sector->ffloors; rover; rover = rover->next)
|
for (rover = sector->ffloors; rover; rover = rover->next)
|
||||||
{
|
{
|
||||||
fixed_t topheight, bottomheight;
|
fixed_t topheight, bottomheight;
|
||||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE)
|
|
||||||
|| (((rover->flags & FF_BLOCKPLAYER) && mobj->player)
|
|
||||||
|| ((rover->flags & FF_BLOCKOTHERS) && !mobj->player)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
topheight = P_GetFFloorTopZAt (rover, mobj->x, mobj->y);
|
topheight = P_GetFFloorTopZAt (rover, mobj->x, mobj->y);
|
||||||
bottomheight = P_GetFFloorBottomZAt(rover, mobj->x, mobj->y);
|
bottomheight = P_GetFFloorBottomZAt(rover, mobj->x, mobj->y);
|
||||||
|
|
||||||
|
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE)
|
||||||
|
|| (((rover->flags & FF_BLOCKPLAYER) && mobj->player)
|
||||||
|
|| ((rover->flags & FF_BLOCKOTHERS) && !mobj->player)))
|
||||||
|
{
|
||||||
|
if (topheight < top2 && topheight > thingtop)
|
||||||
|
top2 = topheight;
|
||||||
|
if (bottomheight > bot2 && bottomheight < mobj->z)
|
||||||
|
bot2 = bottomheight;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (mobj->eflags & MFE_VERTICALFLIP)
|
if (mobj->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
{
|
||||||
if (topheight < (thingtop - (height>>1))
|
if (topheight < (thingtop - (height>>1))
|
||||||
|
|
@ -3011,6 +3020,12 @@ void P_MobjCheckWater(mobj_t *mobj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mobj->watertop > top2)
|
||||||
|
mobj->watertop = top2;
|
||||||
|
|
||||||
|
if (mobj->waterbottom < bot2)
|
||||||
|
mobj->waterbottom = bot2;
|
||||||
|
|
||||||
// Spectators and dead players don't get to do any of the things after this.
|
// Spectators and dead players don't get to do any of the things after this.
|
||||||
if (p && (p->spectator || p->playerstate != PST_LIVE))
|
if (p && (p->spectator || p->playerstate != PST_LIVE))
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue