Skip to content

Commit

Permalink
Rename bomb kart structs (#464)
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Peisach <[email protected]>
  • Loading branch information
ItzSwirlz authored Oct 15, 2023
1 parent 5b39723 commit 03a5550
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 50 deletions.
6 changes: 3 additions & 3 deletions asm/bss_MainSeg.s
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ glabel D_80163DD8
glabel D_80163DE4
.skip 4

# D_80163DE8 should actually be of size 588 (0x54 * 7)
# gBombKarts should actually be of size 588 (0x54 * 7)
# D_80163E2C is a fake variable
glabel D_80163DE8
glabel gBombKarts
.skip 68

glabel D_80163E2C
.skip 520
# end D_80163DE8
# end gBombKarts

glabel D_80164034
.skip 4
Expand Down
4 changes: 2 additions & 2 deletions asm/non_matchings/code_80005FD0/func_8000DF8C.s
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ glabel func_8000DF8C
/* 00EB94 8000DF94 27BDFEE0 */ addiu $sp, $sp, -0x120
/* 00EB98 8000DF98 000F7880 */ sll $t7, $t7, 2
/* 00EB9C 8000DF9C 01E47821 */ addu $t7, $t7, $a0
/* 00EBA0 8000DFA0 3C188016 */ lui $t8, %hi(D_80163DE8) # $t8, 0x8016
/* 00EBA0 8000DFA0 3C188016 */ lui $t8, %hi(gBombKarts) # $t8, 0x8016
/* 00EBA4 8000DFA4 AFB00034 */ sw $s0, 0x34($sp)
/* 00EBA8 8000DFA8 27183DE8 */ addiu $t8, %lo(D_80163DE8) # addiu $t8, $t8, 0x3de8
/* 00EBA8 8000DFA8 27183DE8 */ addiu $t8, %lo(gBombKarts) # addiu $t8, $t8, 0x3de8
/* 00EBAC 8000DFAC 000F7880 */ sll $t7, $t7, 2
/* 00EBB0 8000DFB0 01F88021 */ addu $s0, $t7, $t8
/* 00EBB4 8000DFB4 96190044 */ lhu $t9, 0x44($s0)
Expand Down
4 changes: 2 additions & 2 deletions asm/non_matchings/hud_renderer/func_80056BF0.s
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ glabel func_80056BF0
/* 057800 80056C00 01F07821 */ addu $t7, $t7, $s0
/* 057804 80056C04 000F7880 */ sll $t7, $t7, 2
/* 057808 80056C08 01F07821 */ addu $t7, $t7, $s0
/* 05780C 80056C0C 3C188016 */ lui $t8, %hi(D_80163DE8) # $t8, 0x8016
/* 057810 80056C10 27183DE8 */ addiu $t8, %lo(D_80163DE8) # addiu $t8, $t8, 0x3de8
/* 05780C 80056C0C 3C188016 */ lui $t8, %hi(gBombKarts) # $t8, 0x8016
/* 057810 80056C10 27183DE8 */ addiu $t8, %lo(gBombKarts) # addiu $t8, $t8, 0x3de8
/* 057814 80056C14 000F7880 */ sll $t7, $t7, 2
/* 057818 80056C18 3C048018 */ lui $a0, %hi(D_80183E40) # $a0, 0x8018
/* 05781C 80056C1C 01F8C821 */ addu $t9, $t7, $t8
Expand Down
6 changes: 3 additions & 3 deletions include/bomb_kart.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
typedef struct {
/* 0x00 */ u16 waypointIndex;
/* 0x02 */ u16 startingState;
/* 0x04 */ f32 unk_04; // Used to set the value of unk_3C in struct_D_80163DE8_entry
/* 0x04 */ f32 unk_04; // Used to set the value of unk_3C in BombKart
/* 0x08 */ f32 startingXPos;
/* 0x0C */ f32 startingZPos;
/**
Expand Down Expand Up @@ -49,12 +49,12 @@ typedef struct {
/* 0x4C */ s16 unk_4C;
/* 0x4E */ // s16 compilerPadding;
/* 0x50 */ f32 yPos; // Y position of the center of the circle
} struct_D_80163DE8_entry; // size = 0x54
} BombKart; // size = 0x54

// Indexes for the objects associated with the Bomb Karts
extern s32 D_80183DD8[NUM_BOMB_KARTS_MAX];

extern struct_D_80163DE8_entry D_80163DE8[NUM_BOMB_KARTS_MAX];
extern BombKart gBombKarts[NUM_BOMB_KARTS_MAX];
extern Collision D_80164038[NUM_BOMB_KARTS_MAX];

// data/data_0DD0A0_1.s
Expand Down
54 changes: 27 additions & 27 deletions src/code_80005FD0.c
Original file line number Diff line number Diff line change
Expand Up @@ -3377,7 +3377,7 @@ void func_8000DD78(void) {
f32 startingYPos;
s32 var_s3;
TrackWaypoint *temp_v0;
struct_D_80163DE8_entry *var_s0;
BombKart *var_s0;
BombKartSpawn *temp_s1;

for (var_s3 = 0; var_s3 < NUM_BOMB_KARTS_VERSUS; var_s3++) {
Expand All @@ -3401,29 +3401,29 @@ void func_8000DD78(void) {
startingZPos = temp_v0->posZ;
break;
}
D_80163DE8[var_s3].bombPos[0] = startingXPos;
D_80163DE8[var_s3].bombPos[1] = startingYPos;
D_80163DE8[var_s3].bombPos[2] = startingZPos;
D_80163DE8[var_s3].wheel1Pos[0] = startingXPos;
D_80163DE8[var_s3].wheel1Pos[1] = startingYPos;
D_80163DE8[var_s3].wheel1Pos[2] = startingZPos;
D_80163DE8[var_s3].wheel2Pos[0] = startingXPos;
D_80163DE8[var_s3].wheel2Pos[1] = startingYPos;
D_80163DE8[var_s3].wheel2Pos[2] = startingZPos;
D_80163DE8[var_s3].wheel3Pos[0] = startingXPos;
D_80163DE8[var_s3].wheel3Pos[1] = startingYPos;
D_80163DE8[var_s3].wheel3Pos[2] = startingZPos;
D_80163DE8[var_s3].wheel4Pos[0] = startingXPos;
D_80163DE8[var_s3].wheel4Pos[1] = startingYPos;
D_80163DE8[var_s3].wheel4Pos[2] = startingZPos;
D_80163DE8[var_s3].waypointIndex = temp_s1->waypointIndex;
D_80163DE8[var_s3].unk_3C = temp_s1->unk_04;
D_80163DE8[var_s3].bounceTimer = 0;
D_80163DE8[var_s3].circleTimer = 0;
D_80163DE8[var_s3].state = temp_s1->startingState;
D_80163DE8[var_s3].unk_4A = 0;
D_80163DE8[var_s3].unk_4C = 1;
D_80163DE8[var_s3].yPos = startingYPos;
gBombKarts[var_s3].bombPos[0] = startingXPos;
gBombKarts[var_s3].bombPos[1] = startingYPos;
gBombKarts[var_s3].bombPos[2] = startingZPos;
gBombKarts[var_s3].wheel1Pos[0] = startingXPos;
gBombKarts[var_s3].wheel1Pos[1] = startingYPos;
gBombKarts[var_s3].wheel1Pos[2] = startingZPos;
gBombKarts[var_s3].wheel2Pos[0] = startingXPos;
gBombKarts[var_s3].wheel2Pos[1] = startingYPos;
gBombKarts[var_s3].wheel2Pos[2] = startingZPos;
gBombKarts[var_s3].wheel3Pos[0] = startingXPos;
gBombKarts[var_s3].wheel3Pos[1] = startingYPos;
gBombKarts[var_s3].wheel3Pos[2] = startingZPos;
gBombKarts[var_s3].wheel4Pos[0] = startingXPos;
gBombKarts[var_s3].wheel4Pos[1] = startingYPos;
gBombKarts[var_s3].wheel4Pos[2] = startingZPos;
gBombKarts[var_s3].waypointIndex = temp_s1->waypointIndex;
gBombKarts[var_s3].unk_3C = temp_s1->unk_04;
gBombKarts[var_s3].bounceTimer = 0;
gBombKarts[var_s3].circleTimer = 0;
gBombKarts[var_s3].state = temp_s1->startingState;
gBombKarts[var_s3].unk_4A = 0;
gBombKarts[var_s3].unk_4C = 1;
gBombKarts[var_s3].yPos = startingYPos;
func_802ADDC8(&D_80164038[var_s3], 2.0f, startingXPos, startingYPos, startingZPos);
}
}
Expand Down Expand Up @@ -3507,7 +3507,7 @@ void func_8000DF8C(s32 arg0) {
TrackWaypoint *temp_v0_4;
TrackWaypoint *temp_v0_7;
TrackWaypoint *temp_v1_2;
struct_D_80163DE8_entry *temp_s0;
BombKart *temp_s0;
u16 temp_t4;
u16 temp_t9;
u16 temp_v0;
Expand All @@ -3516,7 +3516,7 @@ void func_8000DF8C(s32 arg0) {
void *temp_v0_6;
void *temp_v1;

temp_s0 = &D_80163DE8[arg0];
temp_s0 = &gBombKarts[arg0];
temp_t9 = (u16) temp_s0->state;
temp_t2 = temp_t9 & 0xFFFF;
sp4C = temp_t2;
Expand Down Expand Up @@ -9443,7 +9443,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001C14C.s")

void func_8001C3C4(s32 arg0) {
if (gCurrentCourseId == COURSE_AWARD_CEREMONY) {
if (D_80163DE8[0].waypointIndex >= 16) {
if (gBombKarts[0].waypointIndex >= 16) {
func_80057114(3);
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/code_80057C60.c
Original file line number Diff line number Diff line change
Expand Up @@ -2518,8 +2518,8 @@ void func_8005D1F4(s32 arg0)
playerWaypoint = gNearestWaypointByPlayerId[arg0];
D_8018CA70[arg0].unk_74 = 0;
for (var_a2 = 0; var_a2 < NUM_BOMB_KARTS_VERSUS; var_a2++) {
if ((D_80163DE8[var_a2].state == BOMB_STATE_EXPLODED) || (D_80163DE8[var_a2].state == BOMB_STATE_INACTIVE)) continue;
bombWaypoint = D_80163DE8[var_a2].waypointIndex;
if ((gBombKarts[var_a2].state == BOMB_STATE_EXPLODED) || (gBombKarts[var_a2].state == BOMB_STATE_INACTIVE)) continue;
bombWaypoint = gBombKarts[var_a2].waypointIndex;
waypointDiff = bombWaypoint - playerWaypoint;
if ((waypointDiff < -5) || (waypointDiff > 0x1E)) continue;
D_8018CA70[arg0].unk_74 = 1;
Expand Down
22 changes: 11 additions & 11 deletions src/hud_renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -3234,7 +3234,7 @@ s32 func_80050644(u16 arg0, s32 *arg1, s32 *arg2) {
}

void func_800507D8(u16 bombIndex, s32 *arg1, s32 *arg2) {
s32 temp_v0 = D_80163DE8[bombIndex].waypointIndex;
s32 temp_v0 = gBombKarts[bombIndex].waypointIndex;
s32 var_v1 = 0;

if (temp_v0 != 0) {
Expand Down Expand Up @@ -3365,7 +3365,7 @@ void func_80050C68(void) {
s32 var_s1;

for (var_s1 = 0; var_s1 < NUM_BOMB_KARTS_VERSUS; var_s1++) {
if ((D_80163DE8[var_s1].state != BOMB_STATE_EXPLODED) && (D_80163DE8[var_s1].state != BOMB_STATE_INACTIVE)) {
if ((gBombKarts[var_s1].state != BOMB_STATE_EXPLODED) && (gBombKarts[var_s1].state != BOMB_STATE_INACTIVE)) {
func_800507D8(var_s1, &sp88, &sp84);
gSPDisplayList(gDisplayListHead++, D_0D007DB8);
gDPLoadTLUT_pal256(gDisplayListHead++, gTLUTPortraitBombKartAndQuestionMark);
Expand Down Expand Up @@ -5453,13 +5453,13 @@ extern s32 D_8018D400;
static ? D_800E471C; /* unable to generate initializer */

void func_80056BF0(s32 bombIndex) {
struct_D_80163DE8_entry sp40;
BombKart sp40;
Gfx *temp_v1;
s32 temp_s0;
s32 temp_v0;
s32 temp_v0_2;

M2C_MEMCPY_ALIGNED(&sp40, &D_80163DE8[bombIndex], 0x54);
M2C_MEMCPY_ALIGNED(&sp40, &gBombKarts[bombIndex], 0x54);
D_80183E40->unk0 = (bitwise f32) sp40;
D_80183E40->unk4 = (f32) ((f64) sp40.bombPos[1] + 1.0);
D_80183E40->unk8 = sp40.bombPos[2];
Expand All @@ -5486,7 +5486,7 @@ GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80056BF0.s")

void func_80056E24(s32 bombIndex, Vec3f arg1) {
s32 stackPadding[2];
struct_D_80163DE8_entry sp2C = D_80163DE8[bombIndex];
BombKart sp2C = gBombKarts[bombIndex];

D_80183E80[0] = 0;
D_80183E80[2] = 0x8000;
Expand All @@ -5505,9 +5505,9 @@ void func_80056E24(s32 bombIndex, Vec3f arg1) {

void func_80056FCC(s32 bombIndex) {
Mat4 sp30;
struct_D_80163DE8_entry *temp_v0;
BombKart *temp_v0;

temp_v0 = &D_80163DE8[bombIndex];
temp_v0 = &gBombKarts[bombIndex];
D_80183E50[0] = temp_v0->bombPos[0];
D_80183E50[1] = temp_v0->yPos + 1.0;
D_80183E50[2] = temp_v0->bombPos[2];
Expand All @@ -5523,7 +5523,7 @@ void func_80057114(s32 cameraId) {
s32 temp_s4;
s32 var_s2;
s32 state;
struct_D_80163DE8_entry *var_s1_2;
BombKart *var_s1_2;

if (gGamestate == 5) {
cameraId = 0;
Expand All @@ -5533,16 +5533,16 @@ void func_80057114(s32 cameraId) {
for (var_s2 = 0; var_s2 < NUM_BOMB_KARTS_VERSUS; var_s2++) {
objectIndex = D_80183DD8[var_s2];
if (is_obj_index_flag_unk_054_active(objectIndex, 0x00200000) != 0) {
D_80163DE8[var_s2].unk_4A = 0;
gBombKarts[var_s2].unk_4A = 0;
} else if (gGamestate != 5) {
D_80163DE8[var_s2].unk_4A = 1;
gBombKarts[var_s2].unk_4A = 1;
}
set_object_flag_unk_054_false(objectIndex, 0x00200000);
}
}

for (var_s2 = 0; var_s2 < NUM_BOMB_KARTS_VERSUS; var_s2++) {
var_s1_2 = &D_80163DE8[var_s2];
var_s1_2 = &gBombKarts[var_s2];
// huh???
state = var_s1_2->state;
if (var_s1_2->state != BOMB_STATE_INACTIVE) {
Expand Down

0 comments on commit 03a5550

Please sign in to comment.