mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Bot skin selection fixes
- The case where entries on the end of the `grabskins` list were invalid - Double ++ for botskinlistpos meant any successful skin-rival placement also guaranteed an Eggrobo (default skin)
This commit is contained in:
parent
99705faea6
commit
df467a4a32
1 changed files with 16 additions and 7 deletions
|
|
@ -133,7 +133,7 @@ void K_InitGrandPrixBots(void)
|
||||||
UINT8 competitors[MAXSPLITSCREENPLAYERS];
|
UINT8 competitors[MAXSPLITSCREENPLAYERS];
|
||||||
|
|
||||||
UINT8 usableskins;
|
UINT8 usableskins;
|
||||||
UINT8 grabskins[MAXSKINS];
|
UINT8 grabskins[MAXSKINS+1];
|
||||||
|
|
||||||
UINT8 botskinlist[MAXPLAYERS];
|
UINT8 botskinlist[MAXPLAYERS];
|
||||||
UINT8 botskinlistpos = 0;
|
UINT8 botskinlistpos = 0;
|
||||||
|
|
@ -149,6 +149,7 @@ void K_InitGrandPrixBots(void)
|
||||||
{
|
{
|
||||||
grabskins[usableskins] = usableskins;
|
grabskins[usableskins] = usableskins;
|
||||||
}
|
}
|
||||||
|
grabskins[usableskins] = MAXSKINS;
|
||||||
|
|
||||||
#if MAXPLAYERS != 16
|
#if MAXPLAYERS != 16
|
||||||
I_Error("GP bot difficulty levels need rebalanced for the new player count!\n");
|
I_Error("GP bot difficulty levels need rebalanced for the new player count!\n");
|
||||||
|
|
@ -221,7 +222,6 @@ void K_InitGrandPrixBots(void)
|
||||||
{
|
{
|
||||||
botskinlist[botskinlistpos++] = (UINT8)rivalnum;
|
botskinlist[botskinlistpos++] = (UINT8)rivalnum;
|
||||||
grabskins[(UINT8)rivalnum] = MAXSKINS;
|
grabskins[(UINT8)rivalnum] = MAXSKINS;
|
||||||
botskinlistpos++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -230,9 +230,14 @@ void K_InitGrandPrixBots(void)
|
||||||
// Rearrange usable bot skins list to prevent gaps for randomised selection
|
// Rearrange usable bot skins list to prevent gaps for randomised selection
|
||||||
for (i = 0; i < usableskins; i++)
|
for (i = 0; i < usableskins; i++)
|
||||||
{
|
{
|
||||||
if (grabskins[i] != MAXSKINS /*&& !K_SkinLocked(usableskins)*/)
|
if (!(grabskins[i] == MAXSKINS /*|| K_SkinLocked(grabskins[i])*/))
|
||||||
continue;
|
continue;
|
||||||
grabskins[i] = grabskins[--usableskins];
|
while (usableskins > i && (grabskins[usableskins] == MAXSKINS /*|| K_SkinLocked(grabskins[i])*/))
|
||||||
|
{
|
||||||
|
usableskins--;
|
||||||
|
}
|
||||||
|
grabskins[i] = grabskins[usableskins];
|
||||||
|
grabskins[usableskins] = MAXSKINS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pad the remaining list with random skins if we need to
|
// Pad the remaining list with random skins if we need to
|
||||||
|
|
@ -508,7 +513,7 @@ void K_RetireBots(void)
|
||||||
SINT8 newDifficulty;
|
SINT8 newDifficulty;
|
||||||
|
|
||||||
UINT8 usableskins;
|
UINT8 usableskins;
|
||||||
UINT8 grabskins[MAXSKINS];
|
UINT8 grabskins[MAXSKINS+1];
|
||||||
|
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
|
|
||||||
|
|
@ -523,6 +528,7 @@ void K_RetireBots(void)
|
||||||
{
|
{
|
||||||
grabskins[usableskins] = usableskins;
|
grabskins[usableskins] = usableskins;
|
||||||
}
|
}
|
||||||
|
grabskins[usableskins] = MAXSKINS;
|
||||||
|
|
||||||
// Exclude player skins
|
// Exclude player skins
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
|
|
@ -538,9 +544,12 @@ void K_RetireBots(void)
|
||||||
// Rearrange usable bot skins list to prevent gaps for randomised selection
|
// Rearrange usable bot skins list to prevent gaps for randomised selection
|
||||||
for (i = 0; i < usableskins; i++)
|
for (i = 0; i < usableskins; i++)
|
||||||
{
|
{
|
||||||
if (grabskins[i] != MAXSKINS /*&& !K_SkinLocked(usableskins)*/)
|
if (!(grabskins[i] == MAXSKINS /*|| K_SkinLocked(grabskins[i])*/))
|
||||||
continue;
|
continue;
|
||||||
grabskins[i] = grabskins[--usableskins];
|
while (usableskins > i && (grabskins[usableskins] == MAXSKINS /*|| K_SkinLocked(grabskins[i])*/))
|
||||||
|
usableskins--;
|
||||||
|
grabskins[i] = grabskins[usableskins];
|
||||||
|
grabskins[usableskins] = MAXSKINS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!grandprixinfo.gp) // Sure, let's let this happen all the time :)
|
if (!grandprixinfo.gp) // Sure, let's let this happen all the time :)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue