From eedff2dea99f9c0861cbb2a30fc446c76545fdcf Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 24 Sep 2022 16:13:44 -0400 Subject: [PATCH 1/7] 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); From 08b2c09fe121a4667ad442be4d1b68f4559665ef Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 24 Sep 2022 16:15:25 -0400 Subject: [PATCH 2/7] Swap them --- src/k_collide.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/k_collide.c b/src/k_collide.c index f4caef1fb..242130a18 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -882,21 +882,6 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2) return 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); @@ -912,6 +897,21 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2) return true; } + // 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; + } + // Flame Shield dash damage t1Condition = (t1->player->flamedash > 0 && t1->player->itemtype == KITEM_FLAMESHIELD); t2Condition = (t2->player->flamedash > 0 && t2->player->itemtype == KITEM_FLAMESHIELD); From c488fc79a5f6d33ac1c2422ddf3d87579d5259d4 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 24 Sep 2022 16:16:38 -0400 Subject: [PATCH 3/7] Swap them swap them --- src/k_collide.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/k_collide.c b/src/k_collide.c index 242130a18..95fe28983 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -897,21 +897,6 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2) return true; } - // 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; - } - // Flame Shield dash damage t1Condition = (t1->player->flamedash > 0 && t1->player->itemtype == KITEM_FLAMESHIELD); t2Condition = (t2->player->flamedash > 0 && t2->player->itemtype == KITEM_FLAMESHIELD); @@ -950,6 +935,21 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2) } } + // 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; + } + // Ring sting, this is a bit more unique t1Condition = (K_GetShieldFromItem(t2->player->itemtype) == KSHIELD_NONE); t2Condition = (K_GetShieldFromItem(t1->player->itemtype) == KSHIELD_NONE); From bd1faa3178b340f2589f26939f6abbfdf598c2db Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 24 Sep 2022 16:35:14 -0400 Subject: [PATCH 4/7] Use scale for all grow/shrink interactions --- src/k_collide.c | 6 +++--- src/k_kart.c | 13 ++++++++++++- src/p_inter.c | 4 ++-- src/p_map.c | 6 +++--- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/k_collide.c b/src/k_collide.c index 95fe28983..e0b3b2253 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -852,7 +852,7 @@ boolean K_SMKIceBlockCollide(mobj_t *t1, mobj_t *t2) /* if (t2->player && (t2->player->invincibilitytimer > 0 - || t2->player->growshrinktimer > 0)) + || K_IsBigger(t2, t1) == true)) return true; */ @@ -936,8 +936,8 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2) } // Cause stumble on scale difference - t1Condition = (t1->scale > t2->scale + (mapobjectscale/8)); - t2Condition = (t2->scale > t1->scale + (mapobjectscale/8)); + t1Condition = K_IsBigger(t1, t2); + t2Condition = K_IsBigger(t2, t1); if (t1Condition == true && t2Condition == false) { diff --git a/src/k_kart.c b/src/k_kart.c index aa4187aa1..63029dbc2 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1409,7 +1409,7 @@ fixed_t K_GetMobjWeight(mobj_t *mobj, mobj_t *against) case MT_FALLINGROCK: if (against->player) { - if (against->player->invincibilitytimer || against->player->growshrinktimer > 0) + if (against->player->invincibilitytimer || K_IsBigger(against, mobj) == true) weight = 0; else weight = K_PlayerWeight(against, NULL); @@ -3935,6 +3935,17 @@ void K_RemoveGrowShrink(player_t *player) P_RestoreMusic(player); } +boolean K_IsBigger(mobj_t *compare, mobj_t *other) +{ + if ((compare == NULL || P_MobjWasRemoved(compare) == true) + || (other == NULL || P_MobjWasRemoved(other) == true)) + { + return false; + } + + return (compare->scale > other->scale + (mapobjectscale/2)); +} + static fixed_t K_TumbleZ(mobj_t *mo, fixed_t input) { // Scales base tumble gravity to FRACUNIT diff --git a/src/p_inter.c b/src/p_inter.c index b11c269e0..4974338bb 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -387,7 +387,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // kill if (player->invincibilitytimer > 0 - || player->growshrinktimer > 0 + || K_IsBigger(toucher, special) == true || player->flamedash > 0) { P_KillMobj(special, toucher, toucher, DMG_NORMAL); @@ -1926,7 +1926,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da } } - if (player->invincibilitytimer > 0 || player->growshrinktimer > 0 || player->hyudorotimer > 0) + if (player->invincibilitytimer > 0 || K_IsBigger(target, inflictor) == true || player->hyudorotimer > 0) { // Full invulnerability K_DoInstashield(player); diff --git a/src/p_map.c b/src/p_map.c index 5b1827988..619f8698a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1368,7 +1368,7 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing) return BMIT_CONTINUE; // dead if (tmthing->player->invincibilitytimer > 0 - || tmthing->player->growshrinktimer > 0) + || K_IsBigger(tmthing, thing) == true) { if (thing->type == MT_BLUEROBRA_JOINT) P_KillMobj(thing->target, tmthing, tmthing, DMG_NORMAL); @@ -1394,7 +1394,7 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing) return BMIT_CONTINUE; // dead if (tmthing->player->invincibilitytimer > 0 - || tmthing->player->growshrinktimer > 0) + || K_IsBigger(tmthing, thing) == true) { P_KillMobj(thing, tmthing, tmthing, DMG_NORMAL); return BMIT_CONTINUE; // kill @@ -1425,7 +1425,7 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing) // kill if (tmthing->player->invincibilitytimer > 0 - || tmthing->player->growshrinktimer > 0) + || K_IsBigger(tmthing, thing) == true) { P_KillMobj(thing, tmthing, tmthing, DMG_NORMAL); return BMIT_CONTINUE; From ee7125ffdf5ba981d41d6c8868ee370df9ebc24b Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 24 Sep 2022 16:42:16 -0400 Subject: [PATCH 5/7] Fix missing function declaration --- src/k_kart.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/k_kart.h b/src/k_kart.h index f1ae7ee05..b120f0b6c 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -82,6 +82,7 @@ void K_DoInstashield(player_t *player); void K_DoPowerClash(player_t *t1, player_t *t2); void K_BattleAwardHit(player_t *player, player_t *victim, mobj_t *inflictor, UINT8 bumpersRemoved); void K_RemoveGrowShrink(player_t *player); +boolean K_IsBigger(mobj_t *compare, mobj_t *other); void K_SpinPlayer(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 type); void K_TumblePlayer(player_t *player, mobj_t *inflictor, mobj_t *source); void K_TumbleInterrupt(player_t *player); From a9634dde2fe72016fb9fce671d2a17c0b124f7cc Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 24 Sep 2022 19:51:41 -0400 Subject: [PATCH 6/7] Fix Shrink not receiving stumble --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 63029dbc2..ad93fdb75 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3943,7 +3943,7 @@ boolean K_IsBigger(mobj_t *compare, mobj_t *other) return false; } - return (compare->scale > other->scale + (mapobjectscale/2)); + return (compare->scale > other->scale + (mapobjectscale / 4)); } static fixed_t K_TumbleZ(mobj_t *mo, fixed_t input) From 4a743369e4992fc33bf27e9c32554b23d07994f9 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 24 Sep 2022 20:00:28 -0400 Subject: [PATCH 7/7] Use K_IsBigger for more remaining old scale checks --- src/k_botsearch.c | 4 ++-- src/k_collide.c | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/k_botsearch.c b/src/k_botsearch.c index 74a458bce..26fc9f73d 100644 --- a/src/k_botsearch.c +++ b/src/k_botsearch.c @@ -501,8 +501,8 @@ static BlockItReturn_t K_FindObjectsForNudging(mobj_t *thing) // There REALLY ought to be a better way to handle this logic, right?! // Squishing if (K_PlayerAttackSteer(thing, side, 20, - globalsmuggle.botmo->scale > thing->scale + (mapobjectscale/8), - thing->scale > globalsmuggle.botmo->scale + (mapobjectscale/8) + K_IsBigger(globalsmuggle.botmo, thing), + K_IsBigger(thing, globalsmuggle.botmo) )) { break; diff --git a/src/k_collide.c b/src/k_collide.c index e0b3b2253..a373af5c2 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -758,8 +758,10 @@ boolean K_BubbleShieldCollide(mobj_t *t1, mobj_t *t2) if (P_PlayerInPain(t2->player) || t2->player->flashing || t2->player->hyudorotimer - || t2->player->justbumped || t2->scale > t1->scale + (mapobjectscale/8)) + || t2->player->justbumped || K_IsBigger(t2, t1)) + { return true; + } // Player Damage P_DamageMobj(t2, ((t1->type == MT_BUBBLESHIELD) ? t1->target : t1), t1, 1, DMG_NORMAL|DMG_WOMBO); @@ -868,11 +870,11 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2) boolean stungT2 = false; // Clash instead of damage if both parties have any of these conditions - t1Condition = (t1->scale > t2->scale + (mapobjectscale/8)) + t1Condition = (K_IsBigger(t1, t2) == true) || (t1->player->invincibilitytimer > 0) || (t1->player->flamedash > 0 && t1->player->itemtype == KITEM_FLAMESHIELD); - t2Condition = (t2->scale > t1->scale + (mapobjectscale/8)) + t2Condition = (K_IsBigger(t2, t1) == true) || (t2->player->invincibilitytimer > 0) || (t2->player->flamedash > 0 && t2->player->itemtype == KITEM_FLAMESHIELD);