diff --git a/src/info.c b/src/info.c index a5292b2de..0bf0941ec 100644 --- a/src/info.c +++ b/src/info.c @@ -12198,7 +12198,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 0, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_ENEMY|MF_PUSHABLE, // flags + MF_SOLID|MF_SHOOTABLE|MF_PUSHABLE, // flags S_NULL // raisestate }, diff --git a/src/p_enemy.c b/src/p_enemy.c index 7804465ff..f2ea9f867 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -5343,20 +5343,28 @@ static mobj_t *minus; static boolean PIT_MinusCarry(mobj_t *thing) { + if (minus->tracer) + return true; + if (minus->type == thing->type) return true; - if (!(thing->flags & MF_SHOOTABLE) || !(thing->flags & MF_ENEMY)) + if (!(thing->flags & (MF_PUSHABLE|MF_ENEMY))) return true; - if (P_AproxDistance(minus->x - thing->x, minus->y - thing->y) >= minus->radius * 3) + if (P_AproxDistance(minus->x - thing->x, minus->y - thing->y) >= minus->radius*3) return true; if (abs(thing->z - minus->z) > minus->height) return true; P_SetTarget(&minus->tracer, thing); - minus->tracer->flags &= ~MF_PUSHABLE; + P_SetTarget(&thing->tracer, minus); + if (thing->flags & MF_PUSHABLE) + { + minus->flags2 |= MF2_STRONGBOX; + thing->flags &= ~MF_PUSHABLE; + } return true; } @@ -5442,7 +5450,15 @@ void A_MinusDigging(mobj_t *actor) if (P_TryMove(actor->tracer, actor->x, actor->y, false)) actor->tracer->z = mz; else + { + if (actor->flags2 & MF2_STRONGBOX) + { + actor->flags2 &= ~MF2_STRONGBOX; + actor->tracer->flags |= MF_PUSHABLE; + } + P_SetTarget(&actor->tracer->tracer, NULL); P_SetTarget(&actor->tracer, NULL); + } } } @@ -13455,6 +13471,13 @@ void A_TNTExplode(mobj_t *actor) if (LUA_CallAction("A_TNTExplode", actor)) return; #endif + + if (actor->tracer) + { + P_SetTarget(&actor->tracer->tracer, NULL); + P_SetTarget(&actor->tracer, NULL); + } + P_UnsetThingPosition(actor); if (sector_list) { @@ -13682,7 +13705,8 @@ static void P_SnapperLegPlace(mobj_t *mo) fixed_t rad = mo->radius; INT32 necklen = (32*(mo->info->reactiontime - mo->reactiontime))/mo->info->reactiontime; // Not in FU - P_TeleportMove(seg, mo->x + FixedMul(c, rad) + necklen*c, mo->y + FixedMul(s, rad) + necklen*s, mo->z + ((mo->eflags & MFE_VERTICALFLIP) ? (((mo->height<<1)/3) - seg->height) : mo->height/3)); + seg->z = mo->z + ((mo->eflags & MFE_VERTICALFLIP) ? (((mo->height<<1)/3) - seg->height) : mo->height/3); + P_TryMove(seg, mo->x + FixedMul(c, rad) + necklen*c, mo->y + FixedMul(s, rad) + necklen*s, true); seg->angle = a; // Move as many legs as available. @@ -13702,7 +13726,8 @@ static void P_SnapperLegPlace(mobj_t *mo) { x = c*o2 + s*o1; y = s*o2 - c*o1; - P_TeleportMove(seg, mo->x + x, mo->y + y, mo->z + (((mo->eflags & MFE_VERTICALFLIP) ? (mo->height - seg->height) : 0))); + seg->z = mo->z + (((mo->eflags & MFE_VERTICALFLIP) ? (mo->height - seg->height) : 0)); + P_TryMove(seg, mo->x + x, mo->y + y, true); P_SetMobjState(seg, seg->info->raisestate); } else diff --git a/src/p_inter.c b/src/p_inter.c index 3def80f51..3ece610e7 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2681,6 +2681,19 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget P_KillMobj(target->target, target, source, 0); break; + case MT_MINUS: + if (target->tracer) + { + if (target->flags2 & MF2_STRONGBOX) + { + target->flags2 &= ~MF2_STRONGBOX; + target->tracer->flags |= MF_PUSHABLE; + } + P_SetTarget(&target->tracer->tracer, NULL); + P_SetTarget(&target->tracer, NULL); + } + break; + case MT_PLAYER: { target->fuse = TICRATE*3; // timer before mobj disappears from view (even if not an actual player) diff --git a/src/p_map.c b/src/p_map.c index fbea6c271..161f5b14a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -604,6 +604,34 @@ static void P_SlapStick(mobj_t *fang, mobj_t *pole) P_SetTarget(&pole->tracer, NULL); } +static void P_PlayerBarrelCollide(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 (P_PlayerCanDamage(toucher->player, barrel)) + P_DamageMobj(barrel, toucher, toucher, 1, 0); +} + // // PIT_CheckThing // @@ -891,39 +919,7 @@ static boolean PIT_CheckThing(mobj_t *thing) } if (thing->type == MT_TNTBARREL && tmthing->player) - { - 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); - } + P_PlayerBarrelCollide(tmthing, thing); if (thing->type == MT_VULTURE && tmthing->type == MT_VULTURE) { diff --git a/src/p_mobj.c b/src/p_mobj.c index 5c4609f04..daa8cd9f2 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9915,6 +9915,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) } case MT_TNTBARREL: mobj->momx = 1; //stack hack + mobj->flags2 |= MF2_INVERTAIMABLE; break; case MT_MINECARTEND: P_SetTarget(&mobj->tracer, P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_MINECARTENDSOLID));