mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
K_GetTotallyRandomResult: use NULL roulette data
This fixes random paper items spawner RNG not advancing.
This commit is contained in:
parent
339cb1e8b8
commit
ae16f124db
2 changed files with 14 additions and 10 deletions
|
|
@ -6219,19 +6219,18 @@ void K_DropHnextList(player_t *player, boolean keepshields)
|
|||
|
||||
SINT8 K_GetTotallyRandomResult(UINT8 useodds)
|
||||
{
|
||||
itemroulette_t rouletteData = {0};
|
||||
INT32 spawnchance[NUMKARTRESULTS];
|
||||
INT32 totalspawnchance = 0;
|
||||
INT32 i;
|
||||
|
||||
memset(spawnchance, 0, sizeof (spawnchance));
|
||||
|
||||
K_FillItemRouletteData(NULL, &rouletteData);
|
||||
|
||||
for (i = 1; i < NUMKARTRESULTS; i++)
|
||||
{
|
||||
// Avoid calling K_FillItemRouletteData since that
|
||||
// function resets PR_ITEM_ROULETTE.
|
||||
spawnchance[i] = (
|
||||
totalspawnchance += K_KartGetItemOdds(NULL, &rouletteData, useodds, i)
|
||||
totalspawnchance += K_KartGetItemOdds(NULL, NULL, useodds, i)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -489,6 +489,8 @@ static boolean K_DenyShieldOdds(kartitems_t item)
|
|||
--------------------------------------------------*/
|
||||
static fixed_t K_AdjustSPBOdds(const itemroulette_t *roulette, UINT8 position)
|
||||
{
|
||||
I_Assert(roulette != NULL);
|
||||
|
||||
if (roulette->firstDist < ENDDIST*2 // No SPB when 1st is almost done
|
||||
|| position == 1) // No SPB for 1st ever
|
||||
{
|
||||
|
|
@ -551,7 +553,7 @@ static fixed_t K_AdjustItemOddsToConditions(fixed_t newOdds, const itemcondition
|
|||
// This item should not appear at the beginning of a race. (Usually really powerful crowd-breaking items)
|
||||
newOdds = 0;
|
||||
}
|
||||
else if ((conditions->notNearEnd == true) && (roulette->baseDist < ENDDIST))
|
||||
else if ((conditions->notNearEnd == true) && (roulette != NULL && roulette->baseDist < ENDDIST))
|
||||
{
|
||||
// This item should not appear at the end of a race. (Usually trap items that lose their effectiveness)
|
||||
newOdds = 0;
|
||||
|
|
@ -571,8 +573,11 @@ static fixed_t K_AdjustItemOddsToConditions(fixed_t newOdds, const itemcondition
|
|||
newOdds *= 2;
|
||||
}
|
||||
|
||||
if (roulette != NULL)
|
||||
{
|
||||
newOdds = FixedMul(newOdds, FRACUNIT + K_ItemOddsScale(roulette->playing));
|
||||
}
|
||||
}
|
||||
|
||||
return newOdds;
|
||||
}
|
||||
|
|
@ -596,8 +601,6 @@ INT32 K_KartGetItemOdds(const player_t *player, itemroulette_t *const roulette,
|
|||
|
||||
fixed_t newOdds = 0;
|
||||
|
||||
I_Assert(roulette != NULL);
|
||||
|
||||
I_Assert(item > KITEM_NONE); // too many off by one scenarioes.
|
||||
I_Assert(item < NUMKARTRESULTS);
|
||||
|
||||
|
|
@ -708,7 +711,8 @@ INT32 K_KartGetItemOdds(const player_t *player, itemroulette_t *const roulette,
|
|||
conditions.cooldownOnStart = true;
|
||||
conditions.notNearEnd = true;
|
||||
|
||||
if ((gametyperules & GTR_CIRCUIT) &&
|
||||
if (roulette != NULL &&
|
||||
(gametyperules & GTR_CIRCUIT) &&
|
||||
specialstageinfo.valid == false)
|
||||
{
|
||||
newOdds = K_AdjustSPBOdds(roulette, position);
|
||||
|
|
@ -722,7 +726,8 @@ INT32 K_KartGetItemOdds(const player_t *player, itemroulette_t *const roulette,
|
|||
conditions.powerItem = true;
|
||||
conditions.notNearEnd = true;
|
||||
|
||||
if ((gametyperules & GTR_CIRCUIT) &&
|
||||
if (roulette != NULL &&
|
||||
(gametyperules & GTR_CIRCUIT) &&
|
||||
roulette->playing - 1 <= roulette->exiting)
|
||||
{
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue