Merge branch 'sting-frustrations' into 'master'

More lenient Ring Sting

See merge request kart-krew-dev/ring-racers-internal!2795
This commit is contained in:
Gunla 2025-09-04 04:15:05 +00:00
commit f40138b41d
4 changed files with 41 additions and 6 deletions

View file

@ -150,6 +150,8 @@ typedef enum
PF2_FASTTUMBLEBOUNCE = 1<<9, // Don't lose speed when tumblebouncing.
PF2_SERVERTEMPMUTE = 1<<10, // Haven't met gamestochat requirement
PF2_SAMEFRAMESTUNG = 1<<11, // Goofy bullshit for tracking mutual ring sting
PF2_UNSTINGABLE = 1<<12, // Was bumped out of spindash
} pflags2_t;
typedef enum

View file

@ -1180,7 +1180,6 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2)
return false;
}
boolean guard1 = K_PlayerGuard(t1->player);
boolean guard2 = K_PlayerGuard(t2->player);
@ -1310,11 +1309,30 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2)
return false;
}
boolean damagedpresting = (t2->player->flashing || P_PlayerInPain(t2->player));
// CONS_Printf("T1=%s T2=%s\n", player_names[t1->player - players], player_names[t2->player - players]);
// CONS_Printf("DPS=%d\n", damagedpresting);
if (P_PlayerInPain(t1->player) || t1->player->flashing)
{
// CONS_Printf("T1 pain\n");
if (!(t1->player->pflags2 & PF2_SAMEFRAMESTUNG))
return false;
// CONS_Printf("...but ignored\n");
}
bool stung = false;
if (t2->player->rings <= 0 && t2->health == 1) // no bumpers
if (RINGTOTAL(t2->player) <= 0 && t2->health == 1 && !(t2->player->pflags2 & PF2_UNSTINGABLE))
{
P_DamageMobj(t2, t1, t1, 1, DMG_STING|DMG_WOMBO);
// CONS_Printf("T2 stung\n");
if (!damagedpresting)
{
t2->player->pflags2 |= PF2_SAMEFRAMESTUNG;
// CONS_Printf("T2 SFS\n");
}
stung = true;
}
@ -1329,11 +1347,19 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2)
t1->eflags &= ~MFE_DAMAGEHITLAG;
};
// Looks bad, but "forEither" actually runs if t1 XOR t2 were damaged.
// I don't even think we use the touchdamage return value but I'm too
// afraid to change it now. Fix this if you're the next guy and annoyed
if (forEither(doSting, removeDamageHitlag))
{
t1->player->pflags2 &= ~PF2_SAMEFRAMESTUNG;
t2->player->pflags2 &= ~PF2_SAMEFRAMESTUNG;
return true;
}
t1->player->pflags2 &= ~PF2_SAMEFRAMESTUNG;
t2->player->pflags2 &= ~PF2_SAMEFRAMESTUNG;
return false;
}

View file

@ -488,6 +488,8 @@ std::optional<TargetTracking::Tooltip> object_tooltip(const mobj_t* mobj)
boolean hitwarning = stplyr->flashing && stplyr->rings <= 0 && stplyr->speed < K_GetKartSpeed(stplyr, false, false)/2
&& P_IsObjectOnGround(mobj) && !P_PlayerInPain(stplyr);
boolean whipping = stplyr->whip && !P_MobjWasRemoved(stplyr->whip);
boolean hasboost = (stplyr->itemamount &&
(
stplyr->itemtype == KITEM_SNEAKER || stplyr->itemtype == KITEM_INVINCIBILITY || stplyr->itemtype == KITEM_ROCKETSNEAKER
@ -495,7 +497,7 @@ std::optional<TargetTracking::Tooltip> object_tooltip(const mobj_t* mobj)
)
) || stplyr->rocketsneakertimer;
if (mobj->player == stplyr && (offroadwarning || hitwarning))
if (mobj->player == stplyr && (offroadwarning || hitwarning) && !mobj->hitlag && !whipping)
{
if (offroadwarning)
{

View file

@ -967,6 +967,7 @@ void K_PlayerJustBumped(player_t *player)
player->justbumped = bumptime;
player->noEbrakeMagnet = ebraketime;
player->spindash = 0;
// If spinouttimer is not set yet but could be set later,
@ -3154,10 +3155,9 @@ fixed_t K_PlayerTripwireSpeedThreshold(const player_t *player)
if ((gametyperules & GTR_CIRCUIT) && !K_Cooperative() && M_NotFreePlay() && !modeattacking)
{
required_speed += FixedMul(required_speed, K_PlayerScamPercentage(player, 2)); // Proration: Players near 1st need more speed!
required_speed += FixedMul(required_speed, K_PlayerScamPercentage(player, 2)); // Proration: Players near 1st need more speed!
}
if (player->offroad && K_ApplyOffroad(player))
{
// Increase to 300% if you're lawnmowering.
@ -9848,9 +9848,14 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
K_SpawnGrowShrinkParticles(player->mo, player->growshrinktimer);
}
if (player->spindash)
player->pflags2 |= PF2_UNSTINGABLE;
else
player->pflags2 &= ~PF2_UNSTINGABLE;
// Race: spawn ring debt indicator
// Battle: spawn zero-bumpers indicator
if ((gametyperules & GTR_SPHERES) ? player->mo->health <= 1 : player->rings <= 0)
if (!(player->pflags2 & PF2_UNSTINGABLE) && ((gametyperules & GTR_SPHERES) ? player->mo->health <= 1 : RINGTOTAL(player) <= 0))
{
UINT8 doubler;