From c1f51094bfdf8d3eb0a093da1c7acb1ef9ec30f4 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 7 Jul 2019 12:06:45 +0200 Subject: [PATCH 1/6] TNT barrels are no longer enemies, but still aimable for Fang --- src/info.c | 2 +- src/p_mobj.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index 074e31ba2..ba57e6c04 100644 --- a/src/info.c +++ b/src/info.c @@ -11742,7 +11742,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_mobj.c b/src/p_mobj.c index 69550fa73..84a50b934 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9321,6 +9321,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: mobj->tracer = P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_MINECARTENDSOLID); From 906103a184eec3b986e6f2e2220d2d5357ba41b5 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 7 Jul 2019 17:02:10 +0200 Subject: [PATCH 2/6] Fixed teetering on TNT barrels --- src/p_map.c | 69 ++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 86fa68ad8..046bf14e1 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -589,6 +589,41 @@ static void P_SlapStick(mobj_t *fang, mobj_t *pole) 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 // @@ -850,39 +885,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_BarrelCollide(tmthing, thing); if (thing->type == MT_VULTURE && tmthing->type == MT_VULTURE) { From 1e5682d4a234780b680bea0ffcb698b6b70b46f4 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Wed, 10 Jul 2019 09:08:57 +0200 Subject: [PATCH 3/6] Used toaster's new P_PlayerCanDamage function for the barrel collision --- src/p_map.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 0c08e3de3..3ee9e59a2 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -604,7 +604,7 @@ static void P_SlapStick(mobj_t *fang, mobj_t *pole) P_SetTarget(&pole->tracer, NULL); } -static void P_BarrelCollide(mobj_t *toucher, mobj_t *barrel) +static void P_PlayerBarrelCollide(mobj_t *toucher, mobj_t *barrel) { if (toucher->momz < 0) { @@ -628,14 +628,7 @@ static void P_BarrelCollide(mobj_t *toucher, mobj_t *barrel) 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))) + if (P_PlayerCanDamage(toucher->player, barrel)) P_DamageMobj(barrel, toucher, toucher, 1, 0); } @@ -921,7 +914,7 @@ static boolean PIT_CheckThing(mobj_t *thing) } if (thing->type == MT_TNTBARREL && tmthing->player) - P_BarrelCollide(tmthing, thing); + P_PlayerBarrelCollide(tmthing, thing); if (thing->type == MT_VULTURE && tmthing->type == MT_VULTURE) { From 9809e15033a722ab4b34a7155de126949a4339c8 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 24 Aug 2019 11:29:08 +0200 Subject: [PATCH 4/6] Green Snapper: Use TryMove instead of TeleportMove for the head, so it doesn't snap up to higher floors. --- src/p_enemy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index f33ce6810..1dc265676 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13325,7 +13325,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->height/3); + P_TryMove(seg, mo->x + FixedMul(c, rad) + necklen*c, mo->y + FixedMul(s, rad) + necklen*s, true); + seg->z = mo->z + mo->height/3; seg->angle = a; // Move as many legs as available. From dbbb805e924c61b7858745c293d1dc407e41c9b3 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 24 Aug 2019 20:23:28 +0200 Subject: [PATCH 5/6] Green Snapper: Update Z position of legs during movement --- src/p_enemy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 1dc265676..f61f2a09b 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13325,8 +13325,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_TryMove(seg, mo->x + FixedMul(c, rad) + necklen*c, mo->y + FixedMul(s, rad) + necklen*s, true); seg->z = mo->z + 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. @@ -13346,6 +13346,7 @@ static void P_SnapperLegPlace(mobj_t *mo) { x = c*o2 + s*o1; y = s*o2 - c*o1; + seg->z = mo->z; P_TryMove(seg, x0 + x, y0 + y, true); P_SetMobjState(seg, seg->info->raisestate); } From e75dee77479646372040f755d5c06f320055c563 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Mon, 30 Sep 2019 20:35:47 +0200 Subject: [PATCH 6/6] Fix various minus carrying bugs --- src/p_enemy.c | 29 ++++++++++++++++++++++++++--- src/p_inter.c | 13 +++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index f61f2a09b..0343c8bf6 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -5177,20 +5177,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; } @@ -5276,7 +5284,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); + } } } @@ -13096,6 +13112,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) { diff --git a/src/p_inter.c b/src/p_inter.c index bdf88ff44..8b4629e2e 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2631,6 +2631,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)