From 766fce58571368d18f2a7f5d5d9eed1d2d6b4024 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 3 Feb 2022 19:51:17 +0000 Subject: [PATCH 1/4] Make some adjustments to the damage combo system for players. * Prevent a player that is moving upwards from being DMG_TUMBLE'd again (resolves #212). * Instead of having a special case for missiles there, make PIT_CheckThing toggle DMG_WOMBO instead. * Allow hard hits (DMG_TUMBLE, DMG_EXPLODE, and DMG_KARMA) to have combos toggled off with DMG_WOMBO, too. --- src/p_inter.c | 27 +++++++++++---------------- src/p_map.c | 2 +- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 0b46bb3ad..890091ff6 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1868,10 +1868,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da if (player) // Player is the target { - const UINT8 type = (damagetype & DMG_TYPEMASK); - const boolean combo = (type == DMG_EXPLODE || type == DMG_KARMA || type == DMG_TUMBLE); // This damage type can be comboed from other damage - INT16 ringburst = 5; - if (player->pflags & PF_GODMODE) return false; @@ -1897,6 +1893,10 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da } else { + const UINT8 type = (damagetype & DMG_TYPEMASK); + const boolean hardhit = (type == DMG_EXPLODE || type == DMG_KARMA || type == DMG_TUMBLE); // This damage type can do evil stuff like ALWAYS combo + INT16 ringburst = 5; + // Check if the player is allowed to be damaged! // If not, then spawn the instashield effect instead. if (!force) @@ -1927,20 +1927,15 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da return false; } - if (combo == false) { - // Check if we should allow wombo combos (DMG_WOMBO) - boolean allowcombo = false; + // Check if we should allow wombo combos (hard hits by default, inverted by the presence of DMG_WOMBO). + boolean allowcombo = (hardhit == !(damagetype & DMG_WOMBO)); - // For MISSILE OBJECTS, allow combo BY DEFAULT. If DMG_WOMBO is set, do *NOT* allow it. - if (inflictor && !P_MobjWasRemoved(inflictor) && (inflictor->flags & MF_MISSILE) && !(damagetype & DMG_WOMBO)) - allowcombo = true; + // NEVER allow DMG_TUMBLE stacking if you're moving upwards (relative to gravity). + if ((type == DMG_TUMBLE) && (P_MobjFlip(target)*target->momz > 0)) + allowcombo = false; - // OTHERWISE, only allow combos IF DMG_WOMBO *IS* set. - else if (damagetype & DMG_WOMBO) - allowcombo = true; - - if ((player->mo->hitlag == 0 || allowcombo == false) && player->flashing > 0) + if ((target->hitlag == 0 || allowcombo == false) && player->flashing > 0) { // Post-hit invincibility K_DoInstashield(player); @@ -2064,7 +2059,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da K_PlayPainSound(player->mo); - if ((combo == true) || (cv_kartdebughuddrop.value && !modeattacking)) + if ((hardhit == true) || (cv_kartdebughuddrop.value && !modeattacking)) { K_DropItems(player); } diff --git a/src/p_map.c b/src/p_map.c index a3902b159..dee3b8c3c 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1046,7 +1046,7 @@ static boolean PIT_CheckThing(mobj_t *thing) // missiles can hit other things if (tmthing->flags & MF_MISSILE) { - UINT8 damagetype = tmthing->info->mass; + UINT8 damagetype = (tmthing->info->mass ^ DMG_WOMBO); // see if it went over / under if (tmthing->z > thing->z + thing->height) From ef7655d2e8015966b3f7d037138abfbafaebefc1 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 3 Feb 2022 19:51:58 +0000 Subject: [PATCH 2/4] Fix a tables error with DMG_STEAL in Lua/SOC resolving to the wrong flag value. --- src/deh_tables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index 6f9cb3d96..e0f60c3b1 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -6558,7 +6558,7 @@ struct int_const_s const INT_CONST[] = { {"DMG_SPECTATOR",DMG_SPECTATOR}, {"DMG_TIMEOVER",DMG_TIMEOVER}, //// Masks - {"DMG_STEAL",DMG_CANTHURTSELF}, + {"DMG_STEAL",DMG_STEAL}, {"DMG_CANTHURTSELF",DMG_CANTHURTSELF}, {"DMG_WOMBO", DMG_WOMBO}, {"DMG_DEATHMASK",DMG_DEATHMASK}, From c3e9eceda2add5aaaaba28a0509b941fd0de2515 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 8 Feb 2022 21:38:24 +0000 Subject: [PATCH 3/4] * Instead of checking for a player moving up, check for a player moving up that's only JUST been tumbled. * Remove the DMG_WOMBO flag from PVP touch damage tumbles as that was restricting tumble combos in this branch, not allowing it. --- src/k_collide.c | 8 ++++---- src/p_inter.c | 10 +++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/k_collide.c b/src/k_collide.c index 482b67fa3..2a4fc73f4 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -492,12 +492,12 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2) if (t1Condition == true && t2Condition == false) { - P_DamageMobj(t2, t1, t1, 1, DMG_TUMBLE|DMG_WOMBO); + P_DamageMobj(t2, t1, t1, 1, DMG_TUMBLE); return true; } else if (t1Condition == false && t2Condition == true) { - P_DamageMobj(t1, t2, t2, 1, DMG_TUMBLE|DMG_WOMBO); + P_DamageMobj(t1, t2, t2, 1, DMG_TUMBLE); return true; } @@ -507,12 +507,12 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2) if (t1Condition == true && t2Condition == false) { - P_DamageMobj(t2, t1, t1, 1, DMG_TUMBLE|DMG_WOMBO); + P_DamageMobj(t2, t1, t1, 1, DMG_TUMBLE); return true; } else if (t1Condition == false && t2Condition == true) { - P_DamageMobj(t1, t2, t2, 1, DMG_TUMBLE|DMG_WOMBO); + P_DamageMobj(t1, t2, t2, 1, DMG_TUMBLE); return true; } diff --git a/src/p_inter.c b/src/p_inter.c index 890091ff6..cada5b83e 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1931,9 +1931,13 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da // Check if we should allow wombo combos (hard hits by default, inverted by the presence of DMG_WOMBO). boolean allowcombo = (hardhit == !(damagetype & DMG_WOMBO)); - // NEVER allow DMG_TUMBLE stacking if you're moving upwards (relative to gravity). - if ((type == DMG_TUMBLE) && (P_MobjFlip(target)*target->momz > 0)) - allowcombo = false; + // Tumble is a special case. + if ((type == DMG_TUMBLE) + { + // don't allow constant combo + if (player->tumbleBounces == 1 && (P_MobjFlip(target)*target->momz > 0) + allowcombo = false; + } if ((target->hitlag == 0 || allowcombo == false) && player->flashing > 0) { From 8f4e8a4953c7468a6b1ba6ed9dec823feebb64ad Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 9 Feb 2022 23:43:06 +0000 Subject: [PATCH 4/4] can't believe i messed up the brackets this bad, woops --- src/p_inter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index cada5b83e..50614e610 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1932,10 +1932,10 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da boolean allowcombo = (hardhit == !(damagetype & DMG_WOMBO)); // Tumble is a special case. - if ((type == DMG_TUMBLE) + if (type == DMG_TUMBLE) { // don't allow constant combo - if (player->tumbleBounces == 1 && (P_MobjFlip(target)*target->momz > 0) + if (player->tumbleBounces == 1 && (P_MobjFlip(target)*target->momz > 0)) allowcombo = false; }