diff --git a/include/structs.h b/include/structs.h index e30e9a50..d6320cfc 100644 --- a/include/structs.h +++ b/include/structs.h @@ -654,8 +654,6 @@ typedef struct Object_Original { u8 unk1F7; // Used in func_8002A900 } Object_Original; -// from object_functions.c - typedef struct Object_Laser { s16 unk0; u8 unk4[0x185]; @@ -676,6 +674,11 @@ typedef struct Object_Animator { /* 0x0A */ s16 ySpeed; } Object_Animator; +typedef struct Object_Animation { + /* 0x00 */ u8 pad0[0x4A]; + /* 0x4A */ s16 unk4A; +} Object_Animation; + typedef struct Object_WeaponBalloon { f32 unk0; s16 unk4; @@ -696,8 +699,6 @@ typedef struct Object_Butterfly { /* 0x108 */ f32 unk108; } Object_Butterfly; -// from object_functions.h - typedef struct Object_EffectBox { u8 pad0[0x1FE]; u8 unk1FE; @@ -856,7 +857,16 @@ typedef struct Object_Racer { /* 0x02A */ u16 unk2A; /* 0x02C */ f32 velocity; /* 0x030 */ f32 lateral_velocity; - /* 0x034 */ u8 pad34[0x28]; + /* 0x034 */ u8 pad[0x4]; + /* 0x038 */ f32 ox1; + /* 0x03C */ f32 oy1; + /* 0x040 */ f32 oz1; + /* 0x044 */ f32 ox2; + /* 0x048 */ f32 oy2; + /* 0x04C */ f32 oz2; + /* 0x050 */ f32 ox3; + /* 0x054 */ f32 oy3; + /* 0x058 */ f32 oz3; /* 0x05C */ f32 prev_x_position; /* 0x060 */ f32 prev_y_position; /* 0x064 */ f32 prev_z_position; @@ -873,14 +883,16 @@ typedef struct Object_Racer { /* 0x0B8 */ f32 brake; /* 0x0BC */ u8 padBC[0x4C]; /* 0x108 */ s32 unk108; - /* 0x10C */ u8 pad10C[0x1C]; + /* 0x10C */ u8 pad10C[0xC]; + /* 0x118 */ s32 unk118; + /* 0x11C */ u8 pad11C[0xC]; /* 0x128 */ u32 lap_times[3]; /* 0x134 */ u8 pad134[0x10]; /* 0x144 */ struct Object *held_obj; /* 0x148 */ struct Object *unk148; /* 0x14C */ struct Object *unk14C; /* 0x150 */ u8 pad150[0x4]; - /* 0x154 */ s32 unk154; + /* 0x154 */ struct Object *unk154; /* 0x158 */ u8 pad158[0x1A]; /* 0x172 */ u8 balloon_type; /* 0x173 */ u8 balloon_quantity; @@ -889,31 +901,40 @@ typedef struct Object_Racer { /* 0x183 */ s8 unk183; /* 0x184 */ s8 pad184; /* 0x185 */ s8 bananas; - /* 0x186 */ u8 pad186[0x1A]; + /* 0x186 */ u8 unk186; + /* 0x187 */ s8 unk187; + /* 0x188 */ u8 pad188[0x4]; + /* 0x18C */ s16 unk18C; + /* 0x18E */ s16 unk18E; + /* 0x190 */ u8 pad190[0x10]; /* 0x1A0 */ s16 unk1A0; /* 0x1A2 */ s16 unk1A2; /* 0x1A4 */ s16 unk1A4; - /* 0x1A6 */ u8 pad1A6[0x24]; + /* 0x1A6 */ u8 pad1A6[0x23]; + /* 0x1C9 */ u8 unk1C9; /* 0x1CA */ s8 unk1CA; /* 0x1CB */ u8 pad1CB[0x3]; /* 0x1CE */ u8 unk1CE; /* 0x1CF */ u8 pad1CF[0x4]; /* 0x1D3 */ s8 unk1D3; - /* 0x1D4 */ u8 pad1D4[0x4]; + /* 0x1D4 */ u8 pad1D4[0x2]; + /* 0x1D6 */ s8 unk1D6; + /* 0x1D7 */ s8 unk1D7; /* 0x1D8 */ s8 unk1D8; /* 0x1D9 */ u8 pad1D9[0x2]; - /* 0x1DB */ u8 spinout_timer; + /* 0x1DB */ s8 spinout_timer; /* 0x1DC */ u8 wheel_surfaces[4]; - /* 0x1E0 */ u8 pad1E0[0x2]; + /* 0x1E0 */ u8 pad1E0[0x1]; + /* 0x1E1 */ s8 unk1E1; /* 0x1E2 */ s8 unk1E2; /* 0x1E3 */ u8 pad1E3[0x3]; - /* 0x1E6 */ u8 drift_direction; + /* 0x1E6 */ s8 drift_direction; /* 0x1E7 */ u8 pad1E7[0x6]; /* 0x1ED */ s8 squish_timer; /* 0x1EE */ u8 pad1EE[0x1]; /* 0x1EF */ u8 boost_sound; /* 0x1F0 */ u8 pad1F0[0x2]; - /* 0x1F2 */ s8 unk1F2; + /* 0x1F2 */ u8 unk1F2; /* 0x1F3 */ u8 pad1F3[0x2]; /* 0x1F5 */ u8 unk1F5; /* 0x1F6 */ u8 pad1F6[0x1]; @@ -924,11 +945,13 @@ typedef struct Object_Racer { /* 0x200 */ s8 unk200; /* 0x201 */ u8 pad201[0x2]; /* 0x203 */ s8 unk203; - /* 0x204 */ u8 pad204[0x8]; + /* 0x204 */ s16 unk204; + /* 0x206 */ u8 pad206[0x6]; /* 0x20C */ u8 unk20C; /* 0x20D */ u8 pad20D[0x1]; - /* 0x20E */ u16 unk20E; - /* 0x210 */ u8 pad210[0x3]; + /* 0x20E */ s16 unk20E; + /* 0x210 */ s8 unk210; + /* 0x211 */ u8 pad211[0x2]; /* 0x213 */ s8 unk213; /* 0x214 */ s8 unk214; /* 0x215 */ s8 unk215; @@ -1039,7 +1062,9 @@ typedef struct Object_Banana { struct Object *spawner; } Object_Banana; -// from racer.c +typedef struct Object_FogChanger { + s16 unk0; +} Object_FogChanger; typedef struct Object_64 { union { @@ -1047,6 +1072,7 @@ typedef struct Object_64 { Object_Laser laser; Object_TrophyCabinet trophy_cabinet; Object_Animator animator; + Object_Animation animation; Object_WeaponBalloon weapon_balloon; Object_Butterfly butterfly; Object_EffectBox effect_box; @@ -1077,6 +1103,7 @@ typedef struct Object_64 { Object_MidiFadePoint midi_fade_point; Object_PosArrow pos_arrow; Object_Banana banana; + Object_FogChanger fog_changer; }; } Object_64; diff --git a/src/object_functions.c b/src/object_functions.c index 0246d7a4..a867be8a 100644 --- a/src/object_functions.c +++ b/src/object_functions.c @@ -1149,7 +1149,7 @@ GLOBAL_ASM("asm/non_matchings/unknown_032760/obj_loop_animator.s") #endif void obj_init_animation(Object *obj, LevelObjectEntry_Animation *entry, s32 arg2) { - Object_64_Animation* obj64; + Object_Animation* obj64; Object* sp24; s8 tempOrderIndex; f32 scalef; @@ -1200,7 +1200,7 @@ void obj_init_animation(Object *obj, LevelObjectEntry_Animation *entry, s32 arg2 if (((func_8001E440() == entry->channel) || (entry->channel == 20)) && (obj->unk64 == NULL) && (entry->order == 0) && (entry->objectIdToSpawn != -1)) { func_8001F23C(obj, entry); } - obj64 = (Object_64_Animation*)obj->unk64; + obj64 = &obj->unk64->animation; if (obj->unk64 != 0) { func_8001EFA4(obj, obj64); if (entry->order != 0 || obj64->unk4A != entry->objectIdToSpawn) { diff --git a/src/object_functions.h b/src/object_functions.h index 6d279628..baee3195 100644 --- a/src/object_functions.h +++ b/src/object_functions.h @@ -211,8 +211,6 @@ typedef struct Object_50_Scenery { //void func_80072348(s16 obj, u8 arg1); -typedef Object Object_64_Animation; - typedef struct unk80041A90_MidiFade { s16 unk0; // Y rotation s16 unk2; // X rotation @@ -375,7 +373,7 @@ void func_8000CBF0(Object*, s32); void func_8001EE74(); -void func_8001EFA4(Object*, Object_64_Animation*); +void func_8001EFA4(Object*, Object_Animation*); void func_8001F23C(Object *obj, LevelObjectEntry_Animation *entry); s32 func_8001F3EC(s32); s32 func_80021600(s32); diff --git a/src/racer.c b/src/racer.c index 5ad03d6e..f50c652e 100644 --- a/src/racer.c +++ b/src/racer.c @@ -287,7 +287,7 @@ GLOBAL_ASM("asm/non_matchings/racer/func_800494E0.s") GLOBAL_ASM("asm/non_matchings/racer/func_80049794.s") // Something Plane related. -void func_8004C0A0(s32 arg0, Object *planeObj, Object_64_8004C0A0 *planeObj64) { +void func_8004C0A0(s32 arg0, Object *planeObj, Object_Racer *planeObj64) { s32 temp_v1; s32 phi_v0; @@ -322,13 +322,13 @@ void func_8004C0A0(s32 arg0, Object *planeObj, Object_64_8004C0A0 *planeObj64) { } } -void func_8004C140(Object *obj, Object_64_8004C140 *obj64) { +void func_8004C140(Object *obj, Object_Racer *obj64) { s8 phi_v1; s8 temp; - if (obj64->unk0 == -1) { + if (obj64->playerIndex == -1) { phi_v1 = 0; } else { - phi_v1 = obj64->unk185; + phi_v1 = obj64->bananas; } temp = obj64->unk187; if (temp == 0 || obj64->unk18E > 0) { @@ -348,16 +348,16 @@ void func_8004C140(Object *obj, Object_64_8004C140 *obj64) { case 1: case 2: if (phi_v1 != 0) { - obj64->unk1DB = 0x28; + obj64->spinout_timer = 0x28; } else { - obj64->unk1DB = 0x3C; + obj64->spinout_timer = 0x3C; } break; case 3: if (phi_v1 != 0) { - obj64->unk1DB = 0x28; + obj64->spinout_timer = 0x28; } else { - obj64->unk1DB = 0x3C; + obj64->spinout_timer = 0x3C; } break; case 6: @@ -374,7 +374,7 @@ GLOBAL_ASM("asm/non_matchings/racer/func_8004C2B0.s") GLOBAL_ASM("asm/non_matchings/racer/func_8004CC20.s") GLOBAL_ASM("asm/non_matchings/racer/func_8004D590.s") -void func_8004D95C(s32 arg0, s32 arg1, Object *obj, Object_64_8004D95C *obj64) { +void func_8004D95C(s32 arg0, s32 arg1, Object *obj, Object_Racer *obj64) { s16 sp26; if (obj64->unk118 != 0) { @@ -389,14 +389,14 @@ void func_8004D95C(s32 arg0, s32 arg1, Object *obj, Object_64_8004D95C *obj64) { obj64->unk1D6 = obj64->unk1D7; obj->segment.unk3B = 0; if (obj64->unk1D6 == 0xA) { - if (obj64->someObject != NULL) { - obj64->someObject->segment.trans.x_position = obj->segment.trans.x_position; - obj64->someObject->segment.trans.y_position = obj->segment.trans.y_position; - obj64->someObject->segment.trans.z_position = obj->segment.trans.z_position; - obj64->someObject->segment.unk2C.half.lower = obj->segment.unk2C.half.lower; - obj64->someObject->segment.trans.y_rotation = obj->segment.trans.y_rotation; - obj64->someObject->segment.trans.x_rotation = obj->segment.trans.x_rotation; - obj64->someObject->segment.trans.z_rotation = obj->segment.trans.z_rotation; + if (obj64->unk154 != NULL) { + obj64->unk154->segment.trans.x_position = obj->segment.trans.x_position; + obj64->unk154->segment.trans.y_position = obj->segment.trans.y_position; + obj64->unk154->segment.trans.z_position = obj->segment.trans.z_position; + obj64->unk154->segment.unk2C.half.lower = obj->segment.unk2C.half.lower; + obj64->unk154->segment.trans.y_rotation = obj->segment.trans.y_rotation; + obj64->unk154->segment.trans.x_rotation = obj->segment.trans.x_rotation; + obj64->unk154->segment.trans.z_rotation = obj->segment.trans.z_rotation; obj->segment.unk3B = 0; obj->segment.unk18 = sp26 + arg0; func_80061C0C(obj); @@ -553,9 +553,9 @@ void func_80052988(Object *arg0, Object_64 *arg1, s32 arg2, s32 arg3, s32 arg4, GLOBAL_ASM("asm/non_matchings/racer/func_80052B64.s") GLOBAL_ASM("asm/non_matchings/racer/func_80052D7C.s") -void func_80053478(Object_64_80053478 *obj) { +void func_80053478(Object_Racer *obj) { s32 phi_v0; - f32 phi_f0 = obj->unk2C; + f32 phi_f0 = obj->velocity; if (phi_f0 < 0.0) { phi_f0 = -phi_f0; @@ -567,13 +567,13 @@ void func_80053478(Object_64_80053478 *obj) { if (phi_f0 < 0.0) { phi_f0 = 0.0f; } - if (obj->unk1E6 != 0) { + if (obj->drift_direction != 0) { phi_v0 = phi_f0 * 68.0f; } else { phi_v0 = phi_f0 * 58.0f; } D_8011D554 -= (obj->unk1E1 * phi_v0); - if (obj->unk2C > 0.0f) { + if (obj->velocity > 0.0f) { D_8011D554 = -D_8011D554; } } @@ -643,7 +643,7 @@ void func_80057048(Object *obj, s32 arg1) { } void func_800570A4(Object *obj, s32 arg1, s32 arg2) { - Object_64_unk800570A4 *temp = obj->unk64; + Object_Racer *temp = &obj->unk64->racer; temp->unk20E = arg1; temp->unk210 = arg2; } @@ -685,7 +685,7 @@ GLOBAL_ASM("asm/non_matchings/racer/func_800570B8.s") GLOBAL_ASM("asm/non_matchings/racer/func_80057220.s") -void func_800575EC(Object *obj, Object_64_800575EC *obj64) { +void func_800575EC(Object *obj, Object_Racer *obj64) { Matrix mf; D_8011D510.y_rotation = obj->segment.trans.y_rotation; @@ -723,7 +723,7 @@ void func_800579B0(unk800579B0 *arg0, UNUSED s32 arg1, f32 arg2) { GLOBAL_ASM("asm/non_matchings/racer/func_80057A40.s") -void func_800580B4(Object *obj, Object_64_800580B4 *obj64, s32 arg2, f32 arg3) { +void func_800580B4(Object *obj, Object_Racer *obj64, s32 arg2, f32 arg3) { f32 xPos, yPos, zPos; if ((D_8011D55C != -1) && (obj64->unk1D8 != 1)) { if (arg2 != gCameraObject->unk36) { diff --git a/src/racer.h b/src/racer.h index 02a9d625..d7ba0de7 100644 --- a/src/racer.h +++ b/src/racer.h @@ -22,45 +22,6 @@ typedef struct ObjectCamera { /* 0x0036 */ s16 unk36; } ObjectCamera; -/* Unknown size */ -typedef struct Object_64_8004C0A0 { - u8 pad0[0x1D7]; - s8 unk1D7; - u8 pad1D8[9]; - s8 unk1E1; - u8 pad1E2[0x10]; - u8 unk1F2; -} Object_64_8004C0A0; - -typedef struct Object_64_8004C140 { - s16 unk0; - u8 pad2[0x183]; - s8 unk185; - u8 unk186; - s8 unk187; - u8 pad188[4]; - s16 unk18C; - s16 unk18E; - u8 pad190[0x39]; - u8 unk1C9; - u8 pad1CA[0xC]; - s8 unk1D6; - u8 pad1D7[4]; - s8 unk1DB; - u8 pad1DC[0x28]; - s16 unk204; -} Object_64_8004C140; - -typedef struct Object_64_8004D95C { - u8 unk0[0x118]; - s32 unk118; - u8 unk11C[0x38]; - Object *someObject; - u8 unk158[0x7E]; - s8 unk1D6; - s8 unk1D7; -} Object_64_8004D95C; - typedef struct unk8004F77C { u8 unk0[0x20A]; u8 unk20A; @@ -72,15 +33,6 @@ typedef struct unk8005234C { s16 unk16C; } unk8005234C; -typedef struct Object_64_80053478 { - u8 unk0[0x2C]; - f32 unk2C; - u8 unk30[0x1B1]; - s8 unk1E1; - u8 unk1E2[4]; - s8 unk1E6; -} Object_64_80053478; - /* Unknown Size */ typedef struct unk800535C4 { s16 unk0; @@ -99,46 +51,18 @@ typedef struct unk800535C4_2 { /* 0x1A4 */ s16 unk1A4; } unk800535C4_2; -/* Unknown Size */ -typedef struct Object_64_unk800570A4 { - u8 unk0[0x108]; - s32 unk108; - u8 unk10C[0x102]; - s16 unk20E; - s8 unk210; -} Object_64_unk800570A4; - /* Unknown Size */ typedef struct unk80056930 { u8 unk0[0x3]; s8 unk3; } unk80056930; -/* Unknown size */ -typedef struct Object_64_800575EC { - /* 0x00 */ u8 pad0[0x38]; - /* 0x38 */ f32 ox1; - /* 0x3C */ f32 oy1; - /* 0x40 */ f32 oz1; - /* 0x44 */ f32 ox2; - /* 0x48 */ f32 oy2; - /* 0x4C */ f32 oz2; - /* 0x50 */ f32 ox3; - /* 0x54 */ f32 oy3; - /* 0x58 */ f32 oz3; -} Object_64_800575EC; - /* Unknown Size */ typedef struct unk800579B0 { u8 unk0[0x1E1]; s8 unk1E1; } unk800579B0; -typedef struct Object_64_800580B4 { - u8 unk0[0x1D8]; - s8 unk1D8; -} Object_64_800580B4; - /* Unknown Size */ typedef struct unk8005C270 { u8 unk0[0x190]; @@ -198,23 +122,23 @@ void func_8006FC30(Matrix, ObjectTransform *); // asm func void func_8006FE74(Matrix *, ObjectTransform *); // Non Matching ? s32 func_80044450(s32 arg0); -void func_8004C0A0(s32 arg0, Object *planeObj, Object_64_8004C0A0 *planeObj64); -void func_8004C140(Object *obj, Object_64_8004C140 *obj64); -void func_8004D95C(s32 arg0, s32 arg1, Object *obj, Object_64_8004D95C *obj64); +void func_8004C0A0(s32 arg0, Object *planeObj, Object_Racer *planeObj64); +void func_8004C140(Object *obj, Object_Racer *obj64); +void func_8004D95C(s32 arg0, s32 arg1, Object *obj, Object_Racer *obj64); void func_8004F77C(unk8004F77C *arg0); s32 func_80052188(void); void func_800521B8(s32 arg0); void func_8005234C(unk8005234C *arg0); void func_80052988(Object *arg0, Object_64 *arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7); -void func_80053478(Object_64_80053478 *obj); +void func_80053478(Object_Racer *obj); void func_800535C4(unk800535C4 *arg0, unk800535C4_2 *arg1); void func_80053664(Object_64 *arg0); void play_char_horn_sound(Object *obj, Object_64 *obj64); void func_80057048(Object *obj, s32 arg1); void func_800570A4(Object *obj, s32 arg1, s32 arg2); -void func_800575EC(Object *obj, Object_64_800575EC *obj64); +void func_800575EC(Object *obj, Object_Racer *obj64); void func_800579B0(unk800579B0 *arg0, s32 arg1, f32 arg2); -void func_800580B4(Object *obj, Object_64_800580B4 *obj64, s32 arg2, f32 arg3); +void func_800580B4(Object *obj, Object_Racer *obj64, s32 arg2, f32 arg3); void get_timestamp_from_frames(s32 frameCount, s32 *minutes, s32 *seconds, s32 *hundredths); void func_800598D0(void); void func_80059944(void); @@ -233,7 +157,7 @@ void func_8005C25C(void); //Non Matching void set_ghost_position_and_rotation(Object *obj); void func_800570B8(Object *obj, s32 arg1, s32 arg2, s32 arg3); -void func_800576E0(Object *obj, Object_64_8004C140 *obj64, s32 arg2); -void func_80057A40(Object *obj, Object_64_800580B4 *obj64, f32 arg2); +void func_800576E0(Object *obj, Object_Racer *obj64, s32 arg2); +void func_80057A40(Object *obj, Object_Racer *obj64, f32 arg2); #endif diff --git a/src/unknown_0255E0.c b/src/unknown_0255E0.c index f69ce029..252c9a5c 100644 --- a/src/unknown_0255E0.c +++ b/src/unknown_0255E0.c @@ -1178,10 +1178,6 @@ void func_8003093C(s32 arg0) { #ifdef NON_EQUIVALENT //unk8011D388 D_8011D388[4]; -typedef struct Object_64_FogChanger { - s16 unk0; -} Object_64_FogChanger; - typedef struct Object_3C_FogChanger { u8 pad0[0x2]; s16 unk2; @@ -1227,7 +1223,7 @@ void obj_loop_fogchanger(Object* obj) { index = -1; if (sp40 != NULL) { tempObj = sp40[i]; // Might be a player object? - temp_v0 = ((Object_64_FogChanger*)tempObj->unk64)->unk0; + temp_v0 = tempObj->unk64->fog_changer.unk0; if ((temp_v0 >= 0) && (temp_v0 < MAXCONTROLLERS) && (obj != D_8011D388[i].unk34)) { index = temp_v0; x = tempObj->segment.trans.x_position;