From fa2e54dd1333efeef2f54fcde1417088b0a06531 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 17 Oct 2023 23:21:47 +0100 Subject: [PATCH] UCRP_FAULTED - `Condition1 = Faulted Yes` - `FAULT during POSITION` - for example, combine with "& finish in 1st" - `Condition1 = Faulted No` - `don't FAULT during POSITION` --- src/d_player.h | 1 + src/deh_soc.c | 3 ++- src/k_respawn.c | 2 ++ src/m_cond.c | 5 +++++ src/m_cond.h | 1 + src/p_user.c | 6 +++--- 6 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 1416024be..84076df1b 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -410,6 +410,7 @@ struct roundconditions_t boolean touched_offroad; boolean touched_sneakerpanel; boolean debt_rings; + boolean faulted; // Basically the same, but it's a specific event where no is an easy default boolean tripwire_hyuu; diff --git a/src/deh_soc.c b/src/deh_soc.c index 909d7f7ba..1ff596b18 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -2977,7 +2977,8 @@ static void readcondition(UINT16 set, UINT32 id, char *word2) else if ((offset=0) || fastcmp(params[0], "FALLOFF") || (++offset && fastcmp(params[0], "TOUCHOFFROAD")) || (++offset && fastcmp(params[0], "TOUCHSNEAKERPANEL")) - || (++offset && fastcmp(params[0], "RINGDEBT"))) + || (++offset && fastcmp(params[0], "RINGDEBT")) + || (++offset && fastcmp(params[0], "FAULTED"))) { PARAMCHECK(1); ty = UCRP_FALLOFF + offset; diff --git a/src/k_respawn.c b/src/k_respawn.c index cec0f57df..128f0a198 100644 --- a/src/k_respawn.c +++ b/src/k_respawn.c @@ -111,6 +111,8 @@ void K_DoFault(player_t *player) player->pflags |= PF_FAULT; player->mo->renderflags |= RF_DONTDRAW; player->mo->flags |= MF_NOCLIPTHING; + + player->roundconditions.faulted = true; } } diff --git a/src/m_cond.c b/src/m_cond.c index 5afc304c5..e2be1e96b 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -1618,6 +1618,9 @@ boolean M_CheckCondition(condition_t *cn, player_t *player) return (!(gametyperules & GTR_SPHERES) && (cn->requirement == 1 || player->exiting || (player->pflags & PF_NOCONTEST)) && (player->roundconditions.debt_rings == (cn->requirement == 1))); + case UCRP_FAULTED: + return ((cn->requirement == 1 || player->laps >= 1) + && (player->roundconditions.faulted == (cn->requirement == 1))); case UCRP_TRIPWIREHYUU: return (player->roundconditions.tripwire_hyuu); @@ -2395,6 +2398,8 @@ static const char *M_GetConditionString(condition_t *cn) return (cn->requirement == 1) ? "touch a Sneaker Panel" : "don't touch any Sneaker Panels"; case UCRP_RINGDEBT: return (cn->requirement == 1) ? "go into Ring debt" : "don't go into Ring debt"; + case UCRP_FAULTED: + return (cn->requirement == 1) ? "FAULT during POSITION" : "don't FAULT during POSITION"; case UCRP_TRIPWIREHYUU: return "go through Tripwire after getting snared by Hyudoro"; diff --git a/src/m_cond.h b/src/m_cond.h index 1db82c79d..3fcda1761 100644 --- a/src/m_cond.h +++ b/src/m_cond.h @@ -119,6 +119,7 @@ typedef enum UCRP_TOUCHOFFROAD, // Touch offroad (or don't) UCRP_TOUCHSNEAKERPANEL, // Either touch sneaker panel (or don't) UCRP_RINGDEBT, // Go into debt (or don't) + UCRP_FAULTED, // FAULT UCRP_TRIPWIREHYUU, // Go through tripwire with Hyudoro UCRP_SPBNEUTER, // Kill an SPB with Lightning diff --git a/src/p_user.c b/src/p_user.c index 934614651..24631f520 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1920,11 +1920,11 @@ static void P_3dMovement(player_t *player) // Calculates player's speed based on distance-of-a-line formula player->speed = R_PointToDist2(0, 0, player->rmomx, player->rmomy); - const fixed_t topspeed = K_GetKartSpeed(player, false, true); + const fixed_t topspeedometer = K_GetKartSpeed(player, false, true); - if (player->speed > topspeed) + if (player->speed > topspeedometer) { - const fixed_t convSpeed = (player->speed * 100) / topspeed; + const fixed_t convSpeed = (player->speed * 100) / topspeedometer; if (convSpeed > player->roundconditions.maxspeed) {