UCRP_FAULTED

- `Condition1 = Faulted Yes`
    - `FAULT during POSITION`
    - for example, combine with "& finish in 1st"
- `Condition1 = Faulted No`
    - `don't FAULT during POSITION`
This commit is contained in:
toaster 2023-10-17 23:21:47 +01:00
parent 90a65220b2
commit fa2e54dd13
6 changed files with 14 additions and 4 deletions

View file

@ -410,6 +410,7 @@ struct roundconditions_t
boolean touched_offroad; boolean touched_offroad;
boolean touched_sneakerpanel; boolean touched_sneakerpanel;
boolean debt_rings; boolean debt_rings;
boolean faulted;
// Basically the same, but it's a specific event where no is an easy default // Basically the same, but it's a specific event where no is an easy default
boolean tripwire_hyuu; boolean tripwire_hyuu;

View file

@ -2977,7 +2977,8 @@ static void readcondition(UINT16 set, UINT32 id, char *word2)
else if ((offset=0) || fastcmp(params[0], "FALLOFF") else if ((offset=0) || fastcmp(params[0], "FALLOFF")
|| (++offset && fastcmp(params[0], "TOUCHOFFROAD")) || (++offset && fastcmp(params[0], "TOUCHOFFROAD"))
|| (++offset && fastcmp(params[0], "TOUCHSNEAKERPANEL")) || (++offset && fastcmp(params[0], "TOUCHSNEAKERPANEL"))
|| (++offset && fastcmp(params[0], "RINGDEBT"))) || (++offset && fastcmp(params[0], "RINGDEBT"))
|| (++offset && fastcmp(params[0], "FAULTED")))
{ {
PARAMCHECK(1); PARAMCHECK(1);
ty = UCRP_FALLOFF + offset; ty = UCRP_FALLOFF + offset;

View file

@ -111,6 +111,8 @@ void K_DoFault(player_t *player)
player->pflags |= PF_FAULT; player->pflags |= PF_FAULT;
player->mo->renderflags |= RF_DONTDRAW; player->mo->renderflags |= RF_DONTDRAW;
player->mo->flags |= MF_NOCLIPTHING; player->mo->flags |= MF_NOCLIPTHING;
player->roundconditions.faulted = true;
} }
} }

View file

@ -1618,6 +1618,9 @@ boolean M_CheckCondition(condition_t *cn, player_t *player)
return (!(gametyperules & GTR_SPHERES) return (!(gametyperules & GTR_SPHERES)
&& (cn->requirement == 1 || player->exiting || (player->pflags & PF_NOCONTEST)) && (cn->requirement == 1 || player->exiting || (player->pflags & PF_NOCONTEST))
&& (player->roundconditions.debt_rings == (cn->requirement == 1))); && (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: case UCRP_TRIPWIREHYUU:
return (player->roundconditions.tripwire_hyuu); 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"; return (cn->requirement == 1) ? "touch a Sneaker Panel" : "don't touch any Sneaker Panels";
case UCRP_RINGDEBT: case UCRP_RINGDEBT:
return (cn->requirement == 1) ? "go into Ring debt" : "don't go into Ring debt"; 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: case UCRP_TRIPWIREHYUU:
return "go through Tripwire after getting snared by Hyudoro"; return "go through Tripwire after getting snared by Hyudoro";

View file

@ -119,6 +119,7 @@ typedef enum
UCRP_TOUCHOFFROAD, // Touch offroad (or don't) UCRP_TOUCHOFFROAD, // Touch offroad (or don't)
UCRP_TOUCHSNEAKERPANEL, // Either touch sneaker panel (or don't) UCRP_TOUCHSNEAKERPANEL, // Either touch sneaker panel (or don't)
UCRP_RINGDEBT, // Go into debt (or don't) UCRP_RINGDEBT, // Go into debt (or don't)
UCRP_FAULTED, // FAULT
UCRP_TRIPWIREHYUU, // Go through tripwire with Hyudoro UCRP_TRIPWIREHYUU, // Go through tripwire with Hyudoro
UCRP_SPBNEUTER, // Kill an SPB with Lightning UCRP_SPBNEUTER, // Kill an SPB with Lightning

View file

@ -1920,11 +1920,11 @@ static void P_3dMovement(player_t *player)
// Calculates player's speed based on distance-of-a-line formula // Calculates player's speed based on distance-of-a-line formula
player->speed = R_PointToDist2(0, 0, player->rmomx, player->rmomy); 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) if (convSpeed > player->roundconditions.maxspeed)
{ {