From eedff2dea99f9c0861cbb2a30fc446c76545fdcf Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 24 Sep 2022 16:13:44 -0400 Subject: [PATCH] Make Grow cause stumble --- src/k_collide.c | 41 ++++++++++++++++++++++++++++++++--------- src/k_kart.c | 2 +- src/k_kart.h | 1 + 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/k_collide.c b/src/k_collide.c index 9d582da59..f4caef1fb 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -862,23 +862,46 @@ boolean K_SMKIceBlockCollide(mobj_t *t1, mobj_t *t2) boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2) { - const boolean flameT1 = (t1->player->flamedash > 0 && t1->player->itemtype == KITEM_FLAMESHIELD); - const boolean flameT2 = (t2->player->flamedash > 0 && t2->player->itemtype == KITEM_FLAMESHIELD); - boolean t1Condition = false; boolean t2Condition = false; boolean stungT1 = false; boolean stungT2 = false; - t1Condition = (t1->scale > t2->scale + (mapobjectscale/8)) || (t1->player->invincibilitytimer > 0); - t2Condition = (t2->scale > t1->scale + (mapobjectscale/8)) || (t2->player->invincibilitytimer > 0); + // Clash instead of damage if both parties have any of these conditions + t1Condition = (t1->scale > t2->scale + (mapobjectscale/8)) + || (t1->player->invincibilitytimer > 0) + || (t1->player->flamedash > 0 && t1->player->itemtype == KITEM_FLAMESHIELD); - if ((t1Condition == true || flameT1 == true) && (t2Condition == true || flameT2 == true)) + t2Condition = (t2->scale > t1->scale + (mapobjectscale/8)) + || (t2->player->invincibilitytimer > 0) + || (t2->player->flamedash > 0 && t2->player->itemtype == KITEM_FLAMESHIELD); + + if (t1Condition == true && t2Condition == true) { K_DoPowerClash(t1->player, t2->player); return false; } - else if (t1Condition == true && t2Condition == false) + + // Cause stumble on scale difference + t1Condition = (t1->scale > t2->scale + (mapobjectscale/8)); + t2Condition = (t2->scale > t1->scale + (mapobjectscale/8)); + + if (t1Condition == true && t2Condition == false) + { + K_StumblePlayer(t2->player); + return true; + } + else if (t1Condition == false && t2Condition == true) + { + K_StumblePlayer(t1->player); + return true; + } + + // Cause tumble on invincibility + t1Condition = (t1->player->invincibilitytimer > 0); + t2Condition = (t2->player->invincibilitytimer > 0); + + if (t1Condition == true && t2Condition == false) { P_DamageMobj(t2, t1, t1, 1, DMG_TUMBLE); return true; @@ -890,8 +913,8 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2) } // Flame Shield dash damage - t1Condition = flameT1; - t2Condition = flameT2; + t1Condition = (t1->player->flamedash > 0 && t1->player->itemtype == KITEM_FLAMESHIELD); + t2Condition = (t2->player->flamedash > 0 && t2->player->itemtype == KITEM_FLAMESHIELD); if (t1Condition == true && t2Condition == false) { diff --git a/src/k_kart.c b/src/k_kart.c index 5d9faf36f..aa4187aa1 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4005,7 +4005,7 @@ angle_t K_StumbleSlope(angle_t angle, angle_t pitch, angle_t roll) return slope; } -static void K_StumblePlayer(player_t *player) +void K_StumblePlayer(player_t *player) { P_ResetPlayer(player); diff --git a/src/k_kart.h b/src/k_kart.h index a3f7dae0c..f1ae7ee05 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -86,6 +86,7 @@ void K_SpinPlayer(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 typ void K_TumblePlayer(player_t *player, mobj_t *inflictor, mobj_t *source); void K_TumbleInterrupt(player_t *player); angle_t K_StumbleSlope(angle_t angle, angle_t pitch, angle_t roll); +void K_StumblePlayer(player_t *player); boolean K_CheckStumble(player_t *player, angle_t oldPitch, angle_t oldRoll, boolean fromAir); void K_InitStumbleIndicator(player_t *player); void K_UpdateStumbleIndicator(player_t *player);