WarpPad ThTick finished

This commit is contained in:
Niko 2023-04-26 18:23:58 -04:00
parent 3c8b7d6868
commit 4c1d9a83db
3 changed files with 77 additions and 14 deletions

View File

@ -5,6 +5,7 @@
void AH_WarpPad_ThTick(struct Thread* t)
{
int i;
int j;
int boolOpen;
struct GameTracker* gGT;
struct WarpPad* warppadObj;
@ -32,6 +33,11 @@ void AH_WarpPad_ThTick(struct Thread* t)
int rewardScale;
int rewardScale2;
int champID;
int champSlot;
char randKartSpawn[8];
boolOpen = 0;
gGT = sdata->gGT;
warppadObj = t->object;
@ -521,12 +527,62 @@ void AH_WarpPad_ThTick(struct Thread* t)
}
}
// === Get Game Mode ===
// Then determine spawn positions
LOAD_Robots1P(data.characterIDs[0]);
for(i = 0; i < 8; i++) sdata->kartSpawnOrderArray[i] = i;
// spawn P1 in the back
sdata->kartSpawnOrderArray[0] = 7;
// variable reuse, get track speed champion
champID = data.metaDataLEV[levelID].characterID_Champion;
// If Speed Champion is on the track (Crash-Pura)
// and is not the same characterID as Player 1
if(
(champID < 8) &&
(champID != data.characterIDs[0])
)
{
// set everyone to spawn in order
for(i = 1; i < 7; i++)
{
if(champID == data.characterIDs[i])
{
sdata->kartSpawnOrderArray[i] = 0;
champSlot = i;
}
else
sdata->kartSpawnOrderArray[i] = i;
}
sdata->kartSpawnOrderArray[7] = champSlot;
}
// Speed Champion is invalid
else
{
for(i = 1; i < 8; i++) randKartSpawn[i] = i;
for(i = 0; i < 7; i++)
{
rng1 = RngDeadCoed(&sdata->const_0x30215400);
rng2 = 7 - i;
rng2 = (rng1 & 0xfff) % rng2 + 1;
rng2 = (short)rng2;
sdata->kartSpawnOrderArray[randKartSpawn[rng2]] = (char)i;
while(rng2 < 7)
{
randKartSpawn[rng2] = randKartSpawn[rng2+1];
rng2++;
}
}
}
}
// Slide Col or Turbo Track

View File

@ -778,12 +778,14 @@ LAB_800ac860:
// &data.characterIDs[1]
psVar14 = &DAT_80086e86;
// loop through all character IDs except P1
// Make drivers spawn in their usual order,
// but P1 in the back, put speed champion first,
// and put Pura where the speed champion would've gone
// for iVar10 = 1; iVar10 < 8; iVar10++
do
{
// If [something] equals Character ID
// If Speed Champion equals Character ID
if (*(short *)(&DAT_80083a96 + (int)*(short *)(piVar19 + 0x1b) * 0x18) == *psVar14) {
*puVar12 = 0;
iVar7 = iVar10;
@ -812,6 +814,8 @@ LAB_800ac860:
// If "speed champion" is an invalid choice, just randomize
else
{
// i = 1; i < 8; i++
// arr[i] = i;
pbVar5 = abStack48 + 1;
iVar7 = 1;
do {
@ -820,28 +824,30 @@ LAB_800ac860:
pbVar5 = abStack48 + iVar7 + 1;
iVar7 = iVar10;
} while (iVar10 < 8);
// i = 0; i < 7; i++
iVar7 = 0;
do {
uVar8 = FUN_8006c684(&DAT_8008d668);
iVar10 = 7 - iVar7;
if (iVar10 == 0) {
trap(0x1c00);
}
if ((iVar10 == -1) && ((uVar8 & 0xfff) == 0x80000000)) {
trap(0x1800);
}
if (iVar10 == 0) trap(0x1c00);
if ((iVar10 == -1) && ((uVar8 & 0xfff) == 0x80000000)) trap(0x1800);
iVar10 = (int)(uVar8 & 0xfff) % iVar10 + 1;
iVar9 = iVar10 * 0x10000 >> 0x10;
// kartSpawnOrderArray
(&DAT_8008d69c)[abStack48[iVar9]] = (char)iVar7;
// another loop of 7
while (iVar9 < 7) {
sVar3 = (short)iVar10;
iVar10 = iVar10 + 1;
iVar9 = iVar10 * 0x10000 >> 0x10;
abStack48[(int)sVar3] = abStack48[(int)sVar3 + 1];
}
iVar7 = iVar7 + 1;
} while (iVar7 < 7);
}

View File

@ -99,7 +99,8 @@ struct MetaDataLEV
// 0x16
// Used in Aug14 prototype
short characterID_SpecialGhost;
// N Tropy calls it "Speed Champion"
short characterID_Champion;
};