Add gPlayerIsAccelerating, gPlayerBalloonCount and update related code (#105)

* Add balloon count

* Add gPlayerIsThrottleActive
This commit is contained in:
Maciek Baron
2021-12-20 11:22:04 +00:00
committed by GitHub
parent 37d249c681
commit 7a0280f0e3
14 changed files with 110 additions and 108 deletions
+2 -2
View File
@@ -4683,7 +4683,7 @@ void func_80030C34(s32 arg0) {
temp_a0 = &D_80165460[phi_v0];
temp_v0 = &D_80165480[phi_v0];
if (*temp_a0 == 0) {
temp_v0_2 = &D_801653E0[phi_v0];
temp_v0_2 = &gPlayerIsThrottleActive[phi_v0];
if (*temp_v0_2 == 1) {
temp_a1 = &D_80165420[phi_v0];
temp_a2 = *temp_a1;
@@ -4775,7 +4775,7 @@ void func_80030E00(s32 arg0) {
temp_a0 = &D_80165460[phi_v0];
temp_v0 = &D_80165480[phi_v0];
if (*temp_a0 == 0) {
temp_v0_2 = &D_801653E0[phi_v0];
temp_v0_2 = &gPlayerIsThrottleActive[phi_v0];
temp_a1 = &D_80165420[phi_v0];
if (*temp_v0_2 == 0) {
temp_a2 = *temp_a1;
+31 -31
View File
@@ -17,7 +17,7 @@ extern Camera *camera4;
//GLOBAL_ASM("asm/non_matchings/code_800393C0/spawn_player.s")
void spawn_player(Player *player, s8 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, u16 arg6, s16 arg7) {
void spawn_player(Player *player, s8 playerIndex, f32 arg2, f32 arg3, f32 arg4, f32 arg5, u16 arg6, s16 arg7) {
f32 ret;
s8 idx;
@@ -61,7 +61,7 @@ void spawn_player(Player *player, s8 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg
player->rotX = arg2;
player->rotY = ret;
D_80164510[arg1] = ret;
D_80164510[playerIndex] = ret;
player->unk_02C = 0;
@@ -76,7 +76,7 @@ void spawn_player(Player *player, s8 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg
player->unk_030 = 0;
player->unk_0FA = 0;
player->unk_002 = 0;
player->unk_0BC = 0;
player->unk_0C0 = 0;
player->unk_07C = 0;
@@ -103,7 +103,7 @@ void spawn_player(Player *player, s8 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg
player->unk_00C = 0;
player->unk_0C6 = 0xFF;
player->unk_206 = 0;
player->unk_0C4 = 0;
player->unk_D98 = 0;
@@ -193,7 +193,7 @@ void spawn_player(Player *player, s8 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg
player->unk_230 = 0.0f;
player->unk_23C = 0.0f;
idx = arg1;
idx = playerIndex;
D_801650D0[0][idx] = 0;
D_801650D0[1][idx] = 0;
@@ -219,21 +219,21 @@ void spawn_player(Player *player, s8 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg
D_801654E0[idx] = 0;
D_80165500[idx] = 0;
D_80165520[idx] = 0;
D_80165540[arg1] = 0;
D_80165540[playerIndex] = 0;
D_8018D900 = 0;
D_801652E0[arg1] = 0;
D_801652C0[arg1] = 0;
D_80165020[arg1] = 0;
D_80165070[arg1][0] = 0.0f;
D_80165070[arg1][1] = 0.0f;
D_80165070[arg1][2] = 0.0f;
D_80165280[arg1] = 0.0f;
D_801652A0[arg1] = 0.0f;
D_801653E0[arg1] = 0;
D_80165400[arg1] = 0;
D_801654A0[arg1] = 0;
D_801654C0[arg1] = 0;
D_801652E0[playerIndex] = 0;
D_801652C0[playerIndex] = 0;
D_80165020[playerIndex] = 0;
D_80165070[playerIndex][0] = 0.0f;
D_80165070[playerIndex][1] = 0.0f;
D_80165070[playerIndex][2] = 0.0f;
D_80165280[playerIndex] = 0.0f;
D_801652A0[playerIndex] = 0.0f;
gPlayerIsThrottleActive[playerIndex] = 0;
D_80165400[playerIndex] = 0;
D_801654A0[playerIndex] = 0;
D_801654C0[playerIndex] = 0;
D_80165340 = 0;
player->unk_1A4 = 0;
@@ -287,14 +287,14 @@ void spawn_player(Player *player, s8 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg
player->unk_144 = 0.0f;
player->unk_148 = 0.0f;
D_80165300[arg1] = 0;
D_8018CE10[arg1].unk_04 = 0.0f;
D_8018CE10[arg1].unk_0C = 0.0f;
func_80295BF8(arg1);
D_80165300[playerIndex] = 0;
D_8018CE10[playerIndex].unk_04 = 0.0f;
D_8018CE10[playerIndex].unk_0C = 0.0f;
func_80295BF8(playerIndex);
func_8005D6C0(player);
func_8006B87C(player, arg1);
func_8006B87C(player, playerIndex);
if (gModeSelection == BATTLE) {
func_8006B7E4(player, arg1);
func_8006B7E4(player, playerIndex);
}
func_802B6540(player->unk_150, player->unk_058, player->unk_05C, player->unk_060, player->unk_02E);
func_802B6540(player->unk_174, player->unk_058, player->unk_05C, player->unk_060, player->unk_02E);
@@ -406,8 +406,8 @@ void func_80039DA4(void) {
temp_80039DA4 sp2C = D_800E4360;
temp_80039DA4 spC = D_800E4380;
if (((gCupCourseSelection == CUP_COURSE_ONE) && (D_8016556E == 0)) ||
(D_800DC51C == 1) ||
if (((gCupCourseSelection == CUP_COURSE_ONE) && (D_8016556E == 0)) ||
(D_800DC51C == 1) ||
(D_8018EDEF == 0x40)) {
for (i = 0; i < 8; i++) {
D_80165270[i] = sp2C.unk00[i];
@@ -422,7 +422,7 @@ void func_80039DA4(void) {
void func_80039F44(f32 *arg0, f32 *arg1, f32 arg2) {
func_80039DA4();
if (((gCupCourseSelection == CUP_COURSE_ONE) && (D_8016556E == 0)) ||
(D_800DC51C == 1) ||
(D_800DC51C == 1) ||
(D_8018EDEF == 0x40)) {
s16 rand;
s16 i;
@@ -538,7 +538,7 @@ getRand:
spawn_player(D_800DC4F0, 5, arg0[D_80165270[5]], arg1[D_80165270[5]], arg2, 32768.0f, D_80165560[3], PLAYER_EXISTS | PLAYER_CPU | PLAYER_START_SEQUENCE);
spawn_player(D_800DC4F4, 6, arg0[D_80165270[6]], arg1[D_80165270[6]], arg2, 32768.0f, D_80165560[4], PLAYER_EXISTS | PLAYER_CPU | PLAYER_START_SEQUENCE);
spawn_player(D_800DC4F8, 7, arg0[D_80165270[7]], arg1[D_80165270[7]], arg2, 32768.0f, D_80165560[5], PLAYER_EXISTS | PLAYER_CPU | PLAYER_START_SEQUENCE);
if (D_800DC51C == 1) {
spawn_player(D_800DC4FC, 0, arg0[D_80165270[0]], arg1[D_80165270[0]], arg2, 32768.0f, D_800E86A8[0], PLAYER_HUMAN_AND_CPU);
} else {
@@ -836,7 +836,7 @@ void func_8003C0F0(void) {
D_80165210[2] = D_80165210[4] = D_80165210[6] = sp5E - 0xA;
D_80165210[3] = D_80165210[5] = D_80165210[7] = sp5E - 0x1E;
D_80165210[1] = sp5E + 0xA;
D_80165230[0] = sp5C + 0x1E;
D_80165230[1] = sp5C + 0x1E;
D_80165230[2] = sp5C + 0x1E;
@@ -878,7 +878,7 @@ void func_8003C0F0(void) {
};
D_80165210[2] = -200.0f;
D_80165230[1] = -200.0f;
D_80165210[0] = 0.0f;
D_80165210[1] = 0.0f;
D_80165230[2] = 0.0f;
@@ -1239,7 +1239,7 @@ void func_8003DB5C(void) {
func_8001C4D0(player->posX, player->posY, player->posZ, player->unk_02E, 3, 0);
func_8001C4D0(player->posX, player->posY, player->posZ, player->unk_02E, 3, 1);
for (i = 0; i < 8; i++, player++) {
func_80027A20(player, i, 1, 0);
func_80027A20(player, i, 1, 1);
+25 -25
View File
@@ -458,12 +458,12 @@ void func_80058B58(s32 arg0) {
//temp_v0 = gCurrentCourseId;
if (gCurrentCourseId != COURSE_FRAPPE_SNOWLAND) {
if (gCurrentCourseId != COURSE_SHERBET_LAND) {
} else {
func_80052C60();
}
return;// Duplicate return node #9. Try simplifying control flow for better match
}
}
if (D_800DC50C != 9) {
if ((D_8015F894 == 0) && (gPlayerCountSelection1 == COURSE_CHOCO_MOUNTAIN)) {
func_800517C8();
@@ -472,7 +472,7 @@ void func_80058B58(s32 arg0) {
//return;
}
func_800517C8();
//return arg0;
}
#else
@@ -482,7 +482,7 @@ GLOBAL_ASM("asm/non_matchings/code_80057C60/func_80058B58.s")
extern u8 D_0D0076F8;
void func_80058BF4(void) {
gSPDisplayList(gDisplayListHead++, &D_0D0076F8);
gSPDisplayList(gDisplayListHead++, &D_0D0076F8);
}
#ifdef MIPS_TO_C
@@ -11067,13 +11067,13 @@ GLOBAL_ASM("asm/non_matchings/code_80057C60/func_8006AFD0.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_8006A50C(Player *, Player *, s8, s32, s32, s32); // extern
extern ? D_8018D8C0;
extern ? gPlayerBalloonCount;
void func_8006B7E4(Player *player, s32 arg1) {
func_8006A50C(NULL, NULL, arg1, 0, 0);
func_8006A50C(player, 0x3FC00000, 0x40000000, arg1, 1, 0x1C70);
func_8006A50C(player, 0xBFC00000, 0x40000000, arg1, 2, -0x1C70);
*(&D_8018D8C0 + (arg1 * 2)) = 2;
*(&gPlayerBalloonCount + (arg1 * 2)) = 2;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80057C60/func_8006B7E4.s")
@@ -11100,32 +11100,32 @@ GLOBAL_ASM("asm/non_matchings/code_80057C60/func_8006B87C.s")
? func_8008FD4C(s32, s8, s8); // extern
? func_800C9060(s32, ?, s8, s16); // extern
extern ? D_8018D5F0;
extern ? D_8018D8C0;
extern ? gPlayerBalloonCount;
void func_8006B8B4(s32 arg0, s8 arg1) {
void func_8006B8B4(s32 arg0, s8 playerIndex) {
s16 *sp1C;
s16 *temp_v1;
s16 temp_a3;
s16 *currentPlayerBalloonCount;
s16 playerBalloonCountValue;
s32 temp_a0;
s8 temp_a2;
s8 playerIndexTemp;
u16 *temp_v0;
u16 temp_t5;
temp_v1 = (arg1 * 2) + &D_8018D8C0;
temp_a3 = *temp_v1;
temp_a2 = arg1;
if (temp_a3 >= 0) {
temp_v0 = (arg1 * 6) + (temp_a3 * 2) + &D_8018D5F0;
currentPlayerBalloonCount = (playerIndex * 2) + &gPlayerBalloonCount;
playerBalloonCountValue = *currentPlayerBalloonCount;
playerIndexTemp = playerIndex;
if (playerBalloonCountValue >= 0) {
temp_v0 = (playerIndex * 6) + (playerBalloonCountValue * 2) + &D_8018D5F0;
temp_t5 = *temp_v0 & 0xFFFE;
*temp_v0 = temp_t5;
*temp_v0 = temp_t5 | 2;
*temp_v1 = temp_a3 - 1;
temp_a0 = temp_a2 & 0xFF;
sp1C = temp_v1;
arg1 = temp_a2;
func_800C9060(temp_a0, 0x19009051, temp_a2, temp_a3);
if (*temp_v1 < 0) {
func_8008FD4C(arg0, arg1, arg1);
*currentPlayerBalloonCount = playerBalloonCountValue - 1;
temp_a0 = playerIndexTemp & 0xFF;
sp1C = currentPlayerBalloonCount;
playerIndex = playerIndexTemp;
func_800C9060(temp_a0, 0x19009051, playerIndexTemp, playerBalloonCountValue);
if (*currentPlayerBalloonCount < 0) {
func_8008FD4C(arg0, playerIndex, playerIndex);
}
}
}
@@ -11136,10 +11136,10 @@ GLOBAL_ASM("asm/non_matchings/code_80057C60/func_8006B8B4.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
extern ? D_8018D5F0;
extern ? D_8018D8C0;
extern ? gPlayerBalloonCount;
void func_8006B974(s32 arg0, s8 arg1, s8 arg2) {
if (*(&D_8018D8C0 + (arg1 * 2)) >= 0) {
if (*(&gPlayerBalloonCount + (arg1 * 2)) >= 0) {
*(&D_8018D5F0 + ((arg1 * 6) + (arg2 * 2))) = 0;
}
}
+19 -18
View File
@@ -37,7 +37,7 @@ extern u8 *D_8015F8C4;
extern u8 *D_8015F8C8;
extern u8 *D_8015F8CC;
extern s16 D_8018D8C0[];
extern s16 gPlayerBalloonCount[];
extern s16 D_8016348C;
extern s8 gCupCourseSelection;
extern s32 D_800DC544;
@@ -133,7 +133,7 @@ void func_8028DF00(void) {
s32 i;
for (i = 0; i < 4; i++) {
D_802BA040[i] = controllers->button;
controllers++;
controllers++;
}
}
@@ -168,14 +168,14 @@ void func_8028E028(void) {
void func_8028E0F0(void) {
Player *ply;
s32 i;
s32 playerIndex;
s16 unk_arr2[4];
s16 unk_arr[4];
s16 phi_s1 = 0;
s16 phi_s2 = 0;
for(i = 0; i < 4; i++) {
ply = (Player *)&gPlayers[i];
for(playerIndex = 0; playerIndex < 4; playerIndex++) {
ply = (Player *)&gPlayers[playerIndex];
if (!(ply->unk_000 & PLAYER_EXISTS)) {
continue;
}
@@ -183,11 +183,12 @@ void func_8028E0F0(void) {
continue;
}
if (D_8018D8C0[i] < 0) {
// If player has no balloons left
if (gPlayerBalloonCount[playerIndex] < 0) {
ply->unk_000 |= PLAYER_CINEMATIC_MODE;
unk_arr[phi_s2] = (s16) (ply - D_800DC4DC);
phi_s2++;
func_800CA118((u8) i);
func_800CA118((u8) playerIndex);
} else {
unk_arr2[phi_s1] = (s16) (ply - D_800DC4DC);
phi_s1++;
@@ -217,7 +218,7 @@ void func_8028E298(void) {
continue;
}
temp_a2 = D_801645B0[i];
temp_v0 = ((2 - gPlayers[i].unk_008) * D_801645C8[temp_a2]);
temp_v0 += D_801645C8[temp_a2] * (1.0f - D_801644A8[i]);
temp_v0 /= 15.0f;
@@ -360,7 +361,7 @@ void func_8028E678(void) {
D_800DC5EC->screenWidth = 160;
phi_a0_10++;
}
if (D_800DC5F0->screenWidth < 160) {
D_800DC5F0->screenWidth = 160;
phi_a0_10++;
@@ -556,7 +557,7 @@ void func_8028EC98(s32 arg0) {
func_800C8EAC(25);
break;
}
}
void func_8028EDA8(void) {
@@ -570,7 +571,7 @@ void func_8028EDA8(void) {
if (D_800DC510 == 2) {
D_800DC510 = 3;
}
for (i = 0; i < 8; i++) {
if ((gPlayers[i].unk_000 & PLAYER_EXISTS) == 0) {
@@ -580,9 +581,9 @@ void func_8028EDA8(void) {
// Sets player to human.
if (gPlayers[i].unk_000 & PLAYER_START_SEQUENCE) {
gPlayers[i].unk_000 ^= PLAYER_START_SEQUENCE;
}
}
}
}
f32 func_8028EE8C(s32 arg0) {
@@ -613,7 +614,7 @@ void func_8028EF28(void) {
if (lapCount[i] < gPlayers[i].unk_008) {
gPlayers[i].unk_008--;
} else if (lapCount[i] > gPlayers[i].unk_008) {
gPlayers[i].unk_008++;
gPlayers[i].unk_008++;
if ((gPlayers[i].unk_000 & PLAYER_HUMAN) != 0) {
if (gPlayers[i].unk_008 == 3) {
@@ -630,7 +631,7 @@ void func_8028EF28(void) {
if ((D_802BA032 & PLAYER_EXISTS) == 0) {
D_802BA032 |= PLAYER_EXISTS;
}
if (gModeSelection == GRAND_PRIX && gPlayerCountSelection1 == 2 && D_802BA048 == 0) {
D_802BA048 = 1;
@@ -715,7 +716,7 @@ void func_8028EF28(void) {
func_80005AE8(ply);
}
}
}
}
}
if ((D_802BA048 != 0) && (D_802BA048 != 100)) {
D_802BA048 = 100;
@@ -1157,7 +1158,7 @@ void func_8028FCBC(void) {
case 1:
case 2:
if (((D_800DC4DC->unk_000 & PLAYER_CINEMATIC_MODE) != 0) && ((D_800DC4E0->unk_000 & PLAYER_CINEMATIC_MODE) != 0)) {
if (D_800DC4DC->unk_004 < D_800DC4E0->unk_004) {
D_800DC5E8 = 1;
} else {
+2 -2
View File
@@ -2128,7 +2128,7 @@ GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B3E7C.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
f32 func_802B51E8(void *, s32); // extern
extern ? D_8018D8C0;
extern ? gPlayerBalloonCount;
extern f32 D_802B9F68;
extern u16 gPlayers;
@@ -2145,7 +2145,7 @@ s16 func_802B3FD0(s32 arg0, s32 arg1) {
phi_f20 = D_802B9F68;
phi_fp = -1;
do {
if (((*phi_s0 & 0x8000) != 0) && (phi_s0 != arg0) && (*(&D_8018D8C0 + (phi_s1 * 2)) >= 0)) {
if (((*phi_s0 & 0x8000) != 0) && (phi_s0 != arg0) && (*(&gPlayerBalloonCount + (phi_s1 * 2)) >= 0)) {
temp_f0 = func_802B51E8(phi_s0 + 0x14, arg1 + 0x18);
if (temp_f0 < phi_f20) {
phi_fp = (phi_s0 - D_800DC4DC) / 0xDD8;