mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 04:41:23 +00:00
Make all specials reliant on floor touch work right with sloeps
(I might've missed some, though)
This commit is contained in:
parent
a9dba0ffd1
commit
a9d49cd9fa
4 changed files with 73 additions and 60 deletions
|
@ -1174,8 +1174,8 @@ void T_SpikeSector(levelspecthink_t *spikes)
|
|||
|
||||
if (affectsec == spikes->sector) // Applied to an actual sector
|
||||
{
|
||||
fixed_t affectfloor = P_GetFloorZ(thing, affectsec, thing->x, thing->y, NULL);
|
||||
fixed_t affectceil = P_GetCeilingZ(thing, affectsec, thing->x, thing->y, NULL);
|
||||
fixed_t affectfloor = P_GetSpecialBottomZ(thing, affectsec, affectsec);
|
||||
fixed_t affectceil = P_GetSpecialTopZ(thing, affectsec, affectsec);
|
||||
|
||||
if (affectsec->flags & SF_FLIPSPECIAL_FLOOR)
|
||||
{
|
||||
|
@ -1197,12 +1197,14 @@ void T_SpikeSector(levelspecthink_t *spikes)
|
|||
}
|
||||
else
|
||||
{
|
||||
fixed_t affectfloor = P_GetSpecialBottomZ(thing, affectsec, spikes->sector);
|
||||
fixed_t affectceil = P_GetSpecialTopZ(thing, affectsec, spikes->sector);
|
||||
if (affectsec->flags & SF_FLIPSPECIAL_FLOOR)
|
||||
{
|
||||
if (!(thing->eflags & MFE_VERTICALFLIP) && thing->momz > 0)
|
||||
continue;
|
||||
|
||||
if (thing->z == affectsec->ceilingheight)
|
||||
if (thing->z == affectceil)
|
||||
dothepain = true;
|
||||
}
|
||||
|
||||
|
@ -1211,7 +1213,7 @@ void T_SpikeSector(levelspecthink_t *spikes)
|
|||
if ((thing->eflags & MFE_VERTICALFLIP) && thing->momz < 0)
|
||||
continue;
|
||||
|
||||
if (thing->z + thing->height == affectsec->floorheight)
|
||||
if (thing->z + thing->height == affectfloor)
|
||||
dothepain = true;
|
||||
}
|
||||
}
|
||||
|
@ -2090,6 +2092,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
|||
boolean FOFsector = false;
|
||||
boolean inAndOut = false;
|
||||
boolean floortouch = false;
|
||||
fixed_t bottomheight, topheight;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
|
@ -2154,10 +2157,13 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
|||
if (players[j].mo->subsector->sector != targetsec)
|
||||
continue;
|
||||
|
||||
if (players[j].mo->z > sec->ceilingheight)
|
||||
topheight = P_GetSpecialTopZ(players[j].mo, sec, targetsec);
|
||||
bottomheight = P_GetSpecialBottomZ(players[j].mo, sec, targetsec);
|
||||
|
||||
if (players[j].mo->z > topheight)
|
||||
continue;
|
||||
|
||||
if (players[j].mo->z + players[j].mo->height < sec->floorheight)
|
||||
if (players[j].mo->z + players[j].mo->height < bottomheight)
|
||||
continue;
|
||||
|
||||
if (floortouch == true && P_IsObjectOnGroundIn(players[j].mo, targetsec))
|
||||
|
@ -2317,7 +2323,7 @@ void T_RaiseSector(levelspecthink_t *raise)
|
|||
if (raise->vars[1] && !(thing->player->pflags & PF_STARTDASH))
|
||||
continue;
|
||||
|
||||
if (!(thing->z == raise->sector->ceilingheight))
|
||||
if (!(thing->z == P_GetSpecialTopZ(thing, raise->sector, sector)))
|
||||
continue;
|
||||
|
||||
playeronme = true;
|
||||
|
|
|
@ -3562,11 +3562,11 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|
|||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_CRUMBLE))
|
||||
continue;
|
||||
|
||||
topheight = P_GetFOFTopZ(mobj, node->m_sector, rover, mobj->x, mobj->y, NULL);
|
||||
bottomheight = P_GetFOFBottomZ(mobj, node->m_sector, rover, mobj->x, mobj->y, NULL);
|
||||
topheight = P_GetSpecialTopZ(mobj, sectors + rover->secnum, node->m_sector);
|
||||
bottomheight = P_GetSpecialBottomZ(mobj, sectors + rover->secnum, node->m_sector);
|
||||
|
||||
if ((topheight <= mobj->z + 16*mobj->scale && topheight >= mobj->z && !(mobj->eflags & MFE_VERTICALFLIP))
|
||||
|| (bottomheight >= mobj->z + mobj->height && bottomheight <= mobj->z + mobj->height - 16*mobj->scale && mobj->eflags & MFE_VERTICALFLIP)) // You nut.
|
||||
if ((topheight == mobj->z && !(mobj->eflags & MFE_VERTICALFLIP))
|
||||
|| (bottomheight == mobj->z + mobj->height && mobj->eflags & MFE_VERTICALFLIP)) // You nut.
|
||||
EV_StartCrumble(rover->master->frontsector, rover, (rover->flags & FF_FLOATBOB), mobj->player, rover->alpha, !(rover->flags & FF_NORETURN));
|
||||
}
|
||||
}
|
||||
|
|
97
src/p_spec.c
97
src/p_spec.c
|
@ -3365,6 +3365,7 @@ sector_t *P_PlayerTouchingSectorSpecial(player_t *player, INT32 section, INT32 n
|
|||
static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *targetsec)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
fixed_t top, bottom;
|
||||
|
||||
if (!mo->player) // should NEVER happen
|
||||
return false;
|
||||
|
@ -3381,6 +3382,9 @@ static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *tar
|
|||
//if (!(rover->flags & FF_EXISTS))
|
||||
// return false;
|
||||
|
||||
top = P_GetSpecialTopZ(mo, sector, targetsec);
|
||||
bottom = P_GetSpecialBottomZ(mo, sector, targetsec);
|
||||
|
||||
// Check the 3D floor's type...
|
||||
if (rover->flags & FF_BLOCKPLAYER)
|
||||
{
|
||||
|
@ -3388,27 +3392,27 @@ static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *tar
|
|||
if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)
|
||||
&& !(rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING))
|
||||
{
|
||||
if ((mo->eflags & MFE_VERTICALFLIP) || mo->z != *rover->topheight)
|
||||
if ((mo->eflags & MFE_VERTICALFLIP) || mo->z != top)
|
||||
return false;
|
||||
}
|
||||
else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)
|
||||
&& !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR))
|
||||
{
|
||||
if (!(mo->eflags & MFE_VERTICALFLIP)
|
||||
|| mo->z + mo->height != *rover->bottomheight)
|
||||
|| mo->z + mo->height != bottom)
|
||||
return false;
|
||||
}
|
||||
else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH)
|
||||
{
|
||||
if (!((mo->eflags & MFE_VERTICALFLIP && mo->z + mo->height == *rover->bottomheight)
|
||||
|| (!(mo->eflags & MFE_VERTICALFLIP) && mo->z == *rover->topheight)))
|
||||
if (!((mo->eflags & MFE_VERTICALFLIP && mo->z + mo->height == bottom)
|
||||
|| (!(mo->eflags & MFE_VERTICALFLIP) && mo->z == top)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Water and intangible FOFs
|
||||
if (mo->z > *rover->topheight || (mo->z + mo->height) < *rover->bottomheight)
|
||||
if (mo->z > top || (mo->z + mo->height) < bottom)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3426,9 +3430,9 @@ static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *tar
|
|||
static inline boolean P_MobjReadyToTrigger(mobj_t *mo, sector_t *sec)
|
||||
{
|
||||
if (mo->eflags & MFE_VERTICALFLIP)
|
||||
return (mo->z+mo->height == sec->ceilingheight && sec->flags & SF_FLIPSPECIAL_CEILING);
|
||||
return (mo->z+mo->height == P_GetSpecialTopZ(mo, sec, sec) && sec->flags & SF_FLIPSPECIAL_CEILING);
|
||||
else
|
||||
return (mo->z == sec->floorheight && sec->flags & SF_FLIPSPECIAL_FLOOR);
|
||||
return (mo->z == P_GetSpecialBottomZ(mo, sec, sec) && sec->flags & SF_FLIPSPECIAL_FLOOR);
|
||||
}
|
||||
|
||||
/** Applies a sector special to a player.
|
||||
|
@ -4389,27 +4393,27 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector)
|
|||
if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)
|
||||
&& !(rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING))
|
||||
{
|
||||
if ((player->mo->eflags & MFE_VERTICALFLIP) || player->mo->z != *rover->topheight)
|
||||
if ((player->mo->eflags & MFE_VERTICALFLIP) || player->mo->z != P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector))
|
||||
continue;
|
||||
}
|
||||
else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)
|
||||
&& !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR))
|
||||
{
|
||||
if (!(player->mo->eflags & MFE_VERTICALFLIP)
|
||||
|| player->mo->z + player->mo->height != *rover->bottomheight)
|
||||
|| player->mo->z + player->mo->height != P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, sector))
|
||||
continue;
|
||||
}
|
||||
else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH)
|
||||
{
|
||||
if (!((player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height == *rover->bottomheight)
|
||||
|| (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z == *rover->topheight)))
|
||||
if (!((player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height == P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, sector))
|
||||
|| (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z == P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector))))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Water and DEATH FOG!!! heh
|
||||
if (player->mo->z > *rover->topheight || (player->mo->z + player->mo->height) < *rover->bottomheight)
|
||||
if (player->mo->z > P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector) || (player->mo->z + player->mo->height) < P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -4582,8 +4586,8 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector)
|
|||
return;
|
||||
}
|
||||
|
||||
f_affectpoint = P_GetFloorZ(player->mo, sector, player->mo->x, player->mo->y, NULL);
|
||||
c_affectpoint = P_GetCeilingZ(player->mo, sector, player->mo->x, player->mo->y, NULL);
|
||||
f_affectpoint = P_GetSpecialBottomZ(player->mo, sector, sector);
|
||||
c_affectpoint = P_GetSpecialTopZ(player->mo, sector, sector);
|
||||
|
||||
// Only go further if on the ground
|
||||
if ((sector->flags & SF_FLIPSPECIAL_FLOOR) && !(sector->flags & SF_FLIPSPECIAL_CEILING) && player->mo->z != f_affectpoint)
|
||||
|
@ -5340,6 +5344,7 @@ void T_LaserFlash(laserthink_t *flash)
|
|||
sector_t *sourcesec;
|
||||
ffloor_t *ffloor = flash->ffloor;
|
||||
sector_t *sector = flash->sector;
|
||||
fixed_t top, bottom;
|
||||
|
||||
if (!ffloor || !(ffloor->flags & FF_EXISTS))
|
||||
return;
|
||||
|
@ -5363,8 +5368,11 @@ void T_LaserFlash(laserthink_t *flash)
|
|||
&& thing->flags & MF_BOSS)
|
||||
continue; // Don't hurt bosses
|
||||
|
||||
if (thing->z >= sourcesec->ceilingheight
|
||||
|| thing->z + thing->height <= sourcesec->floorheight)
|
||||
top = P_GetSpecialTopZ(thing, sourcesec, sector);
|
||||
bottom = P_GetSpecialBottomZ(thing, sourcesec, sector);
|
||||
|
||||
if (thing->z >= top
|
||||
|| thing->z + thing->height <= bottom)
|
||||
continue;
|
||||
|
||||
if (thing->flags & MF_SHOOTABLE)
|
||||
|
@ -6655,6 +6663,8 @@ void T_Scroll(scroll_t *s)
|
|||
if (thing->eflags & MFE_PUSHED) // Already pushed this tic by an exclusive pusher.
|
||||
continue;
|
||||
|
||||
height = P_GetSpecialBottomZ(thing, sec, psec);
|
||||
|
||||
if (!(thing->flags & MF_NOCLIP)) // Thing must be clipped
|
||||
if (!(thing->flags & MF_NOGRAVITY || thing->z+thing->height != height)) // Thing must a) be non-floating and have z+height == height
|
||||
{
|
||||
|
@ -6675,6 +6685,8 @@ void T_Scroll(scroll_t *s)
|
|||
if (thing->eflags & MFE_PUSHED)
|
||||
continue;
|
||||
|
||||
height = P_GetSpecialBottomZ(thing, sec, sec);
|
||||
|
||||
if (!(thing->flags & MF_NOCLIP) &&
|
||||
(!(thing->flags & MF_NOGRAVITY || thing->z > height)))
|
||||
{
|
||||
|
@ -6714,6 +6726,8 @@ void T_Scroll(scroll_t *s)
|
|||
if (thing->eflags & MFE_PUSHED)
|
||||
continue;
|
||||
|
||||
height = P_GetSpecialTopZ(thing, sec, psec);
|
||||
|
||||
if (!(thing->flags & MF_NOCLIP)) // Thing must be clipped
|
||||
if (!(thing->flags & MF_NOGRAVITY || thing->z != height))// Thing must a) be non-floating and have z == height
|
||||
{
|
||||
|
@ -6734,6 +6748,8 @@ void T_Scroll(scroll_t *s)
|
|||
if (thing->eflags & MFE_PUSHED)
|
||||
continue;
|
||||
|
||||
height = P_GetSpecialTopZ(thing, sec, sec);
|
||||
|
||||
if (!(thing->flags & MF_NOCLIP) &&
|
||||
(!(thing->flags & MF_NOGRAVITY || thing->z+thing->height < height)))
|
||||
{
|
||||
|
@ -7027,7 +7043,7 @@ static void Add_Friction(INT32 friction, INT32 movefactor, INT32 affectee, INT32
|
|||
*/
|
||||
void T_Friction(friction_t *f)
|
||||
{
|
||||
sector_t *sec;
|
||||
sector_t *sec, *referrer;
|
||||
mobj_t *thing;
|
||||
msecnode_t *node;
|
||||
|
||||
|
@ -7036,7 +7052,7 @@ void T_Friction(friction_t *f)
|
|||
// Make sure the sector type hasn't changed
|
||||
if (f->roverfriction)
|
||||
{
|
||||
sector_t *referrer = sectors + f->referrer;
|
||||
referrer = sectors + f->referrer;
|
||||
|
||||
if (!(GETSECSPECIAL(referrer->special, 3) == 1
|
||||
|| GETSECSPECIAL(referrer->special, 3) == 3))
|
||||
|
@ -7068,9 +7084,7 @@ void T_Friction(friction_t *f)
|
|||
{
|
||||
if (f->roverfriction)
|
||||
{
|
||||
sector_t *referrer = §ors[f->referrer];
|
||||
|
||||
if (thing->floorz != referrer->ceilingheight)
|
||||
if (thing->floorz != P_GetSpecialTopZ(thing, referrer, sec))
|
||||
{
|
||||
node = node->m_snext;
|
||||
continue;
|
||||
|
@ -7083,7 +7097,7 @@ void T_Friction(friction_t *f)
|
|||
thing->movefactor = f->movefactor;
|
||||
}
|
||||
}
|
||||
else if (sec->floorheight == thing->floorz && (thing->friction == ORIG_FRICTION // normal friction?
|
||||
else if (P_GetSpecialBottomZ(thing, sec, sec) == thing->floorz && (thing->friction == ORIG_FRICTION // normal friction?
|
||||
|| f->friction < thing->friction))
|
||||
{
|
||||
thing->friction = f->friction;
|
||||
|
@ -7357,7 +7371,7 @@ static inline boolean PIT_PushThing(mobj_t *thing)
|
|||
*/
|
||||
void T_Pusher(pusher_t *p)
|
||||
{
|
||||
sector_t *sec;
|
||||
sector_t *sec, *referrer;
|
||||
mobj_t *thing;
|
||||
msecnode_t *node;
|
||||
INT32 xspeed = 0,yspeed = 0;
|
||||
|
@ -7366,7 +7380,6 @@ void T_Pusher(pusher_t *p)
|
|||
//INT32 ht = 0;
|
||||
boolean inFOF;
|
||||
boolean touching;
|
||||
boolean foundfloor = false;
|
||||
boolean moved;
|
||||
|
||||
xspeed = yspeed = 0;
|
||||
|
@ -7378,19 +7391,16 @@ void T_Pusher(pusher_t *p)
|
|||
|
||||
if (p->roverpusher)
|
||||
{
|
||||
sector_t *referrer = §ors[p->referrer];
|
||||
referrer = §ors[p->referrer];
|
||||
|
||||
if (GETSECSPECIAL(referrer->special, 3) == 2
|
||||
|| GETSECSPECIAL(referrer->special, 3) == 3)
|
||||
foundfloor = true;
|
||||
if (!(GETSECSPECIAL(referrer->special, 3) == 2
|
||||
|| GETSECSPECIAL(referrer->special, 3) == 3))
|
||||
return;
|
||||
}
|
||||
else if (!(GETSECSPECIAL(sec->special, 3) == 2
|
||||
|| GETSECSPECIAL(sec->special, 3) == 3))
|
||||
return;
|
||||
|
||||
if (p->roverpusher && foundfloor == false) // Not even a 3d floor has the PUSH_MASK.
|
||||
return;
|
||||
|
||||
// For constant pushers (wind/current) there are 3 situations:
|
||||
//
|
||||
// 1) Affected Thing is above the floor.
|
||||
|
@ -7465,41 +7475,38 @@ void T_Pusher(pusher_t *p)
|
|||
// Find the area that the 'thing' is in
|
||||
if (p->roverpusher)
|
||||
{
|
||||
sector_t *referrer = §ors[p->referrer];
|
||||
INT32 special;
|
||||
fixed_t top, bottom;
|
||||
|
||||
special = GETSECSPECIAL(referrer->special, 3);
|
||||
|
||||
if (!(special == 2 || special == 3))
|
||||
return;
|
||||
top = P_GetSpecialTopZ(thing, referrer, sec);
|
||||
bottom = P_GetSpecialBottomZ(thing, referrer, sec);
|
||||
|
||||
if (thing->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
if (referrer->floorheight > thing->z + thing->height
|
||||
|| referrer->ceilingheight < (thing->z + (thing->height >> 1)))
|
||||
if (bottom > thing->z + thing->height
|
||||
|| top < (thing->z + (thing->height >> 1)))
|
||||
continue;
|
||||
|
||||
if (thing->z < referrer->floorheight)
|
||||
if (thing->z < bottom)
|
||||
touching = true;
|
||||
|
||||
if (thing->z + (thing->height >> 1) > referrer->floorheight)
|
||||
if (thing->z + (thing->height >> 1) > bottom)
|
||||
inFOF = true;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (referrer->ceilingheight < thing->z || referrer->floorheight > (thing->z + (thing->height >> 1)))
|
||||
if (top < thing->z || referrer->floorheight > (thing->z + (thing->height >> 1)))
|
||||
continue;
|
||||
if (thing->z + thing->height > referrer->ceilingheight)
|
||||
if (thing->z + thing->height > top)
|
||||
touching = true;
|
||||
|
||||
if (thing->z + (thing->height >> 1) < referrer->ceilingheight)
|
||||
if (thing->z + (thing->height >> 1) < top)
|
||||
inFOF = true;
|
||||
}
|
||||
}
|
||||
else // Treat the entire sector as one big FOF
|
||||
{
|
||||
if (thing->z == thing->subsector->sector->floorheight)
|
||||
if (thing->z == P_GetSpecialBottomZ(thing, sec, sec))
|
||||
touching = true;
|
||||
else if (p->type != p_current)
|
||||
inFOF = true;
|
||||
|
|
|
@ -1212,7 +1212,7 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec)
|
|||
if (mo->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
// Detect if the player is on the ceiling.
|
||||
if (mo->z+mo->height >= sec->ceilingheight)
|
||||
if (mo->z+mo->height >= P_GetSpecialTopZ(mo, sec, sec))
|
||||
return true;
|
||||
// Otherwise, detect if the player is on the bottom of a FOF.
|
||||
else
|
||||
|
@ -1236,7 +1236,7 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec)
|
|||
continue;
|
||||
|
||||
// Actually check if the player is on the suitable FOF.
|
||||
if (mo->z+mo->height == *rover->bottomheight)
|
||||
if (mo->z+mo->height == P_GetSpecialBottomZ(mo, sectors + rover->secnum, sec))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1245,7 +1245,7 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec)
|
|||
else
|
||||
{
|
||||
// Detect if the player is on the floor.
|
||||
if (mo->z <= sec->floorheight)
|
||||
if (mo->z <= P_GetSpecialBottomZ(mo, sec, sec))
|
||||
return true;
|
||||
// Otherwise, detect if the player is on the top of a FOF.
|
||||
else
|
||||
|
@ -1269,7 +1269,7 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec)
|
|||
continue;
|
||||
|
||||
// Actually check if the player is on the suitable FOF.
|
||||
if (mo->z == *rover->topheight)
|
||||
if (mo->z == P_GetSpecialTopZ(mo, sectors + rover->secnum, sec))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue