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:
Edward Richardson 2014-03-15 04:15:30 +13:00
parent 55362d2296
commit 40771d22a5

View file

@ -914,6 +914,8 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
} }
} }
if (tm.thing->player == NULL || !(tm.thing->player->cheats & CF_PREDICTING))
{
// touchy object is alive, toucher is solid // touchy object is alive, toucher is solid
if (thing->flags6 & MF6_TOUCHY && tm.thing->flags & MF_SOLID && thing->health > 0 && if (thing->flags6 & MF6_TOUCHY && tm.thing->flags & MF_SOLID && thing->health > 0 &&
// Thing is an armed mine or a sentient thing // Thing is an armed mine or a sentient thing
@ -930,7 +932,7 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
// but different classes trigger the touchiness, but that seems less straightforwards. // but different classes trigger the touchiness, but that seems less straightforwards.
{ {
thing->flags6 &= ~MF6_ARMED; // Disarm thing->flags6 &= ~MF6_ARMED; // Disarm
P_DamageMobj (thing, NULL, NULL, thing->health, NAME_None, DMG_FORCED); // kill object P_DamageMobj(thing, NULL, NULL, thing->health, NAME_None, DMG_FORCED); // kill object
return true; return true;
} }
@ -940,8 +942,6 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
|| ((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)
{ {