mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-01 08:31:14 +00:00
Player prediction fixes in PIT_CheckThing
Player prediction could end up executing functions for TOUCHY things or modify velocities when BLASTED, among other things.
This commit is contained in:
parent
55362d2296
commit
40771d22a5
1 changed files with 38 additions and 28 deletions
|
@ -914,34 +914,34 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// touchy object is alive, toucher is solid
|
if (tm.thing->player == NULL || !(tm.thing->player->cheats & CF_PREDICTING))
|
||||||
if (thing->flags6 & MF6_TOUCHY && tm.thing->flags & MF_SOLID && thing->health > 0 &&
|
|
||||||
// Thing is an armed mine or a sentient thing
|
|
||||||
(thing->flags6 & MF6_ARMED || thing->IsSentient()) &&
|
|
||||||
// either different classes or players
|
|
||||||
(thing->player || thing->GetClass() != tm.thing->GetClass()) &&
|
|
||||||
// or different species if DONTHARMSPECIES
|
|
||||||
(!(thing->flags6 & MF6_DONTHARMSPECIES) || thing->GetSpecies() != tm.thing->GetSpecies()) &&
|
|
||||||
// touches vertically
|
|
||||||
thing->z + thing->height >= tm.thing->z && tm.thing->z + tm.thing->height >= thing->z &&
|
|
||||||
// prevents lost souls from exploding when fired by pain elementals
|
|
||||||
(thing->master != tm.thing && tm.thing->master != thing))
|
|
||||||
// Difference with MBF: MBF hardcodes the LS/PE check and lets actors of the same species
|
|
||||||
// but different classes trigger the touchiness, but that seems less straightforwards.
|
|
||||||
{
|
{
|
||||||
thing->flags6 &= ~MF6_ARMED; // Disarm
|
// touchy object is alive, toucher is solid
|
||||||
P_DamageMobj (thing, NULL, NULL, thing->health, NAME_None, DMG_FORCED); // kill object
|
if (thing->flags6 & MF6_TOUCHY && tm.thing->flags & MF_SOLID && thing->health > 0 &&
|
||||||
return true;
|
// Thing is an armed mine or a sentient thing
|
||||||
}
|
(thing->flags6 & MF6_ARMED || thing->IsSentient()) &&
|
||||||
|
// either different classes or players
|
||||||
|
(thing->player || thing->GetClass() != tm.thing->GetClass()) &&
|
||||||
|
// or different species if DONTHARMSPECIES
|
||||||
|
(!(thing->flags6 & MF6_DONTHARMSPECIES) || thing->GetSpecies() != tm.thing->GetSpecies()) &&
|
||||||
|
// touches vertically
|
||||||
|
thing->z + thing->height >= tm.thing->z && tm.thing->z + tm.thing->height >= thing->z &&
|
||||||
|
// prevents lost souls from exploding when fired by pain elementals
|
||||||
|
(thing->master != tm.thing && tm.thing->master != thing))
|
||||||
|
// Difference with MBF: MBF hardcodes the LS/PE check and lets actors of the same species
|
||||||
|
// but different classes trigger the touchiness, but that seems less straightforwards.
|
||||||
|
{
|
||||||
|
thing->flags6 &= ~MF6_ARMED; // Disarm
|
||||||
|
P_DamageMobj(thing, NULL, NULL, thing->health, NAME_None, DMG_FORCED); // kill object
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Check for MF6_BUMPSPECIAL
|
// Check for MF6_BUMPSPECIAL
|
||||||
// By default, only players can activate things by bumping into them
|
// By default, only players can activate things by bumping into them
|
||||||
if ((thing->flags6 & MF6_BUMPSPECIAL) && ((tm.thing->player != NULL)
|
if ((thing->flags6 & MF6_BUMPSPECIAL) && ((tm.thing->player != NULL)
|
||||||
|| ((thing->activationtype & THINGSPEC_MonsterTrigger) && (tm.thing->flags3 & MF3_ISMONSTER))
|
|| ((thing->activationtype & THINGSPEC_MonsterTrigger) && (tm.thing->flags3 & MF3_ISMONSTER))
|
||||||
|| ((thing->activationtype & THINGSPEC_MissileTrigger) && (tm.thing->flags & MF_MISSILE))
|
|| ((thing->activationtype & THINGSPEC_MissileTrigger) && (tm.thing->flags & MF_MISSILE))
|
||||||
) && (level.maptime > thing->lastbump)) // Leave the bumper enough time to go away
|
) && (level.maptime > thing->lastbump)) // Leave the bumper enough time to go away
|
||||||
{
|
|
||||||
if (tm.thing->player == NULL || !(tm.thing->player->cheats & CF_PREDICTING))
|
|
||||||
{
|
{
|
||||||
if (P_ActivateThingSpecial(thing, tm.thing))
|
if (P_ActivateThingSpecial(thing, tm.thing))
|
||||||
thing->lastbump = level.maptime + TICRATE;
|
thing->lastbump = level.maptime + TICRATE;
|
||||||
|
@ -955,6 +955,17 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
|
||||||
tm.thing->BlockingMobj = NULL;
|
tm.thing->BlockingMobj = NULL;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [ED850] Player Prediction ends here. There is nothing else they could/should do.
|
||||||
|
if (tm.thing->player != NULL && (tm.thing->player->cheats & CF_PREDICTING))
|
||||||
|
{
|
||||||
|
solid = (thing->flags & MF_SOLID) &&
|
||||||
|
!(thing->flags & MF_NOCLIP) &&
|
||||||
|
((tm.thing->flags & MF_SOLID) || (tm.thing->flags6 & MF6_BLOCKEDBYSOLIDACTORS));
|
||||||
|
|
||||||
|
return !solid || unblocking;
|
||||||
|
}
|
||||||
|
|
||||||
// Check for blasted thing running into another
|
// Check for blasted thing running into another
|
||||||
if ((tm.thing->flags2 & MF2_BLASTED) && (thing->flags & MF_SHOOTABLE))
|
if ((tm.thing->flags2 & MF2_BLASTED) && (thing->flags & MF_SHOOTABLE))
|
||||||
{
|
{
|
||||||
|
@ -1203,8 +1214,7 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
|
||||||
}
|
}
|
||||||
return false; // don't traverse any more
|
return false; // don't traverse any more
|
||||||
}
|
}
|
||||||
if (thing->flags2 & MF2_PUSHABLE && !(tm.thing->flags2 & MF2_CANNOTPUSH) &&
|
if (thing->flags2 & MF2_PUSHABLE && !(tm.thing->flags2 & MF2_CANNOTPUSH))
|
||||||
(tm.thing->player == NULL || !(tm.thing->player->cheats & CF_PREDICTING)))
|
|
||||||
{ // Push thing
|
{ // Push thing
|
||||||
if (thing->lastpush != tm.PushTime)
|
if (thing->lastpush != tm.PushTime)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue