K_KartGetItemOdds: apply GTR_CIRCUIT checks

- No restriction on whether more than one player may
receive the same type of shield outside of Race.
- SPB is now technically allowed outside of Race, if item
odds permit.
- powerItems and assorted checks no longer apply outside
of Race.
This commit is contained in:
James R 2023-01-03 04:44:49 -08:00
parent a37eccd708
commit 339cb1e8b8

View file

@ -434,6 +434,11 @@ static boolean K_DenyShieldOdds(kartitems_t item)
{ {
INT32 shieldType = K_GetShieldFromItem(item); INT32 shieldType = K_GetShieldFromItem(item);
if ((gametyperules & GTR_CIRCUIT) == 0)
{
return false;
}
switch (shieldType) switch (shieldType)
{ {
case KSHIELD_NONE: case KSHIELD_NONE:
@ -535,6 +540,12 @@ typedef struct {
--------------------------------------------------*/ --------------------------------------------------*/
static fixed_t K_AdjustItemOddsToConditions(fixed_t newOdds, const itemconditions_t *conditions, const itemroulette_t *roulette) static fixed_t K_AdjustItemOddsToConditions(fixed_t newOdds, const itemconditions_t *conditions, const itemroulette_t *roulette)
{ {
// None if this applies outside of Race modes (for now?)
if ((gametyperules & GTR_CIRCUIT) == 0)
{
return newOdds;
}
if ((conditions->cooldownOnStart == true) && (leveltime < (30*TICRATE) + starttime)) if ((conditions->cooldownOnStart == true) && (leveltime < (30*TICRATE) + starttime))
{ {
// This item should not appear at the beginning of a race. (Usually really powerful crowd-breaking items) // This item should not appear at the beginning of a race. (Usually really powerful crowd-breaking items)
@ -697,13 +708,8 @@ INT32 K_KartGetItemOdds(const player_t *player, itemroulette_t *const roulette,
conditions.cooldownOnStart = true; conditions.cooldownOnStart = true;
conditions.notNearEnd = true; conditions.notNearEnd = true;
if ((gametyperules & GTR_CIRCUIT) == 0) if ((gametyperules & GTR_CIRCUIT) &&
{ specialstageinfo.valid == false)
// Needs to be a race.
return 0;
}
if (specialstageinfo.valid == false)
{ {
newOdds = K_AdjustSPBOdds(roulette, position); newOdds = K_AdjustSPBOdds(roulette, position);
} }
@ -716,7 +722,8 @@ INT32 K_KartGetItemOdds(const player_t *player, itemroulette_t *const roulette,
conditions.powerItem = true; conditions.powerItem = true;
conditions.notNearEnd = true; conditions.notNearEnd = true;
if (roulette->playing - 1 <= roulette->exiting) if ((gametyperules & GTR_CIRCUIT) &&
roulette->playing - 1 <= roulette->exiting)
{ {
return 0; return 0;
} }
@ -728,7 +735,7 @@ INT32 K_KartGetItemOdds(const player_t *player, itemroulette_t *const roulette,
conditions.cooldownOnStart = true; conditions.cooldownOnStart = true;
conditions.powerItem = true; conditions.powerItem = true;
if (spbplace != -1) if ((gametyperules & GTR_CIRCUIT) && spbplace != -1)
{ {
return 0; return 0;
} }