mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-05 09:46:40 +00:00
Merge branch 'fix-one-time-each-time-floor-activators' into 'master'
Activate sector each time / once actions every time mobj lands on the ground Closes #990 See merge request KartKrew/Kart!1904
This commit is contained in:
commit
e993117f23
5 changed files with 57 additions and 21 deletions
|
|
@ -103,6 +103,9 @@ camera_t *mapcampointer;
|
|||
//
|
||||
static boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z)
|
||||
{
|
||||
boolean startingonground = P_IsObjectOnGround(thing);
|
||||
sector_t *oldsector = thing->subsector->sector;
|
||||
|
||||
numspechit = 0U;
|
||||
|
||||
// the move is ok,
|
||||
|
|
@ -132,6 +135,8 @@ static boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z)
|
|||
thing->floorrover = tm.floorrover;
|
||||
thing->ceilingrover = tm.ceilingrover;
|
||||
|
||||
P_CheckSectorTransitionalEffects(thing, oldsector, startingonground);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -2985,6 +2990,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff, Try
|
|||
fixed_t startingonground = P_IsObjectOnGround(thing);
|
||||
fixed_t stairjank = 0;
|
||||
pslope_t *oldslope = thing->standingslope;
|
||||
sector_t *oldsector = thing->subsector->sector;
|
||||
|
||||
// Is the move OK?
|
||||
if (increment_move(thing, x, y, allowdropoff, &stairjank, result) == false)
|
||||
|
|
@ -3122,6 +3128,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff, Try
|
|||
|
||||
P_SetThingPosition(thing);
|
||||
|
||||
P_CheckSectorTransitionalEffects(thing, oldsector, startingonground);
|
||||
|
||||
// remove any duplicates that may be in spechitint
|
||||
spechitint_removedups();
|
||||
|
||||
|
|
|
|||
|
|
@ -1199,7 +1199,6 @@ static void P_LinkToBlockMap(mobj_t *thing, mobj_t **bmap)
|
|||
void P_SetThingPosition(mobj_t *thing)
|
||||
{ // link into subsector
|
||||
subsector_t *ss;
|
||||
sector_t *prevsec = NULL;
|
||||
sector_t *oldsec = NULL;
|
||||
fixed_t tfloorz, tceilz;
|
||||
|
||||
|
|
@ -1212,11 +1211,6 @@ void P_SetThingPosition(mobj_t *thing)
|
|||
oldsec = thing->subsector->sector;
|
||||
}
|
||||
|
||||
if (thing->subsector)
|
||||
{
|
||||
prevsec = thing->subsector->sector;
|
||||
}
|
||||
|
||||
ss = thing->subsector = R_PointInSubsector(thing->x, thing->y);
|
||||
|
||||
if (!(thing->flags & MF_NOSECTOR))
|
||||
|
|
@ -1273,12 +1267,6 @@ void P_SetThingPosition(mobj_t *thing)
|
|||
else if (thing->z <= tfloorz)
|
||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||
}
|
||||
|
||||
if (udmf && prevsec != thing->subsector->sector)
|
||||
{
|
||||
// Check for each time / once sector special actions
|
||||
P_CheckMobjTouchingSectorActions(thing, false);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
11
src/p_mobj.c
11
src/p_mobj.c
|
|
@ -2209,10 +2209,13 @@ boolean P_ZMovement(mobj_t *mo)
|
|||
{
|
||||
fixed_t dist, delta;
|
||||
boolean onground;
|
||||
boolean wasonground;
|
||||
|
||||
I_Assert(mo != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(mo));
|
||||
|
||||
wasonground = P_IsObjectOnGround(mo);
|
||||
|
||||
// Intercept the stupid 'fall through 3dfloors' bug
|
||||
if (mo->subsector->sector->ffloors)
|
||||
P_AdjustMobjFloorZ_FFloors(mo, mo->subsector->sector, 0);
|
||||
|
|
@ -2673,6 +2676,8 @@ boolean P_ZMovement(mobj_t *mo)
|
|||
}
|
||||
}
|
||||
|
||||
P_CheckSectorTransitionalEffects(mo, mo->subsector->sector, wasonground);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -2769,6 +2774,7 @@ static boolean P_PlayerPolyObjectZMovement(mobj_t *mo)
|
|||
void P_PlayerZMovement(mobj_t *mo)
|
||||
{
|
||||
boolean onground;
|
||||
boolean wasonground;
|
||||
angle_t oldPitch, oldRoll;
|
||||
|
||||
I_Assert(mo != NULL);
|
||||
|
|
@ -2777,6 +2783,7 @@ void P_PlayerZMovement(mobj_t *mo)
|
|||
if (!mo->player)
|
||||
return;
|
||||
|
||||
wasonground = P_IsObjectOnGround(mo);
|
||||
oldPitch = mo->pitch;
|
||||
oldRoll = mo->roll;
|
||||
|
||||
|
|
@ -2961,6 +2968,8 @@ void P_PlayerZMovement(mobj_t *mo)
|
|||
K_SpawnBumpEffect(mo);
|
||||
}
|
||||
}
|
||||
|
||||
P_CheckSectorTransitionalEffects(mo, mo->subsector->sector, wasonground);
|
||||
}
|
||||
|
||||
boolean P_SceneryZMovement(mobj_t *mo)
|
||||
|
|
@ -10151,7 +10160,7 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
if (udmf)
|
||||
{
|
||||
// Check for continuous sector special actions
|
||||
P_CheckMobjTouchingSectorActions(mobj, true);
|
||||
P_CheckMobjTouchingSectorActions(mobj, true, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
44
src/p_spec.c
44
src/p_spec.c
|
|
@ -5686,7 +5686,7 @@ static boolean P_AllowSpecialCeiling(sector_t *sec, mobj_t *thing)
|
|||
return false;
|
||||
}
|
||||
|
||||
static void P_CheckMobj3DFloorAction(mobj_t *mo, sector_t *sec, boolean continuous)
|
||||
static void P_CheckMobj3DFloorAction(mobj_t *mo, sector_t *sec, boolean continuous, boolean sectorchanged)
|
||||
{
|
||||
sector_t *originalsector = mo->subsector->sector;
|
||||
ffloor_t *rover;
|
||||
|
|
@ -5745,6 +5745,10 @@ static void P_CheckMobj3DFloorAction(mobj_t *mo, sector_t *sec, boolean continuo
|
|||
continue;
|
||||
}
|
||||
}
|
||||
else if (sectorchanged == false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activator = Z_Calloc(sizeof(activator_t), PU_LEVEL, NULL);
|
||||
I_Assert(activator != NULL);
|
||||
|
|
@ -5766,7 +5770,7 @@ static void P_CheckMobj3DFloorAction(mobj_t *mo, sector_t *sec, boolean continuo
|
|||
}
|
||||
}
|
||||
|
||||
static void P_CheckMobjPolyobjAction(mobj_t *mo, boolean continuous)
|
||||
static void P_CheckMobjPolyobjAction(mobj_t *mo, boolean continuous, boolean sectorchanged)
|
||||
{
|
||||
sector_t *originalsector = mo->subsector->sector;
|
||||
polyobj_t *po;
|
||||
|
|
@ -5821,6 +5825,10 @@ static void P_CheckMobjPolyobjAction(mobj_t *mo, boolean continuous)
|
|||
continue;
|
||||
}
|
||||
}
|
||||
else if (sectorchanged == false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activator = Z_Calloc(sizeof(activator_t), PU_LEVEL, NULL);
|
||||
I_Assert(activator != NULL);
|
||||
|
|
@ -5842,7 +5850,7 @@ static void P_CheckMobjPolyobjAction(mobj_t *mo, boolean continuous)
|
|||
}
|
||||
}
|
||||
|
||||
static void P_CheckMobjSectorAction(mobj_t *mo, sector_t *sec, boolean continuous)
|
||||
static void P_CheckMobjSectorAction(mobj_t *mo, sector_t *sec, boolean continuous, boolean sectorchanged)
|
||||
{
|
||||
activator_t *activator = NULL;
|
||||
boolean result = false;
|
||||
|
|
@ -5879,6 +5887,10 @@ static void P_CheckMobjSectorAction(mobj_t *mo, sector_t *sec, boolean continuou
|
|||
return;
|
||||
}
|
||||
}
|
||||
else if (sectorchanged == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
activator = Z_Calloc(sizeof(activator_t), PU_LEVEL, NULL);
|
||||
I_Assert(activator != NULL);
|
||||
|
|
@ -5897,7 +5909,7 @@ static void P_CheckMobjSectorAction(mobj_t *mo, sector_t *sec, boolean continuou
|
|||
}
|
||||
}
|
||||
|
||||
void P_CheckMobjTouchingSectorActions(mobj_t *mobj, boolean continuous)
|
||||
void P_CheckMobjTouchingSectorActions(mobj_t *mobj, boolean continuous, boolean sectorchanged)
|
||||
{
|
||||
sector_t *originalsector;
|
||||
|
||||
|
|
@ -5923,13 +5935,13 @@ void P_CheckMobjTouchingSectorActions(mobj_t *mobj, boolean continuous)
|
|||
}
|
||||
}
|
||||
|
||||
P_CheckMobj3DFloorAction(mobj, originalsector, continuous);
|
||||
P_CheckMobj3DFloorAction(mobj, originalsector, continuous, sectorchanged);
|
||||
if TELEPORTED(mobj) return;
|
||||
|
||||
P_CheckMobjPolyobjAction(mobj, continuous);
|
||||
P_CheckMobjPolyobjAction(mobj, continuous, sectorchanged);
|
||||
if TELEPORTED(mobj) return;
|
||||
|
||||
P_CheckMobjSectorAction(mobj, originalsector, continuous);
|
||||
P_CheckMobjSectorAction(mobj, originalsector, continuous, sectorchanged);
|
||||
}
|
||||
|
||||
#undef TELEPORTED
|
||||
|
|
@ -9552,3 +9564,21 @@ void P_FreeQuake(quake_t *remove)
|
|||
|
||||
Z_Free(remove);
|
||||
}
|
||||
|
||||
void P_CheckSectorTransitionalEffects(mobj_t *thing, sector_t *prevsec, boolean wasgrounded)
|
||||
{
|
||||
if (!udmf)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
boolean sectorchanged = (prevsec != thing->subsector->sector);
|
||||
|
||||
if (!sectorchanged && wasgrounded == P_IsObjectOnGround(thing))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for each time / once sector special actions
|
||||
P_CheckMobjTouchingSectorActions(thing, false, sectorchanged);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -587,11 +587,12 @@ sector_t *P_PlayerTouchingSectorSpecial(player_t *player, INT32 section, INT32 n
|
|||
sector_t *P_PlayerTouchingSectorSpecialFlag(player_t *player, sectorspecialflags_t flag);
|
||||
void P_PlayerInSpecialSector(player_t *player);
|
||||
void P_CheckMobjTrigger(mobj_t *mobj, boolean pushable);
|
||||
void P_CheckMobjTouchingSectorActions(mobj_t *mobj, boolean continuous);
|
||||
void P_CheckMobjTouchingSectorActions(mobj_t *mobj, boolean continuous, boolean sectorchanged);
|
||||
sector_t *P_FindPlayerTrigger(player_t *player, line_t *sourceline);
|
||||
boolean P_IsPlayerValid(size_t playernum);
|
||||
boolean P_CanPlayerTrigger(size_t playernum);
|
||||
void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *roversector);
|
||||
void P_CheckSectorTransitionalEffects(mobj_t *thing, sector_t *prevsec, boolean wasgrounded);
|
||||
|
||||
fixed_t P_FindLowestFloorSurrounding(sector_t *sec);
|
||||
fixed_t P_FindHighestFloorSurrounding(sector_t *sec);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue