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
This commit is contained in:
toaster 2023-01-21 22:16:50 +00:00
parent 8a771521c2
commit ceed74d052
6 changed files with 37 additions and 9 deletions

View file

@ -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},

View file

@ -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)
{

View file

@ -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

View file

@ -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;

View file

@ -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;
}

View file

@ -411,6 +411,7 @@ typedef enum
SD_LAVA = 2,
SD_DEATHPIT = 3,
SD_INSTAKILL = 4,
SD_STUMBLE = 5,
} sectordamage_t;
typedef enum