Fixed teetering on TNT barrels

This commit is contained in:
MascaraSnake 2019-07-07 17:02:10 +02:00
parent c1f51094bf
commit 906103a184

View file

@ -589,6 +589,41 @@ static void P_SlapStick(mobj_t *fang, mobj_t *pole)
P_SetTarget(&pole->tracer, NULL); P_SetTarget(&pole->tracer, NULL);
} }
static void P_BarrelCollide(mobj_t *toucher, mobj_t *barrel)
{
if (toucher->momz < 0)
{
if (toucher->z + toucher->momz > barrel->z + barrel->height)
return;
}
else
{
if (toucher->z > barrel->z + barrel->height)
return;
}
if (toucher->momz > 0)
{
if (toucher->z + toucher->height + toucher->momz < barrel->z)
return;
}
else
{
if (toucher->z + toucher->height < barrel->z)
return;
}
if ((toucher->player->pflags & (PF_SPINNING|PF_GLIDING))
|| ((toucher->player->pflags & PF_JUMPED)
&& (!(toucher->player->pflags & PF_NOJUMPDAMAGE)
|| (toucher->player->charability == CA_TWINSPIN && toucher->player->panim == PA_ABILITY)))
|| (toucher->player->charability2 == CA2_MELEE && toucher->player->panim == PA_ABILITY2)
|| ((toucher->player->charflags & SF_STOMPDAMAGE || toucher->player->pflags & PF_BOUNCING)
&& (P_MobjFlip(toucher)*(toucher->z - (barrel->z + barrel->height/2)) > 0) && (P_MobjFlip(toucher)*toucher->momz < 0))
|| (((toucher->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (toucher->player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (toucher->player->pflags & PF_SHIELDABILITY)))
P_DamageMobj(barrel, toucher, toucher, 1, 0);
}
// //
// PIT_CheckThing // PIT_CheckThing
// //
@ -850,39 +885,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
} }
if (thing->type == MT_TNTBARREL && tmthing->player) if (thing->type == MT_TNTBARREL && tmthing->player)
{ P_BarrelCollide(tmthing, thing);
if (tmthing->momz < 0)
{
if (tmthing->z + tmthing->momz > thing->z + thing->height)
return true;
}
else
{
if (tmthing->z > thing->z + thing->height)
return true;
}
if (tmthing->momz > 0)
{
if (tmthing->z + tmthing->height + tmthing->momz < thing->z)
return true;
}
else
{
if (tmthing->z + tmthing->height < thing->z)
return true;
}
if ((tmthing->player->pflags & (PF_SPINNING | PF_GLIDING))
|| ((tmthing->player->pflags & PF_JUMPED)
&& (!(tmthing->player->pflags & PF_NOJUMPDAMAGE)
|| (tmthing->player->charability == CA_TWINSPIN && tmthing->player->panim == PA_ABILITY)))
|| (tmthing->player->charability2 == CA2_MELEE && tmthing->player->panim == PA_ABILITY2)
|| ((tmthing->player->charflags & SF_STOMPDAMAGE || tmthing->player->pflags & PF_BOUNCING)
&& (P_MobjFlip(tmthing)*(tmthing->z - (thing->z + thing->height / 2)) > 0) && (P_MobjFlip(tmthing)*tmthing->momz < 0))
|| (((tmthing->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (tmthing->player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (tmthing->player->pflags & PF_SHIELDABILITY)))
P_DamageMobj(thing, tmthing, tmthing, 1, 0);
}
if (thing->type == MT_VULTURE && tmthing->type == MT_VULTURE) if (thing->type == MT_VULTURE && tmthing->type == MT_VULTURE)
{ {