From ceed74d0525e9dff97d3713075ec492bfea3af1c Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 21 Jan 2023 22:16:50 +0000 Subject: [PATCH] Stumble damagetype - DMG_STUMBLE in SOC, hardcode - Has sector type - UDMF: damagetype = "Stumble" - Binary: Sector type 9, section 1 - Can be chained even when invincible, unlike Tumble - Will never instinctively cause hitlag --- src/deh_tables.c | 1 + src/p_inter.c | 31 ++++++++++++++++++++++--------- src/p_local.h | 1 + src/p_setup.c | 8 ++++++++ src/p_spec.c | 4 ++++ src/r_defs.h | 1 + 6 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index 4761c96e7..fe736e1f6 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -6407,6 +6407,7 @@ struct int_const_s const INT_CONST[] = { {"DMG_STING",DMG_STING}, {"DMG_KARMA",DMG_KARMA}, {"DMG_VOLTAGE",DMG_VOLTAGE}, + {"DMG_STUMBLE",DMG_STUMBLE}, //// Death types {"DMG_INSTAKILL",DMG_INSTAKILL}, {"DMG_DEATHPIT",DMG_DEATHPIT}, diff --git a/src/p_inter.c b/src/p_inter.c index f00a5f070..97675cd89 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2145,7 +2145,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da if (player->invincibilitytimer > 0) { - sfx= sfx_invind; + sfx = sfx_invind; } else if (K_IsBigger(target, inflictor) == true) { @@ -2158,7 +2158,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da invincible = false; } - if (invincible) + if (invincible && type != DMG_STUMBLE) { const INT32 oldhitlag = target->hitlag; @@ -2179,18 +2179,24 @@ 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)); + boolean allowcombo = ((hardhit || (type == DMG_STUMBLE)) == !(damagetype & DMG_WOMBO)); - // Tumble is a special case. + // Tumble/stumble 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; } + else if (type == DMG_STUMBLE) + { + // don't allow constant combo + if (player->tumbleBounces == TUMBLEBOUNCES-1 && (P_MobjFlip(target)*target->momz > 0)) + allowcombo = false; + } // DMG_EXPLODE excluded from flashtic checks to prevent dodging eggbox/SPB with weak spinout - if ((target->hitlag == 0 || allowcombo == false) && player->flashing > 0 && type != DMG_EXPLODE) + if ((target->hitlag == 0 || allowcombo == false) && player->flashing > 0 && type != DMG_EXPLODE && type != DMG_STUMBLE) { // Post-hit invincibility K_DoInstashield(player); @@ -2200,7 +2206,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da } // We successfully damaged them! Give 'em some bumpers! - if (type != DMG_STING) + if (type != DMG_STING && type != DMG_STUMBLE) { UINT8 takeBumpers = 1; @@ -2306,6 +2312,10 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da K_KartPainEnergyFling(player); ringburst = 0; break; + case DMG_STUMBLE: + K_StumblePlayer(player); + ringburst = 0; + break; case DMG_TUMBLE: K_TumblePlayer(player, inflictor, source); ringburst = 10; @@ -2327,7 +2337,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da break; } - if (type != DMG_STING) + if (type != DMG_STING && type != DMG_STUMBLE) { player->flashing = K_GetKartFlashing(player); } @@ -2350,8 +2360,11 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da K_DropHnextList(player, false); } - player->instashield = 15; - K_SetHitLagForObjects(target, inflictor, laglength, true); + if (type != DMG_STUMBLE) + { + player->instashield = 15; + K_SetHitLagForObjects(target, inflictor, laglength, true); + } if (inflictor && !P_MobjWasRemoved(inflictor) && inflictor->type == MT_BANANA) { diff --git a/src/p_local.h b/src/p_local.h index d41aa2670..0fa3274d8 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -528,6 +528,7 @@ struct BasicFF_t #define DMG_STING 0x04 #define DMG_KARMA 0x05 // Karma Bomb explosion -- works like DMG_EXPLODE, but steals half of their bumpers & deletes the rest #define DMG_VOLTAGE 0x06 +#define DMG_STUMBLE 0x07 //// Death types - cannot be combined with damage types #define DMG_INSTAKILL 0x80 #define DMG_DEATHPIT 0x81 diff --git a/src/p_setup.c b/src/p_setup.c index 1f989c7a3..e304a409c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1528,6 +1528,8 @@ static void ParseTextmapSectorParameter(UINT32 i, const char *param, const char sectors[i].damagetype = SD_DEATHPIT; if (fastcmp(val, "Instakill")) sectors[i].damagetype = SD_INSTAKILL; + if (fastcmp(val, "Stumble")) + sectors[i].damagetype = SD_STUMBLE; } else if (fastcmp(param, "action")) sectors[i].action = atol(val); @@ -2441,6 +2443,9 @@ static void P_WriteTextmap(void) case SD_INSTAKILL: fprintf(f, "damagetype = \"Instakill\";\n"); break; + case SD_STUMBLE: + fprintf(f, "damagetype = \"Stumble\";\n"); + break; default: break; } @@ -6011,6 +6016,9 @@ static void P_ConvertBinarySectorTypes(void) case 8: //Instakill sectors[i].damagetype = SD_INSTAKILL; break; + case 9: // Stumble + sectors[i].damagetype = SD_STUMBLE; + break; case 12: //Wall sector sectors[i].specialflags |= SSF_NOSTEPUP; break; diff --git a/src/p_spec.c b/src/p_spec.c index 2d08abfce..6f955fa1d 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -5145,6 +5145,10 @@ static void P_EvaluateDamageType(player_t *player, sector_t *sector, boolean isT case SD_INSTAKILL: P_DamageMobj(player->mo, NULL, NULL, 1, DMG_INSTAKILL); break; + case SD_STUMBLE: + if (isTouching) + P_DamageMobj(player->mo, NULL, NULL, 1, DMG_STUMBLE); + break; default: break; } diff --git a/src/r_defs.h b/src/r_defs.h index 84b4e4993..d4606c8ad 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -411,6 +411,7 @@ typedef enum SD_LAVA = 2, SD_DEATHPIT = 3, SD_INSTAKILL = 4, + SD_STUMBLE = 5, } sectordamage_t; typedef enum