From de6ca6bf50d1fb3063eb7a4273976eb45ec32b2f Mon Sep 17 00:00:00 2001 From: Antonio Date: Tue, 12 Apr 2022 23:54:22 -0700 Subject: [PATCH 1/9] Refactor Object_64. --- include/structs.h | 638 ++++++++++++++++++++++++++++++++++------- src/game_ui.c | 4 +- src/object_functions.c | 274 ++++++++---------- src/object_functions.h | 300 +------------------ src/objects.c | 34 +-- src/racer.c | 84 ++---- 6 files changed, 693 insertions(+), 641 deletions(-) diff --git a/include/structs.h b/include/structs.h index e06375d3..f5640a21 100644 --- a/include/structs.h +++ b/include/structs.h @@ -575,10 +575,9 @@ typedef struct Object_60 { void *unk4; // Object* pointer } Object_60; -// This REALLY needs to be refactored at some point. -// This structure differs based on the type of object being loaded. -// See functions in object_functions.c for how these get loaded. -typedef struct Object_64 { +struct Object; + +typedef struct Object_Original { union { f32 unk0; struct { @@ -653,6 +652,435 @@ typedef struct Object_64 { u8 unk1F3; u8 pad1F4[3]; u8 unk1F7; // Used in func_8002A900 +} Object_Original; + +// from object_functions.c + +typedef struct Object_80034860 { + s16 unk0; + u8 unk4[0x185]; + s8 unk187; +} Object_80034860; + +typedef struct Object_80034E9C { + s32 unk0; + s16 unk4; +} Object_80034E9C; + +typedef struct Object_Animator { + /* 0x00 */ s16 segmentId; + /* 0x02 */ s16 batchId; + /* 0x04 */ s16 xSpeedFactor; + /* 0x06 */ s16 ySpeedFactor; + /* 0x08 */ s16 xSpeed; + /* 0x0A */ s16 ySpeed; +} Object_Animator; + +typedef struct Object_8003DFCC { + f32 unk0; + s16 unk4; + s8 unk6[0x2]; +} Object_8003DFCC; + +typedef struct Object_Butterfly { + /* 0x00 */ Triangle triangles[8]; + /* 0x80 */ Vertex vertices[12]; + /* 0xF8 */ TextureHeader *texture; + /* 0xFC */ u8 unkFC; + /* 0xFD */ u8 unkFD; + /* 0xFE */ u8 unkFE; + /* 0xFF */ u8 unkFF; + /* 0x100 */ s32 unk100; + /* 0x104 */ s16 unk104; + /* 0x106 */ s16 unk106; + /* 0x108 */ f32 unk108; +} Object_Butterfly; + +// from object_functions.h + +typedef struct Object_80034B74 { + u8 pad0[0x1FE]; + u8 unk1FE; + u8 unk1FF; +} Object_80034B74; + +typedef struct Object_8003564C { + u8 pad0[4]; + struct Object *unk4; +} Object_8003564C; + +typedef struct Object_80035E34 { + u8 pad0[0x1D6]; + s8 unk1D6; +} Object_80035E34; + +typedef struct Object_80035F6C { + s32 unk0; + s32 unk4; + s32 unk8; + s32 unkC; + s32 unk10; + s32 unk14; + s32 unk18; + s32 unk1C; + s16 *unk20; + u8 *unk24; +} Object_80035F6C; + +typedef struct Object_80035F6C_2 { + u8 pad0[3]; + s8 unk3; +} Object_80035F6C_2; + +typedef struct Object_800376E0 { + s16 segmentId; + s16 unk2; + s16 unk4; + s16 unk6; + s16 unk8; + s16 unkA; +} Object_800376E0; + +typedef struct Object_Snowball { + u8 pad0[0x20]; + u32 unk20; + s16 unk24; + u8 pad28[0x12]; + s8 unk38; +} Object_Snowball; + +typedef struct Object_80038710 { + u8 pad0[0x30]; + s8 unk30; + u8 pad31[0x13]; + s8 unk44; +} Object_80038710; + +typedef struct Object_800387CC { + u8 pad0[0x148]; + struct Object *unk148; +} Object_800387CC; + +typedef struct Object_800388D4 { + s16 unk0; +} Object_800388D4; + +typedef struct Object_80038E3C { + f32 unk0; + f32 unk4; + f32 unk8; + f32 unkC; + s32 unk10; + s8 unk14; +} Object_80038E3C; + +typedef struct Object_8003C1E0 { + f32 unk0; + u8 pad4[4]; + s32 unk8; + u8 padC[3]; + s8 unkF; + u8 pad10[2]; + u8 unk12; + u8 unk13; +} Object_8003C1E0; + +typedef struct Object_8003DF08 { + s16 unk0; +} Object_8003DF08; + +typedef struct Object_8003FEF4 { + u8 unk0; + u8 pad1; + u16 unk2; + u16 unk4; + u16 unk6; + union { + struct { + u8 unk8; + u8 unk9; + u8 unkA; + u8 padB; + } unk_struct; + s32 unk8_word; + } unk_union; + u8 unkC; + u8 unkD; + u8 unkE; + u8 unkF; + u8 unk10; + u8 unk11; + u8 unk12; +} Object_8003FEF4; + +typedef struct Object_8004001C { + u16 pad0; + s16 unk2; + u8 unk4; + u8 unk5; +} Object_8004001C; + +typedef struct Object_800400A4 { + s16 unk0; + s16 pad2; + s16 unk4; + s16 unk6; + s16 unk8; + s16 unkA; +} Object_800400A4; + +typedef struct Object_80042210 { + f32 unk0; + f32 unk4; + f32 unk8; + f32 unkC; + f32 unk10; + u8 unk14; + u8 unk15; + u8 pad16[3]; + u8 unk19; + u8 pad1A[6]; + f32 unk20; + f32 unk24; + u8 pad28[8]; + f32 unk30; +} Object_80042210; + +typedef struct Object_Wizpig2 { + u8 pad0[0x70]; + u8 unk70; + u8 pad71; + u8 unk72; + u8 pad73; + f32 unk74; +} Object_Wizpig2; + +typedef struct Object_Exit { + f32 unk0; + f32 unk4; + f32 unk8; + f32 unkC; + s32 unk10; + s8 unk14; +} Object_Exit; + +typedef struct Object_Racer { + s16 unk0; + u8 pad2; + s8 unk3; + u8 pad4[0x104]; + s32 unk108; + u8 pad10C[0x40]; + struct Object *unk14C; + u8 pad150[0x33]; + s8 unk183; + s8 pad184; + s8 unk185; + u8 pad186[0x4D]; + s8 unk1D3; + u8 pad1D4[0x4]; + s8 unk1D8; + u8 pad1D9[0x9]; + s8 unk1E2; + u8 pad1E3[0x12]; + u8 unk1F5; + u8 pad1F6[0xA]; + s8 unk200; + u8 pad201[0x2]; + s8 unk203; + u8 pad204[0x8]; + u8 unk20C; +} Object_Racer; + +typedef struct Object_Bonus { + f32 unk0; + f32 unk4; + f32 unk8; + f32 unkC; + s32 unk10; + s8 unk14; +} Object_Bonus; + +typedef struct Object_ModeChange { + f32 unk0; + f32 unk4; + f32 unk8; + f32 unkC; + s32 unk10; + s8 unk14; +} Object_ModeChange; + +typedef struct Object_GoldenBalloon { + f32 unk0; + u8 pad4[0x8]; + u8 unkC; + u8 unkD; + u8 unkE; + u8 unkF; + s8 unk10; + f32 unk14; +} Object_GoldenBalloon; + +typedef struct Object_Door { + f32 unk0; + u8 pad4[0x4]; + s32 unk8; + s16 padA; + s8 unkE; + u8 unkF; + u8 unk10; + u8 unk11; + u8 unk12; + u8 unk13; + u8 unk14; +} Object_Door; + +typedef struct Object_Trigger { + f32 unk0; + f32 unk4; + f32 unk8; + f32 unkC; + s32 unk10; + s8 unk14; +} Object_Trigger; + +typedef struct Object_Audio { + /* 0x00 */ u16 unk0; + /* 0x02 */ u16 unk2; + /* 0x04 */ u8 unk4; + /* 0x05 */ u8 unk5; + /* 0x06 */ u8 unk6; + /* 0x07 */ u8 unk7; + /* 0x08 */ s32 unk8; + /* 0x0C */ u8 unkC; + /* 0x0D */ u8 unkD; +} Object_Audio; + +typedef struct Object_MidiFade { + u8 unk0; + u8 unk1; + u8 unk2; + f32 unk4; + f32 unk8; + f32 unkC; + f32 unk10; + f32 unk14; + f32 unk18; + f32 unk1C; + f32 unk20; + f32 unk24; + f32 unk28; + f32 unk2C; + u8 unk2F[16]; + u8 unk40; +} Object_MidiFade; + +typedef struct Object_MidiFadePoint { + u16 unk0; + u16 unk2; + f32 unk4; + f32 unk8; + u8 unkC[16]; + u8 unk1C; +} Object_MidiFadePoint; + +typedef struct Object_PosArrow { + s16 unk0; + u8 pad4[0x14E]; + struct Object *unk150; +} Object_PosArrow; + +typedef struct Object_Banana { + u8 pad0[4]; + struct Object *spawner; +} Object_Banana; + +// from racer.c + +typedef struct Object_80044170 { + char unk0[0x2C]; + f32 unk2C; + char unk30[0x124]; + s32 unk154; + char unk158[0x72]; + s8 unk1CA; + char unk1CB[0x3]; + u8 unk1CE; + char unk1CF[0x13]; + s8 unk1E2; + char unk1E3[0x30]; + s8 unk213; + s8 unk214; + s8 unk215; +} Object_80044170; + +typedef struct Object_80050754 { + u8 unk0[0x2C]; + f32 unk2C; + f32 unk30; + u8 unk34[0x114]; + /* 0x148 */ struct Object *someObj; + u8 unk14C[0x54]; + /* 0x1A0 */ s16 unk1A0; + /* 0x1A2 */ s16 unk1A2; + /* 0x1A4 */ s16 unk1A4; + u8 unk1A6[0x4C]; + /* 0x1F2 */ s8 unk1F2; +} Object_80050754; + +typedef struct Object_800570B8 { + u8 pad0[3]; + s8 unk3; + u8 pad4[0x20]; + s32 unk24; + u16 unk28; + u16 unk2A; + u8 pad2C[0xDC]; + s32 unk108; +} Object_800570B8; + +typedef struct Object_64 { + union { + Object_Original original; + Object_80034860 obj80034860; + Object_80034E9C obj80034E9C; + Object_Animator animator; + Object_8003DFCC obj8003DFCC; + Object_Butterfly butterfly; + Object_80034B74 obj80034B74; + Object_8003564C obj8003564C; + Object_80035E34 obj80035E34; + Object_80035F6C obj80035F6C; + Object_80035F6C_2 obj80035F6C_2; + Object_800376E0 obj800376E0; + Object_Snowball snowball; + Object_80038710 obj80038710; + Object_800387CC obj800387CC; + Object_800388D4 obj800388D4; + Object_80038E3C obj80038E3C; + Object_8003C1E0 obj8003C1E0; + Object_8003DF08 obj8003DF08; + Object_8003FEF4 obj8003FEF4; + Object_8004001C obj8004001C; + Object_800400A4 obj800400A4; + Object_80042210 obj80042210; + Object_Wizpig2 wizpig2; + Object_Exit exit; + Object_Racer racer; + Object_Bonus bonus; + Object_ModeChange mode_change; + Object_GoldenBalloon golden_balloon; + Object_Door door; + Object_Trigger trigger; + Object_Audio audio; + Object_MidiFade midi_fade; + Object_MidiFadePoint midi_fade_point; + Object_PosArrow pos_arrow; + Object_Banana banana; + Object_80044170 obj80044170; + Object_80050754 obj80050754; + Object_800570B8 obj800570B8; + }; } Object_64; typedef struct Object_68 { @@ -764,129 +1192,133 @@ typedef struct Object { /* 0x0090 */ u32 unk90; /* 0x0094 */ u32 unk94; - /* 0x0098 */ s16 playerIndex; // -1 = AI Controlled, 0 to 3 = Object controlled - /* 0x009A */ u8 unk9A; - /* 0x009B */ u8 characterId; // Affects minimap color, horn, voice, etc. + /* 0x0098 */ Object_64 obj; + + //------------------------------ REMOVE BEGIN ------------------------------ +// /* 0x0098 */ s16 playerIndex; // -1 = AI Controlled, 0 to 3 = Object controlled +// /* 0x009A */ u8 unk9A; +// /* 0x009B */ u8 characterId; // Affects minimap color, horn, voice, etc. - /* 0x009C */ u32 unk9C; +// /* 0x009C */ u32 unk9C; - /* 0x00A0 */ f32 unkA0; +// /* 0x00A0 */ f32 unkA0; - /* 0x00A4 */ u32 unkA4; - /* 0x00A8 */ u32 unkA8; - /* 0x00AC */ u32 unkAC; - /* 0x00B0 */ u32 unkB0; - /* 0x00B4 */ u32 unkB4; - /* 0x00B8 */ u32 unkB8; - /* 0x00BC */ u32 unkBC; - /* 0x00C0 */ u32 unkc0; +// /* 0x00A4 */ u32 unkA4; +// /* 0x00A8 */ u32 unkA8; +// /* 0x00AC */ u32 unkAC; +// /* 0x00B0 */ u32 unkB0; +// /* 0x00B4 */ u32 unkB4; +// /* 0x00B8 */ u32 unkB8; +// /* 0x00BC */ u32 unkBC; +// /* 0x00C0 */ u32 unkc0; - /* 0x00C4 */ f32 velocity; - /* 0x00C8 */ f32 lateral_velocity; +// /* 0x00C4 */ f32 velocity; +// /* 0x00C8 */ f32 lateral_velocity; - u32 unkCC[10]; // Not an array. Unknown values. +// u32 unkCC[10]; // Not an array. Unknown values. - /* 0x00F4 */ f32 prev_x_position; - /* 0x00F8 */ f32 prev_y_position; - /* 0x00FC */ f32 prev_z_position; +// /* 0x00F4 */ f32 prev_x_position; +// /* 0x00F8 */ f32 prev_y_position; +// /* 0x00FC */ f32 prev_z_position; - /* 0x0100 */ u32 unk100; - /* 0x0104 */ u32 unk104; - /* 0x0108 */ u32 unk108; - /* 0x010C */ u32 unk10C; +// /* 0x0100 */ u32 unk100; +// /* 0x0104 */ u32 unk104; +// /* 0x0108 */ u32 unk108; +// /* 0x010C */ u32 unk10C; - /* 0x0110 */ f32 unk110; - /* 0x0114 */ f32 unk114; - /* 0x0118 */ f32 unk118; - /* 0x011C */ f32 unk11C; - /* 0x0120 */ u32 unk120; - /* 0x0124 */ f32 stretch_height; - /* 0x0128 */ f32 stretch_height_cap; - /* 0x012C */ f32 camera_zoom; - /* 0x0130 */ u32 unk130; - /* 0x0134 */ f32 pitch; - /* 0x0138 */ u32 unk138; - /* 0x013C */ u32 unk13C; - /* 0x0140 */ f32 checkpoint_distance; - /* 0x0144 */ u32 unk144; - /* 0x0148 */ f32 unk148; - /* 0x014C */ f32 throttle; - /* 0x0150 */ f32 brake; - /* 0x0154 */ u32 unk154; - /* 0x0158 */ u32 unk158; - /* 0x015C */ u32 unk15C; - /* 0x0160 */ f32 unk160; - /* 0x0164 */ u32 unk164; - /* 0x0168 */ u32 unk168; - /* 0x016C */ u32 unk16C; - /* 0x0170 */ f32 unk170; - /* 0x0174 */ f32 unk174; - /* 0x0178 */ f32 unk178; - /* 0x017C */ f32 unk17C; - /* 0x0180 */ f32 unk180; - /* 0x0184 */ f32 unk184; - /* 0x0188 */ f32 unk188; - /* 0x018C */ f32 unk18C; - /* 0x0190 */ f32 unk190; - /* 0x0194 */ f32 unk194; - /* 0x0198 */ f32 unk198; - /* 0x019C */ f32 unk19C; +// /* 0x0110 */ f32 unk110; +// /* 0x0114 */ f32 unk114; +// /* 0x0118 */ f32 unk118; +// /* 0x011C */ f32 unk11C; +// /* 0x0120 */ u32 unk120; +// /* 0x0124 */ f32 stretch_height; +// /* 0x0128 */ f32 stretch_height_cap; +// /* 0x012C */ f32 camera_zoom; +// /* 0x0130 */ u32 unk130; +// /* 0x0134 */ f32 pitch; +// /* 0x0138 */ u32 unk138; +// /* 0x013C */ u32 unk13C; +// /* 0x0140 */ f32 checkpoint_distance; +// /* 0x0144 */ u32 unk144; +// /* 0x0148 */ f32 unk148; +// /* 0x014C */ f32 throttle; +// /* 0x0150 */ f32 brake; +// /* 0x0154 */ u32 unk154; +// /* 0x0158 */ u32 unk158; +// /* 0x015C */ u32 unk15C; +// /* 0x0160 */ f32 unk160; +// /* 0x0164 */ u32 unk164; +// /* 0x0168 */ u32 unk168; +// /* 0x016C */ u32 unk16C; +// /* 0x0170 */ f32 unk170; +// /* 0x0174 */ f32 unk174; +// /* 0x0178 */ f32 unk178; +// /* 0x017C */ f32 unk17C; +// /* 0x0180 */ f32 unk180; +// /* 0x0184 */ f32 unk184; +// /* 0x0188 */ f32 unk188; +// /* 0x018C */ f32 unk18C; +// /* 0x0190 */ f32 unk190; +// /* 0x0194 */ f32 unk194; +// /* 0x0198 */ f32 unk198; +// /* 0x019C */ f32 unk19C; - u32 unk1A0[8]; // Not an array. Unknown values. +// u32 unk1A0[8]; // Not an array. Unknown values. - /* 0x01C0 */ u32 lap_times[3]; +// /* 0x01C0 */ u32 lap_times[3]; - /* 0x01CC */ u32 unk1CC; - /* 0x01D0 */ u32 unk1D0; - /* 0x01D4 */ u32 unk1D4; - /* 0x01D8 */ u32 unk1D8; +// /* 0x01CC */ u32 unk1CC; +// /* 0x01D0 */ u32 unk1D0; +// /* 0x01D4 */ u32 unk1D4; +// /* 0x01D8 */ u32 unk1D8; - /* 0x01DC */ void *held_obj_ptr; +// /* 0x01DC */ void *held_obj_ptr; - u32 unk1E0[10]; // Not an array. Unknown values. +// u32 unk1E0[10]; // Not an array. Unknown values. - /* 0x0208 */ u16 unk208; - /* 0x020A */ u8 balloon_type; - /* 0x020B */ u8 balloon_quantity; - /* 0x020C */ u8 balloon_level; +// /* 0x0208 */ u16 unk208; +// /* 0x020A */ u8 balloon_type; +// /* 0x020B */ u8 balloon_quantity; +// /* 0x020C */ u8 balloon_level; - /* 0x020D */ u8 unk20D; - /* 0x020E */ u8 unk20E; - /* 0x020F */ u8 unk20F; - /* 0x0210 */ u32 unk210; - /* 0x0214 */ u32 unk214; - /* 0x0218 */ u32 unk218; - /* 0x021A */ u16 unk21A; - /* 0x021B */ u8 unk21B; +// /* 0x020D */ u8 unk20D; +// /* 0x020E */ u8 unk20E; +// /* 0x020F */ u8 unk20F; +// /* 0x0210 */ u32 unk210; +// /* 0x0214 */ u32 unk214; +// /* 0x0218 */ u32 unk218; +// /* 0x021A */ u16 unk21A; +// /* 0x021B */ u8 unk21B; - /* 0x021D */ s8 bananas; - /* 0x021E */ u8 unk21E; +// /* 0x021D */ s8 bananas; +// /* 0x021E */ u8 unk21E; - /* 0x0270 */ u8 unk270; - /* 0x0271 */ u8 unk271; - /* 0x0272 */ u8 unk272; +// /* 0x0270 */ u8 unk270; +// /* 0x0271 */ u8 unk271; +// /* 0x0272 */ u8 unk272; - /* 0x0273 */ u8 spinout_timer; - /* 0x0274 */ u8 wheel_surfaces[4]; +// /* 0x0273 */ u8 spinout_timer; +// /* 0x0274 */ u8 wheel_surfaces[4]; - /* 0x0278 */ u32 unk278; - /* 0x027C */ u16 unk27C; +// /* 0x0278 */ u32 unk278; +// /* 0x027C */ u16 unk27C; - /* 0x027E */ u8 drift_direction; - /* 0x027F */ u8 unk27F; +// /* 0x027E */ u8 drift_direction; +// /* 0x027F */ u8 unk27F; - /* 0x0280 */ u32 unk280; - /* 0x0284 */ u8 unk284; +// /* 0x0280 */ u32 unk280; +// /* 0x0284 */ u8 unk284; - /* 0x0285 */ s8 squish_timer; - /* 0x0286 */ u8 unk286; - /* 0x0287 */ u8 boost_sound; - /* 0x0288 */ u32 unk288; +// /* 0x0285 */ s8 squish_timer; +// /* 0x0286 */ u8 unk286; +// /* 0x0287 */ u8 boost_sound; +// /* 0x0288 */ u32 unk288; - /* 0x028C */ u16 unk28C; - /* 0x028E */ u8 unk28E; +// /* 0x028C */ u16 unk28C; +// /* 0x028E */ u8 unk28E; - /* 0x028F */ u8 transparency; +// /* 0x028F */ u8 transparency; + //------------------------------ REMOVE END ------------------------------ /* 0x0290 */ u8 indicator_type; /* 0x0291 */ s8 indicator_timer; /* 0x0292 */ u16 unk292; diff --git a/src/game_ui.c b/src/game_ui.c index fc007c0c..a5be8017 100644 --- a/src/game_ui.c +++ b/src/game_ui.c @@ -285,7 +285,7 @@ void func_800A0DC0(s32 arg0, Object *arg1, s32 arg2) { func_800A4C44(temp, arg2); func_800A3884(arg1, arg2); - if (D_80127188 != 0 && temp->unk1D8 == 0) { + if (D_80127188 != 0 && temp->original.unk1D8 == 0) { func_800A47A0(temp, arg2); } @@ -298,7 +298,7 @@ GLOBAL_ASM("asm/non_matchings/game_ui/func_800A1248.s") void func_800A1428(s32 arg0, Object *arg1, s32 arg2) { Object_64 *temp = arg1->unk64; - if (temp->unk1D8 == 0) { + if (temp->original.unk1D8 == 0) { func_80068508(1); func_800A3CE4(arg0, arg2); func_800A7520(arg1, arg2); diff --git a/src/object_functions.c b/src/object_functions.c index 047d74f5..01d223d9 100644 --- a/src/object_functions.c +++ b/src/object_functions.c @@ -341,11 +341,11 @@ void obj_init_lasergun(Object *obj, LevelObjectEntry_Lasergun *entry) { obj->unk4C->unk14 = 0x22; obj->unk4C->unk11 = 0; obj64 = obj->unk64; - obj64->unkE = entry->unkA; - obj64->unkF = entry->unkB; - obj64->unk10 = entry->unkC; - obj64->unk11 = entry->unkD; - obj64->unkCD.half = obj64->unkF; + obj64->original.unkE = entry->unkA; + obj64->original.unkF = entry->unkB; + obj64->original.unk10 = entry->unkC; + obj64->original.unk11 = entry->unkD; + obj64->original.unkCD.half = obj64->original.unkF; obj->segment.trans.y_rotation = entry->unk8 << 4 << 4; // Not sure about the shift amounts here, but it obj->segment.trans.x_rotation = entry->unk9 << 4 << 4; // just needs to be 2 left shifts that add up to 8. } @@ -366,19 +366,13 @@ typedef struct Object_7C_80034860 { s16 unkC; } Object_7C_80034860; -typedef struct Object_64_80034860 { - s16 unk0; - u8 unk4[0x185]; - s8 unk187; -} Object_64_80034860; - void obj_loop_laserbolt(Object *obj, s32 speed) { f32 sp5C; Object *obj4C_obj; Object_7C_80034860 *obj7C; - Object_64_80034860 *obj4C_obj64; + Object_80034860 *obj4C_obj64; s8 sp4F; // Boolean s8 sp4E; @@ -422,7 +416,7 @@ void obj_loop_laserbolt(Object *obj, s32 speed) { if (obj->unk4C->unk13 < 80) { obj4C_obj = (Object*)obj->unk4C->unk0; if (obj4C_obj && (obj4C_obj->behaviorId == 1)) { - obj4C_obj64 = obj4C_obj->unk64; + obj4C_obj64 = &obj4C_obj->unk64->obj80034860; sp4F = TRUE; if (obj4C_obj64->unk0 != -1) { obj4C_obj64->unk187 = 1; @@ -468,7 +462,7 @@ Object **get_object_struct_array(s32 *count); void obj_loop_effectbox(Object *obj, s32 speed) { Object **objList; Object_3C_80034B74 *obj3C; - Object_64_80034B74 *curObj64; + Object_80034B74 *curObj64; s32 i; s32 numberOfObjects; f32 xDiff; @@ -553,11 +547,6 @@ void play_sound(u8 arg0); void set_music_fade_timer(s32 time); void set_sndfx_player_voice_limit(u8 voiceLimit); -typedef struct Object_64_80034E9C { - s32 unk0; - s16 unk4; -} Object_64_80034E9C; - typedef struct Object_54_80034E9C { u8 pad0[0x28]; f32 unk28; @@ -573,7 +562,7 @@ void obj_loop_trophycab(Object *obj, s32 speed) { unk80027FC4 sp44; Settings *settings; LevelHeader *curLevelHeader; - Object_64_80034E9C *obj64; + Object_80034E9C *obj64; Object *trophyObj; Object *playerObj; f32 xDiff; @@ -582,7 +571,7 @@ void obj_loop_trophycab(Object *obj, s32 speed) { settings = get_settings(); curLevelHeader = get_current_level_header(); - obj64 = obj->unk64; + obj64 = &obj->unk64->obj80034E9C; // Show trophy inside the cabinet if (obj->unk7C.word == 0) { @@ -720,7 +709,7 @@ void obj_loop_eggcreator(Object *obj, UNUSED s32 speed) { sp20.unk0 = 0x34; someObj = spawn_object(&sp20, 1); if (someObj != NULL) { - Object_64_8003564C *someObj64 = someObj->unk64; + Object_8003564C *someObj64 = &someObj->unk64->obj8003564C; someObj64->unk4 = obj; obj->unk78 = someObj; someObj->segment.unk3C_a.unk3C = 0; @@ -791,7 +780,7 @@ void obj_init_airzippers_waterzippers(Object *obj, LevelObjectEntry_AirZippers_W void obj_loop_airzippers_waterzippers(Object *obj, UNUSED s32 speed) { Object *curRacerObj; - Object_64_Racer *racerObj64; + Object_Racer *racerObj64; f32 xDiff; f32 yDiff; f32 zDiff; @@ -808,7 +797,7 @@ void obj_loop_airzippers_waterzippers(Object *obj, UNUSED s32 speed) { racerObjs = get_object_struct_array(&numObjects); for (i = 0; i < numObjects; i++) { curRacerObj = racerObjs[i]; - racerObj64 = (Object_64_Racer*)curRacerObj->unk64; + racerObj64 = &curRacerObj->unk64->racer; if ((racerObj64->unk1F5 == 0) && (racerObj64->unk1D3 < 15)) { xDiff = curRacerObj->segment.trans.x_position - obj->segment.trans.x_position; yDiff = curRacerObj->segment.trans.y_position - obj->segment.trans.y_position; @@ -858,7 +847,7 @@ void obj_init_groundzipper(Object *arg0, LevelObjectEntry_GroundZipper *entry) { void obj_loop_groundzipper(Object *obj, UNUSED s32 speed) { Object *curRacerObj; - Object_64_Racer *racerObj64; + Object_Racer *racerObj64; f32 xDiff; f32 yDiff; s32 numObjects; @@ -873,7 +862,7 @@ void obj_loop_groundzipper(Object *obj, UNUSED s32 speed) { racerObjs = get_object_struct_array(&numObjects); for (i = 0; i < numObjects; i++) { curRacerObj = racerObjs[i]; - racerObj64 = (Object_64_Racer*)curRacerObj->unk64; + racerObj64 = &curRacerObj->unk64->racer; if ((racerObj64->unk1D3 < 15) && (racerObj64->unk1E2 != 0)) { xDiff = curRacerObj->segment.trans.x_position - obj->segment.trans.x_position; yDiff = curRacerObj->segment.trans.y_position - obj->segment.trans.y_position; @@ -904,7 +893,7 @@ void obj_init_unknown58(Object *obj, LevelObjectEntry_Unknown58 *entry) { void obj_loop_unknown58(Object *obj, s32 speed) { Object *someObj; Object *someOtherObj; - Object_64_80035E34 *someOtherObj64; + Object_80035E34 *someOtherObj64; Object_60 *obj60; obj->segment.unk3B = 0; @@ -915,7 +904,7 @@ void obj_loop_unknown58(Object *obj, s32 speed) { set_ghost_position_and_rotation(obj); func_800AFC3C(obj, speed); someOtherObj = get_object_struct(0); - someOtherObj64 = someOtherObj->unk64; + someOtherObj64 = &someOtherObj->unk64->obj80035E34; obj60 = obj->unk60; if (obj60->unk0 == 1) { s8 temp = someOtherObj64->unk1D6; @@ -945,14 +934,14 @@ void obj_loop_characterflag(Object *obj, UNUSED s32 speed) { s32 temp_t4; s32 temp_t5; Object *someObj; - Object_64_80035F6C *obj64; - Object_64_80035F6C_2 *someObj64; + Object_80035F6C *obj64; + Object_80035F6C_2 *someObj64; if (obj->unk7C.word < 0) { someObj = get_object_struct(obj->unk78); if (someObj != NULL) { - obj64 = obj->unk64; - someObj64 = someObj->unk64; + obj64 = &obj->unk64->obj80035F6C; + someObj64 = &someObj->unk64->obj80035F6C_2; obj->unk7C.word = someObj64->unk3; if (obj->unk7C.word < 0 || obj->unk7C.word >= 0xA) { obj->unk7C.word = 0; @@ -982,8 +971,8 @@ void obj_init_stopwatchman(Object *obj, UNUSED LevelObjectEntry_StopWatchMan *en obj->unk4C->unk10 = 0x1E; obj->unk4C->unk12 = 0; temp = obj->unk64; - temp->unkCD.bytes.byteD = 0xFF; - temp->unk0_a.unk0 = 0.0f; + temp->original.unkCD.bytes.byteD = 0xFF; + temp->original.unk0_a.unk0 = 0.0f; D_8011D4D8 = 0; } @@ -1026,7 +1015,7 @@ void obj_init_posarrow(Object *obj, UNUSED LevelObjectEntry_PosArrow *entry) { } void obj_loop_posarrow(Object *obj, UNUSED s32 speed) { - Object_64_PosArrow *someObj64; + Object_PosArrow *someObj64; Object **someObjList; Object *someObj; s32 numberOfObjects; @@ -1035,7 +1024,7 @@ void obj_loop_posarrow(Object *obj, UNUSED s32 speed) { someObjList = func_8001BAAC(&numberOfObjects); if (obj->unk78 < numberOfObjects) { someObj = someObjList[obj->unk78]; - someObj64 = someObj->unk64; + someObj64 = &someObj->unk64->pos_arrow; if (someObj64->unk0 == -1) { obj->segment.trans.unk6 &= ~0x4000; someObj64->unk150 = obj; @@ -1045,11 +1034,11 @@ void obj_loop_posarrow(Object *obj, UNUSED s32 speed) { } void obj_init_animator(Object *obj, LevelObjectEntry_Animator *entry, s32 arg2) { - Object_64_800376E0 *obj64; + Object_800376E0 *obj64; LevelModel *levelModel; s16 segmentBatchCount; - obj64 = obj->unk64; + obj64 = &obj->unk64->obj800376E0; levelModel = func_8002C7C4(); obj64->unk2 = entry->unk8; obj64->unk4 = entry->unk9; @@ -1073,21 +1062,12 @@ void obj_init_animator(Object *obj, LevelObjectEntry_Animator *entry, s32 arg2) #ifdef NON_EQUIVALENT -typedef struct Object_64_Animator { - /* 0x00 */ s16 segmentId; - /* 0x02 */ s16 batchId; - /* 0x04 */ s16 xSpeedFactor; - /* 0x06 */ s16 ySpeedFactor; - /* 0x08 */ s16 xSpeed; - /* 0x0A */ s16 ySpeed; -} Object_64_Animator; - #define TEX_INDEX_NO_TEXTURE 255 // Has minor issues void obj_loop_animator(Object* obj, s32 speed) { - Object_64_Animator* obj64; // 3C + Object_Animator* obj64; // 3C s32 sp20; s32 sp1C; LevelModel* levelModel; @@ -1104,7 +1084,7 @@ void obj_loop_animator(Object* obj, s32 speed) { TextureHeader *tex; s32 maxSpeed; - obj64 = (Object_64_Animator*)obj->unk64; + obj64 = &obj->unk64->animator; temp = obj64->xSpeedFactor * speed; obj64->xSpeed += temp << 4; @@ -1312,7 +1292,7 @@ void obj_init_snowball(Object *obj, UNUSED LevelObjectEntry_Snowball *entry) { } void obj_loop_snowball(Object *obj, s32 speed) { - Object_64_Snowball *obj64 = obj->unk64; + Object_Snowball *obj64 = &obj->unk64->snowball; if (obj64->unk24 == 0) { if (obj64->unk38 != 0) { obj64->unk24 = (s16)(obj64->unk38 & 0xFF); @@ -1336,11 +1316,11 @@ GLOBAL_ASM("asm/non_matchings/unknown_032760/obj_loop_char_select.s") void obj_loop_animcamera(Object *obj, s32 speed) { s32 temp_v0; s32 phi_v1; - Object_64_80038710 *obj64; + Object_80038710 *obj64; temp_v0 = func_8001F460(obj, speed, obj); obj->segment.trans.unk6 |= 0x4000; - obj64 = obj->unk64; + obj64 = &obj->unk64->obj80038710; if (temp_v0 == 0) { if (get_viewport_count() == VIEWPORTS_COUNT_1_PLAYER) { phi_v1 = func_800210CC(obj64->unk44); @@ -1367,7 +1347,7 @@ void obj_loop_animcar(Object *obj, s32 speed) { obj->unk7C.word = func_8001F460(obj, speed, obj); obj->segment.trans.unk6 |= 0x4000; if (obj->unk7C.word == 0 && someObj != NULL) { - Object_64_800387CC *someObj64 = someObj->unk64; + Object_800387CC *someObj64 = &someObj->unk64->obj800387CC; someObj64->unk148 = obj; } } @@ -1401,7 +1381,7 @@ void obj_loop_infopoint(Object *obj, UNUSED s32 speed) { if (obj4C->unk13 < ((obj->unk78 >> 16) & 0xFF)) { playerObj = obj4C->unk0; if (playerObj->segment.header->behaviorId == 1) { - Object_64_800388D4 *playerObj64 = playerObj->unk64; + Object_800388D4 *playerObj64 = &playerObj->unk64->obj800388D4; temp_a0 = playerObj64->unk0; if ((temp_a0 != -1) && (get_buttons_pressed_from_player(temp_a0) & Z_TRIG)) { func_800C31EC(obj->unk78 & 0xFF); @@ -1497,12 +1477,12 @@ void obj_loop_teleport(Object *obj, UNUSED s32 speed) { void obj_init_exit(Object *obj, LevelObjectEntry_Exit *entry) { f32 phi_f0; - Object_64_80038E3C *obj64; + Object_80038E3C *obj64; phi_f0 = entry->unk10 & 0xFF; if (phi_f0 < 5) { phi_f0 = 5; } - obj64 = obj->unk64; + obj64 = &obj->unk64->obj80038E3C; phi_f0 /= 128; obj->segment.trans.scale = phi_f0; obj->segment.trans.y_rotation = entry->unk11 << 6 << 4; @@ -1520,20 +1500,20 @@ void obj_init_exit(Object *obj, LevelObjectEntry_Exit *entry) { void obj_loop_exit(Object *obj, UNUSED s32 speed) { Object *racerObj; - Object_64_Racer *racerObj64; + Object_Racer *racerObj64; s32 numberOfRacers; Settings *settings; f32 xDiff; f32 zDiff; f32 dist; f32 yDiff; - Object_64_Exit *obj64; + Object_Exit *obj64; s32 someBool; Object** racerObjects; s32 i; f32 temp; - obj64 = (Object_64_Exit*)obj->unk64; + obj64 = &obj->unk64->exit; someBool = TRUE; settings = get_settings(); if ((obj64->unk14 == 0) && (settings->balloonsPtr[settings->worldId] == 8)) { @@ -1548,7 +1528,7 @@ void obj_loop_exit(Object *obj, UNUSED s32 speed) { racerObjects = get_object_struct_array(&numberOfRacers); for (i = 0; i < numberOfRacers; i++) { racerObj = racerObjects[i]; - racerObj64 = (Object_64_Racer*)racerObj->unk64; + racerObj64 = &racerObj->unk64->racer; if ((racerObj64->unk0 != -1) && (racerObj64->unk108 == 0)) { xDiff = racerObj->segment.trans.x_position - obj->segment.trans.x_position; yDiff = racerObj->segment.trans.y_position - obj->segment.trans.y_position; @@ -1619,12 +1599,12 @@ void obj_init_parkwarden(Object *obj, UNUSED LevelObjectEntry_Parkwarden *entry) obj->unk4C->unk10 = (u8)0x1E; obj->unk4C->unk12 = (u8)0; temp = obj->unk64; - temp->unkCD.bytes.byteD = 0xFF; - temp->unk0_a.unk0 = 0.0f; - temp->unk28 = 0; - temp->unk2C = 0; - temp->unk34 = 0; - temp->unk36 = 0; + temp->original.unkCD.bytes.byteD = 0xFF; + temp->original.unk0_a.unk0 = 0.0f; + temp->original.unk28 = 0; + temp->original.unk2C = 0; + temp->original.unk34 = 0; + temp->original.unk36 = 0; D_8011D4D4 = 0; D_8011D4E2 = 0x10F; } @@ -1668,12 +1648,12 @@ void obj_loop_checkpoint(UNUSED Object *obj, UNUSED s32 speed) { void obj_init_modechange(Object *obj, LevelObjectEntry_ModeChange *entry) { f32 phi_f0; - Object_64_ModeChange *obj64; + Object_ModeChange *obj64; phi_f0 = entry->unk8 & 0xFF; if (phi_f0 < 5) { phi_f0 = 5; } - obj64 = obj->unk64; + obj64 = &obj->unk64->mode_change; phi_f0 /= 128; obj->segment.trans.scale = phi_f0; obj->segment.trans.y_rotation = entry->unk9 << 6 << 4; @@ -1693,12 +1673,12 @@ GLOBAL_ASM("asm/non_matchings/unknown_032760/obj_loop_modechange.s") void obj_init_bonus(Object *obj, LevelObjectEntry_Bonus *entry) { f32 phi_f0; - Object_64_Bonus *obj64; + Object_Bonus *obj64; phi_f0 = entry->unk8 & 0xFF; if (phi_f0 < 5) { phi_f0 = 5; } - obj64 = obj->unk64; + obj64 = &obj->unk64->bonus; phi_f0 /= 128; obj->segment.trans.scale = phi_f0; obj->segment.trans.y_rotation = entry->unk9 << 6 << 4; @@ -1716,25 +1696,25 @@ void obj_init_bonus(Object *obj, LevelObjectEntry_Bonus *entry) { void obj_loop_bonus(Object *obj, UNUSED s32 speed) { Object *racerObj; - Object_64_Racer *racerObj64; + Object_Racer *racerObj64; s32 numberOfRacers; f32 xDiff; f32 yDiff; f32 halfDist; f32 dist; f32 zDiff; - Object_64_Bonus *obj64; + Object_Bonus *obj64; Object **racerObjects; s32 i; - obj64 = (Object_64_Bonus *)obj->unk64; + obj64 = &obj->unk64->bonus; if (obj->unk4C->unk13 < obj64->unk10) { dist = obj64->unk10; halfDist = dist * 0.5; racerObjects = get_object_struct_array(&numberOfRacers); for (i = 0; i < numberOfRacers; i++) { racerObj = racerObjects[i]; - racerObj64 = (Object_64_Racer *)racerObj->unk64; + racerObj64 = &racerObj->unk64->racer; yDiff = racerObj->segment.trans.y_position - obj->segment.trans.y_position; if ((yDiff < halfDist) && (-halfDist < yDiff)) { xDiff = racerObj->segment.trans.x_position - obj->segment.trans.x_position; @@ -1754,7 +1734,7 @@ void obj_loop_bonus(Object *obj, UNUSED s32 speed) { } } void obj_init_goldenballoon(Object *obj, LevelObjectEntry_GoldenBalloon *entry) { - Object_64_GoldenBalloon *obj64; + Object_GoldenBalloon *obj64; f32 scalef; if (entry->unk8 == -1) { @@ -1775,7 +1755,7 @@ void obj_init_goldenballoon(Object *obj, LevelObjectEntry_GoldenBalloon *entry) } scalef /= 64; obj->segment.trans.scale = obj->segment.header->scale * scalef; - obj64 = obj->unk64; + obj64 = &obj->unk64->golden_balloon; obj64->unkD = 255; obj64->unk0 = 0.0f; obj->unk78 = 0; @@ -1797,7 +1777,7 @@ void obj_loop_goldenballoon(Object *obj, s32 speed) { s32 padding[1]; Object_3C *obj3C; Object_4C *obj4C; - Object_64_GoldenBalloon *obj64; + Object_GoldenBalloon *obj64; Settings *settings; s32 flag; s32 doubleSpeed; @@ -1839,7 +1819,7 @@ void obj_loop_goldenballoon(Object *obj, s32 speed) { obj4C = obj->unk4C; if ((obj4C->unk13 < 45) && (someBool == FALSE)) { racerObj = obj4C->unk0; - if (racerObj && (racerObj->segment.header->behaviorId == 1) && (((Object_64_Racer *)racerObj->unk64)->unk0 == 0)) { + if (racerObj && (racerObj->segment.header->behaviorId == 1) && (racerObj->unk64->racer->unk0 == 0)) { settings->balloonsPtr[settings->worldId]++; if (settings->worldId != 0) { settings->balloonsPtr[0]++; @@ -1852,7 +1832,7 @@ void obj_loop_goldenballoon(Object *obj, s32 speed) { func_800AFC3C(obj, speed); } } - obj64 = (Object_64_GoldenBalloon *)obj->unk64; + obj64 = obj->unk64->golden_balloon; obj->segment.unk3B = 0; obj64->unk14 = 0.0f; if (obj->segment.unk38.half.lower < 255) { @@ -1881,10 +1861,10 @@ GLOBAL_ASM("asm/non_matchings/unknown_032760/obj_loop_goldenballoon.s") #endif void obj_init_door(Object *obj, LevelObjectEntry_Door *entry) { - Object_64_Door *obj64; + Object_Door *obj64; f32 phi_f0; - obj64 = (Object_64_Door *)obj->unk64; + obj64 = &obj->unk64->door; if (entry->unkC == -1) { entry->unkC = func_8000CC20(obj); } else { @@ -1925,11 +1905,11 @@ GLOBAL_ASM("asm/non_matchings/unknown_032760/obj_loop_door.s") void obj_init_ttdoor(Object *obj, LevelObjectEntry_TTDoor *entry) { f32 temp_f0; - Object_64_8003C1E0 *obj64; + Object_8003C1E0 *obj64; f32 phi_f0; obj->segment.unk3A = 0; - obj64 = obj->unk64; + obj64 = &obj->unk64->obj8003C1E0; obj->segment.trans.y_rotation = entry->unk8 << 6 << 4; obj64->unkF = entry->unkE; obj64->unk13 = entry->unkB; @@ -1957,7 +1937,7 @@ GLOBAL_ASM("asm/non_matchings/unknown_032760/obj_loop_ttdoor.s") void obj_init_trigger(Object *obj, LevelObjectEntry_Trigger *entry) { f32 phi_f0; - Object_64_Trigger *obj64; + Object_Trigger *obj64; if (entry->unk9 == -1) { entry->unk9 = func_8000CC20(obj); @@ -1971,7 +1951,7 @@ void obj_init_trigger(Object *obj, LevelObjectEntry_Trigger *entry) { if (phi_f0 < 5.0f) { phi_f0 = 5.0f; } - obj64 = (Object_64_Trigger*)obj->unk64; + obj64 = &obj->unk64->trigger; phi_f0 /= 128; obj->segment.trans.scale = phi_f0; obj->segment.trans.y_rotation = entry->rotation << 6 << 4; @@ -1994,12 +1974,12 @@ void obj_init_bridge_whaleramp(Object *obj, LevelObjectEntry_Bridge_WhaleRamp *e Object_64 *temp = obj->unk64; obj->segment.unk3A = entry->unk8; obj->segment.trans.y_rotation = entry->unk9 << 6 << 4; - temp->unk0_a.unk0 = obj->segment.trans.y_position; + temp->original.unk0_a.unk0 = obj->segment.trans.y_position; obj->unk4C->unk14 = 0x21; obj->unk4C->unk11 = 2; obj->unk4C->unk10 = 0x14; obj->unk4C->unk12 = 0; - temp->unk4 = 0; + temp->original.unk4 = 0; if (obj->segment.unk3A >= obj->segment.header->numberOfModelIds) { obj->segment.unk3A = 0; } @@ -2079,7 +2059,7 @@ void obj_init_bananacreator(Object *obj, UNUSED LevelObjectEntry_BananaCreator * void obj_loop_bananacreator(Object *obj, s32 speed) { LevelObjectEntryCommon newEntry; Object *newBananaObj; - Object_64_Banana *newBananaObj64; + Object_Banana *newBananaObj64; if (obj->unk7C.word != 0) { obj->unk78 -= speed; @@ -2095,7 +2075,7 @@ void obj_loop_bananacreator(Object *obj, s32 speed) { obj->unk7C.word = 1; if (newBananaObj) { newBananaObj->segment.unk3C_a.unk3C = 0; - newBananaObj64 = (Object_64_Banana *) newBananaObj->unk64; + newBananaObj64 = &newBananaObj->unk64->banana; newBananaObj64->spawner = obj; func_8003FC44(obj->segment.trans.x_position, obj->segment.trans.y_position - 14.0f, obj->segment.trans.z_position, 44, 34, 0.25f, 0); obj->unk7C.word = 0; @@ -2187,7 +2167,7 @@ void obj_loop_worldkey(Object *worldKeyObj, s32 speed) { playerObj = worldKeyObj->unk4C->unk0; if (playerObj != NULL) { if (playerObj->segment.header->behaviorId == 1) { // Is the player a racer? - Object_64_8003DF08 *obj64 = playerObj->unk64; + Object_8003DF08 *obj64 = &playerObj->unk64->obj8003DF08; if (obj64->unk0 != -1) { // Player has grabbed the key! play_sound(SOUND_WORLD_KEY_GRAB); @@ -2203,15 +2183,9 @@ void obj_loop_worldkey(Object *worldKeyObj, s32 speed) { worldKeyObj->segment.trans.y_rotation += speed * 256; } -typedef struct Object_64_8003DFCC { - f32 unk0; - s16 unk4; - s8 unk6[0x2]; -} Object_64_8003DFCC; - void obj_init_weaponballoon(Object *obj, LevelObjectEntry_WeaponBalloon *entry) { s32 cheats; - Object_64_8003DFCC *obj64; + Object_8003DFCC *obj64; f32 scalef; obj->unk4C->unk14 = 2; @@ -2250,7 +2224,7 @@ void obj_init_weaponballoon(Object *obj, LevelObjectEntry_WeaponBalloon *entry) } scalef /= 64; - obj64 = (Object_64_8003DFCC*)obj->unk64; + obj64 = &obj->unk64->obj8003DFCC; obj->segment.trans.scale = obj->segment.header->scale * scalef; obj64->unk0 = obj->segment.trans.scale; @@ -2281,7 +2255,7 @@ void obj_init_weapon(Object *obj, UNUSED LevelObjectEntry_Weapon *entry) { void obj_loop_weapon(Object *obj, s32 speed) { Object_64 *obj64 = obj->unk64; - switch (obj64->unk18) { + switch (obj64->original.unk18) { case 0: case 1: func_8003E694(obj, speed); @@ -2340,9 +2314,9 @@ GLOBAL_ASM("asm/non_matchings/unknown_032760/func_8003FC44.s") #endif void obj_init_audio(Object *obj, LevelObjectEntry_Audio *entry) { - Object_64_Audio *obj64; + Object_Audio *obj64; - obj64 = (Object_64_Audio*)obj->unk64; + obj64 = &obj->unk64->audio; obj64->unk0 = entry->unk8; obj64->unk2 = entry->unkA; obj64->unkC = entry->unkF; @@ -2364,9 +2338,9 @@ void obj_init_audio(Object *obj, LevelObjectEntry_Audio *entry) { } void obj_init_audioline(Object *obj, LevelObjectEntry_AudioLine *entry) { - Object_64_8003FEF4 *obj64; + Object_8003FEF4 *obj64; - obj64 = obj->unk64; + obj64 = &obj->unk64->obj8003FEF4; obj64->unk0 = entry->unk8; obj64->unk2 = entry->unkA; obj64->unkC = entry->unkC; @@ -2386,7 +2360,7 @@ void obj_init_audioline(Object *obj, LevelObjectEntry_AudioLine *entry) { void obj_init_audioreverb(Object *obj, LevelObjectEntry_AudioReverb *entry) { s32 temp; - Object_64_8004001C *obj64 = (Object_64_8004001C *)obj->unk64; + Object_8004001C *obj64 = &obj->unk64->obj8004001C; obj64->unk2 = entry->unk8; temp = entry->unk9; obj64->unk4 = temp & 0xFF; @@ -2396,11 +2370,11 @@ void obj_init_audioreverb(Object *obj, LevelObjectEntry_AudioReverb *entry) { } void obj_init_texscroll(Object *obj, LevelObjectEntry_TexScroll *entry, s32 arg2) { - Object_64_800400A4 *obj64; + Object_800400A4 *obj64; LevelModel *levelModel; s16 numberOfTexturesInLevel; - obj64 = obj->unk64; + obj64 = &obj->unk64->obj800400A4; levelModel = func_8002C7C4(); obj64->unk0 = entry->unk8; if (obj64->unk0 < 0) { @@ -2484,35 +2458,35 @@ typedef struct Object_3C_Weather { // Has stack & regalloc issues. void obj_loop_weather(Object *obj, s32 speed) { - s32 sp54; - s32 numberOfObjects; - Object_64_Racer *curObj64; - Object **objects; - Object **lastObj; - Object *curObj; - Object_3C_Weather *obj3c; - f32 temp_f0; - f32 new_var; - f32 temp_f2; - s32 i; - s32 temp[3]; - sp54 = func_80066220(); - objects = get_object_struct_array(&numberOfObjects); - if (numberOfObjects != 0) { - lastObj = &objects[numberOfObjects - 1]; - objects--; - do { - curObj = objects[1]; - curObj64 = (Object_64_Racer *) curObj->unk64; - } while (((++objects) < lastObj) && (sp54 != curObj64->unk0)); - temp_f0 = obj->segment.trans.x_position - curObj->segment.trans.x_position; - temp_f2 = obj->segment.trans.z_position - curObj->segment.trans.z_position; - new_var = obj->unk78f; - obj3c = obj->segment.unk3C_a.unk3C; - if (((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) <= (new_var * 1.0f)){ - func_800ABC5C(obj3c->unkA * 256, obj3c->unkC * 256, obj3c->unkE * 256, obj3c->unk10 * 257, obj3c->unk11 * 257, (s32) obj3c->unk12); + s32 sp54; + s32 numberOfObjects; + Object_Racer *curObj64; + Object **objects; + Object **lastObj; + Object *curObj; + Object_3C_Weather *obj3c; + f32 temp_f0; + f32 new_var; + f32 temp_f2; + s32 i; + s32 temp[3]; + sp54 = func_80066220(); + objects = get_object_struct_array(&numberOfObjects); + if (numberOfObjects != 0) { + lastObj = &objects[numberOfObjects - 1]; + objects--; + do { + curObj = objects[1]; + curObj64 = &curObj->unk64->racer; + } while (((++objects) < lastObj) && (sp54 != curObj64->unk0)); + temp_f0 = obj->segment.trans.x_position - curObj->segment.trans.x_position; + temp_f2 = obj->segment.trans.z_position - curObj->segment.trans.z_position; + new_var = obj->unk78f; + obj3c = obj->segment.unk3C_a.unk3C; + if (((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) <= (new_var * 1.0f)){ + func_800ABC5C(obj3c->unkA * 256, obj3c->unkC * 256, obj3c->unkE * 256, obj3c->unk10 * 257, obj3c->unk11 * 257, (s32) obj3c->unk12); + } } - } } #else @@ -2535,26 +2509,12 @@ void obj_init_wavegenerator(Object *obj, UNUSED LevelObjectEntry_WaveGenerator * #ifdef NON_EQUIVALENT -typedef struct Object_64_Butterfly { -/* 0x00 */ Triangle triangles[8]; -/* 0x80 */ Vertex vertices[12]; -/* 0xF8 */ TextureHeader *texture; -/* 0xFC */ u8 unkFC; -/* 0xFD */ u8 unkFD; -/* 0xFE */ u8 unkFE; -/* 0xFF */ u8 unkFF; -/* 0x100 */ s32 unk100; -/* 0x104 */ s16 unk104; -/* 0x106 */ s16 unk106; -/* 0x108 */ f32 unk108; -} Object_64_Butterfly; - void obj_init_butterfly(Object *obj, LevelObjectEntry_Butterfly *entry, s32 arg2) { - Object_64_Butterfly *obj64; + Object_Butterfly *obj64; s32 i, j; s32 uMask, vMask; - obj64 = (Object_64_Butterfly*)obj->unk64; + obj64 = &obj->unk64->butterfly; if (arg2 == 0) { obj->segment.y_velocity = 0.0f; obj64->unkFE = 0; @@ -2624,7 +2584,7 @@ GLOBAL_ASM("asm/non_matchings/unknown_032760/obj_loop_butterfly.s") GLOBAL_ASM("asm/non_matchings/unknown_032760/obj_init_midifade.s") void obj_init_midifadepoint(Object *obj, LevelObjectEntry_MidiFadePoint *entry) { - Object_64_MidiFadePoint *obj64; + Object_MidiFadePoint *obj64; ObjectModel **models; ObjectModel *objModel; Vertex *vertex; @@ -2634,7 +2594,7 @@ void obj_init_midifadepoint(Object *obj, LevelObjectEntry_MidiFadePoint *entry) f32 z; f32 dist; - obj64 = (LevelObjectEntry_MidiFadePoint *) obj->unk64; + obj64 = &obj->unk64->midi_fade_point; obj64->unk2 = entry->unkA; obj64->unk0 = entry->unk8; obj64->unk1C = entry->unk1C; @@ -2713,9 +2673,9 @@ void obj_loop_rangetrigger(Object *obj, s32 speed) { } void obj_init_frog(Object *obj, LevelObjectEntry_Frog *entry) { - Object_64_80042210 *obj64; + Object_80042210 *obj64; - obj64 = (Object_64_80042210 *)obj->unk64; + obj64 = &obj->unk64->obj80042210; obj64->unk15 = entry->unkA; obj64->unk0 = obj->segment.trans.x_position; obj64->unk4 = obj->segment.trans.y_position; @@ -2755,9 +2715,9 @@ void obj_loop_pigrocketeer(Object *obj, s32 speed) { obj64 = someObj->unk64; someObj->unk78 = 0; if (obj64 != 0) { - obj64->unk72 += speed; - obj64->unk70 = 2; - obj64->unk74 = 1.0f; + obj64->original.unk72 += speed; + obj64->original.unk70 = 2; + obj64->original.unk74 = 1.0f; func_8000B750(obj, -1, 2, 1, 1); } } diff --git a/src/object_functions.h b/src/object_functions.h index b7e0c664..6d279628 100644 --- a/src/object_functions.h +++ b/src/object_functions.h @@ -35,12 +35,6 @@ typedef struct Object_3C_80034B74 { u8 unkD; } Object_3C_80034B74; -typedef struct Object_64_80034B74 { - u8 pad0[0x1FE]; - u8 unk1FE; - u8 unk1FF; -} Object_64_80034B74; - typedef struct unk8003564C { s8 unk0; s8 unk1; @@ -49,11 +43,6 @@ typedef struct unk8003564C { s16 unk6; } unk8003564C; -typedef struct Object_64_8003564C { - u8 pad0[4]; - Object *unk4; -} Object_64_8003564C; - typedef struct unk80035E20 { u8 pad0[0x40]; s32 unk40; @@ -62,29 +51,6 @@ typedef struct unk80035E20 { s32 unk7C; } unk80035E20; -typedef struct Object_64_80035E34 { - u8 pad0[0x1D6]; - s8 unk1D6; -} Object_64_80035E34; - -typedef struct Object_64_80035F6C { - s32 unk0; - s32 unk4; - s32 unk8; - s32 unkC; - s32 unk10; - s32 unk14; - s32 unk18; - s32 unk1C; - s16 *unk20; - u8 *unk24; -} Object_64_80035F6C; - -typedef struct Object_64_80035F6C_2 { - u8 pad0[3]; - s8 unk3; -} Object_64_80035F6C_2; - typedef struct unk80037578 { u8 pad0[0x78]; s32 unk78; @@ -104,15 +70,6 @@ typedef struct LevelObjectEntry800376E0 { s8 unkA; } LevelObjectEntry800376E0; -typedef struct Object_64_800376E0 { - s16 segmentId; - s16 unk2; - s16 unk4; - s16 unk6; - s16 unk8; - s16 unkA; -} Object_64_800376E0; - typedef struct unk80037D08_arg0_64 { u8 pad0[0x2A]; s16 unk2A; @@ -131,30 +88,6 @@ typedef struct Object_60_800380F8 { Object *unkC; } Object_60_800380F8; -typedef struct Object_64_Snowball { - u8 pad0[0x20]; - u32 unk20; - s16 unk24; - u8 pad28[0x12]; - s8 unk38; -} Object_64_Snowball; - -typedef struct Object_64_80038710 { - u8 pad0[0x30]; - s8 unk30; - u8 pad31[0x13]; - s8 unk44; -} Object_64_80038710; - -typedef struct Object_64_800387CC { - u8 pad0[0x148]; - Object *unk148; -} Object_64_800387CC; - -typedef struct Object_64_800388D4 { - s16 unk0; -} Object_64_800388D4; - typedef struct unk80038B74 { u8 pad0[8]; s8 unk8; @@ -165,15 +98,6 @@ typedef struct Object_3C_80038DC4 { s8 unk8; } Object_3C_80038DC4; -typedef struct Object_64_80038E3C { - f32 unk0; - f32 unk4; - f32 unk8; - f32 unkC; - s32 unk10; - s8 unk14; -} Object_64_80038E3C; - typedef struct unk80039160 { u8 pad0[0x78]; s32 unk78; @@ -186,17 +110,6 @@ typedef struct unk80039190 { s32 unk7C; } unk80039190; -typedef struct Object_64_8003C1E0 { - f32 unk0; - u8 pad4[4]; - s32 unk8; - u8 padC[3]; - s8 unkF; - u8 pad10[2]; - u8 unk12; - u8 unk13; -} Object_64_8003C1E0; - typedef struct unk8003CF18 { u8 pad1A[0x78]; f32 unk78; @@ -214,10 +127,6 @@ typedef struct unk8003D3EC { u16 unk18; } unk8003D3EC; -typedef struct Object_64_8003DF08 { - s16 unk0; -} Object_64_8003DF08; - typedef struct unk8003FC44 { s8 unk0; s8 unk1; @@ -227,31 +136,6 @@ typedef struct unk8003FC44 { s8 unk7; } unk8003FC44; - -typedef struct Object_64_8003FEF4 { - u8 unk0; - u8 pad1; - u16 unk2; - u16 unk4; - u16 unk6; - union { - struct { - u8 unk8; - u8 unk9; - u8 unkA; - u8 padB; - } unk_struct; - s32 unk8_word; - } unk_union; - u8 unkC; - u8 unkD; - u8 unkE; - u8 unkF; - u8 unk10; - u8 unk11; - u8 unk12; -} Object_64_8003FEF4; - typedef struct LevelObjectEntry8003FEF4 { LevelObjectEntryCommon common; u8 unk8; @@ -273,22 +157,6 @@ typedef struct LevelObjectEntry8004001C { u8 unkA; } LevelObjectEntry8004001C; -typedef struct Object_64_8004001C { - u16 pad0; - s16 unk2; - u8 unk4; - u8 unk5; -} Object_64_8004001C; - -typedef struct Object_64_800400A4 { - s16 unk0; - s16 pad2; - s16 unk4; - s16 unk6; - s16 unk8; - s16 unkA; -} Object_64_800400A4; - typedef struct unk80040800 { u8 pad0[0x78]; f32 unk78; @@ -325,32 +193,6 @@ typedef struct Object_3C_80042178 { u16 unkA; } Object_3C_80042178; -typedef struct Object_64_80042210 { - f32 unk0; - f32 unk4; - f32 unk8; - f32 unkC; - f32 unk10; - u8 unk14; - u8 unk15; - u8 pad16[3]; - u8 unk19; - u8 pad1A[6]; - f32 unk20; - f32 unk24; - u8 pad28[8]; - f32 unk30; -} Object_64_80042210; - -typedef struct Object_64_80042998 { - u8 pad0[0x70]; - u8 unk70; - u8 pad71; - u8 unk72; - u8 pad73; - f32 unk74; -} Object_64_80042998; - typedef struct unk80042A1C { u8 pad0[0x78]; f32 unk78; @@ -369,128 +211,8 @@ typedef struct Object_50_Scenery { //void func_80072348(s16 obj, u8 arg1); -typedef struct Object_64_Exit { - f32 unk0; - f32 unk4; - f32 unk8; - f32 unkC; - s32 unk10; - s8 unk14; -} Object_64_Exit; - -typedef struct Object_64_Racer { - s16 unk0; - u8 pad2; - s8 unk3; - u8 pad4[0x104]; - s32 unk108; - u8 pad10C[0x40]; - Object *unk14C; - u8 pad150[0x33]; - s8 unk183; - s8 pad184; - s8 unk185; - u8 pad186[0x4D]; - s8 unk1D3; - u8 pad1D4[0x4]; - s8 unk1D8; - u8 pad1D9[0x9]; - s8 unk1E2; - u8 pad1E3[0x12]; - u8 unk1F5; - u8 pad1F6[0xA]; - s8 unk200; - u8 pad201[0x2]; - s8 unk203; - u8 pad204[0x8]; - u8 unk20C; -} Object_64_Racer; - -typedef struct Object_64_Bonus { - f32 unk0; - f32 unk4; - f32 unk8; - f32 unkC; - s32 unk10; - s8 unk14; -} Object_64_Bonus; - -typedef struct Object_64_ModeChange { - f32 unk0; - f32 unk4; - f32 unk8; - f32 unkC; - s32 unk10; - s8 unk14; -} Object_64_ModeChange; - -typedef struct Object_64_GoldenBalloon { - f32 unk0; - u8 pad4[0x8]; - u8 unkC; - u8 unkD; - u8 unkE; - u8 unkF; - s8 unk10; - f32 unk14; -} Object_64_GoldenBalloon; - -typedef struct Object_64_Door { - f32 unk0; - u8 pad4[0x4]; - s32 unk8; - s16 padA; - s8 unkE; - u8 unkF; - u8 unk10; - u8 unk11; - u8 unk12; - u8 unk13; - u8 unk14; -} Object_64_Door; - -typedef struct Object_64_Trigger { - f32 unk0; - f32 unk4; - f32 unk8; - f32 unkC; - s32 unk10; - s8 unk14; -} Object_64_Trigger; - typedef Object Object_64_Animation; -typedef struct Object_64_Audio { - /* 0x00 */ u16 unk0; - /* 0x02 */ u16 unk2; - /* 0x04 */ u8 unk4; - /* 0x05 */ u8 unk5; - /* 0x06 */ u8 unk6; - /* 0x07 */ u8 unk7; - /* 0x08 */ s32 unk8; - /* 0x0C */ u8 unkC; - /* 0x0D */ u8 unkD; -} Object_64_Audio; - -typedef struct Object_64_MidiFade { - u8 unk0; - u8 unk1; - u8 unk2; - f32 unk4; - f32 unk8; - f32 unkC; - f32 unk10; - f32 unk14; - f32 unk18; - f32 unk1C; - f32 unk20; - f32 unk24; - f32 unk28; - f32 unk2C; - u8 unk2F[16]; - u8 unk40; -} Object_64_MidiFade; - typedef struct unk80041A90_MidiFade { s16 unk0; // Y rotation s16 unk2; // X rotation @@ -501,26 +223,6 @@ typedef struct unk80041A90_MidiFade { f32 unk14; } unk80041A90_MidiFade; -typedef struct Object_64_MidiFadePoint { - u16 unk0; - u16 unk2; - f32 unk4; - f32 unk8; - u8 unkC[16]; - u8 unk1C; -} Object_64_MidiFadePoint; - -typedef struct Object_64_PosArrow { - s16 unk0; - u8 pad4[0x14E]; - Object *unk150; -} Object_64_PosArrow; - -typedef struct Object_64_Banana { - u8 pad0[4]; - Object *spawner; -} Object_64_Banana; - // Unsure about the signed/unsigned with these arrays. extern u16 D_800DC970[4]; extern u16 D_800DC978[4]; @@ -668,7 +370,7 @@ void obj_loop_goldenballoon(Object *obj, s32 speed); s32 func_8001C524(f32 x, f32 y, f32 z, s32 arg3); s32 func_8001CC48(s32, s32, s32); -void func_8001C6C4(Object_64_GoldenBalloon *obj64, Object *obj, f32, f32, s32); +void func_8001C6C4(Object_GoldenBalloon *obj64, Object *obj, f32, f32, s32); void func_8000CBF0(Object*, s32); diff --git a/src/objects.c b/src/objects.c index 97390c64..76997326 100644 --- a/src/objects.c +++ b/src/objects.c @@ -945,19 +945,19 @@ void func_80012E28(Object *this) { if (this->behaviorId == 1) { sp_20 = this->unk64; - this->segment.trans.y_rotation += sp_20->unk160; - this->segment.trans.x_rotation += sp_20->unk162; - this->segment.trans.z_rotation += sp_20->unk164; + this->segment.trans.y_rotation += sp_20->original.unk160; + this->segment.trans.x_rotation += sp_20->original.unk162; + this->segment.trans.z_rotation += sp_20->original.unk164; sp_1c = 0.0f; - if (sp_20->unk1D7 < 5) { + if (sp_20->original.unk1D7 < 5) { - sp_1c = func_800707F8(sp_20->unk164); + sp_1c = func_800707F8(sp_20->original.unk164); tmp_f2 = sp_1c; - tmp_f0 = func_800707F8(sp_20->unk162 - sp_20->unk166) * tmp_f2; + tmp_f0 = func_800707F8(sp_20->original.unk162 - sp_20->original.unk166) * tmp_f2; tmp_f0 = (tmp_f0 < 0.0f) ? 0.0f : tmp_f0 * tmp_f0; - temp = (1.0f - tmp_f0) * 24.0f + sp_20->unkD0; + temp = (1.0f - tmp_f0) * 24.0f + sp_20->original.unkD0; if(0){} sp_1c = temp; } @@ -969,9 +969,9 @@ void func_80012E28(Object *this) { void func_80012F30(Object *arg0) { if (arg0->behaviorId == 1) { Object_64 *object_64 = arg0->unk64; - arg0->segment.trans.y_rotation -= object_64->unk160; - arg0->segment.trans.x_rotation -= object_64->unk162; - arg0->segment.trans.z_rotation -= object_64->unk164; + arg0->segment.trans.y_rotation -= object_64->original.unk160; + arg0->segment.trans.x_rotation -= object_64->original.unk162; + arg0->segment.trans.z_rotation -= object_64->original.unk164; arg0->segment.trans.y_position -= D_8011ADD0; } } @@ -995,9 +995,9 @@ void render_object(Object *this) { void func_80013548(Object *arg0) { if ((arg0->segment.trans.unk6 & 0x8000) == 0 && arg0->segment.header->behaviorId == 1) { - arg0->segment.trans.x_position -= arg0->unk64->unk78; - arg0->segment.trans.y_position -= arg0->unk64->unk7C; - arg0->segment.trans.z_position -= arg0->unk64->unk80; + arg0->segment.trans.x_position -= arg0->unk64->original.unk78; + arg0->segment.trans.y_position -= arg0->unk64->original.unk7C; + arg0->segment.trans.z_position -= arg0->unk64->original.unk80; } } @@ -1436,10 +1436,10 @@ void func_800228EC(s32 arg0) { D_8011AEF7 = 3; object_64 = get_object_struct(0)->unk64; - object_64->unk190 = 0; - object_64->unk192 = 0; - object_64->unk193 = 0; - object_64->unk1BA = 0; + object_64->original.unk190 = 0; + object_64->original.unk192 = 0; + object_64->original.unk193 = 0; + object_64->original.unk1BA = 0; func_80017E74(arg0); func_8006F388(10); } diff --git a/src/racer.c b/src/racer.c index 8ca91474..09576ba5 100644 --- a/src/racer.c +++ b/src/racer.c @@ -197,24 +197,7 @@ s8 D_8011D5BC; GLOBAL_ASM("asm/non_matchings/racer/func_80042D20.s") GLOBAL_ASM("asm/non_matchings/racer/func_80043ECC.s") -typedef struct Object_64_80044170 { - char unk0[0x2C]; - f32 unk2C; - char unk30[0x124]; - s32 unk154; - char unk158[0x72]; - s8 unk1CA; - char unk1CB[0x3]; - u8 unk1CE; - char unk1CF[0x13]; - s8 unk1E2; - char unk1E3[0x30]; - s8 unk213; - s8 unk214; - s8 unk215; -} Object_64_80044170; - -void func_80044170(Object *arg0, Object_64_80044170 *arg1, s32 arg2) { +void func_80044170(Object *arg0, Object_80044170 *arg1, s32 arg2) { s32 raceType; raceType = get_current_level_race_type(); @@ -452,22 +435,8 @@ GLOBAL_ASM("asm/non_matchings/racer/func_8004F7F4.s") #ifdef NON_EQUIVALENT -typedef struct Object_64_80050754 { - u8 unk0[0x2C]; - f32 unk2C; - f32 unk30; - u8 unk34[0x114]; -/* 0x148 */ Object *someObj; - u8 unk14C[0x54]; -/* 0x1A0 */ s16 unk1A0; -/* 0x1A2 */ s16 unk1A2; -/* 0x1A4 */ s16 unk1A4; - u8 unk1A6[0x4C]; -/* 0x1F2 */ s8 unk1F2; -} Object_64_80050754; - // Mainly has regalloc issues. -void func_80050754(Object *obj, Object_64_80050754 *obj64, f32 arg2) { +void func_80050754(Object *obj, Object_80050754 *obj64, f32 arg2) { f32 xDiff, yDiff, zDiff; Object *someObj; @@ -526,7 +495,7 @@ void func_80052988(Object *arg0, Object_64 *arg1, s32 arg2, s32 arg3, s32 arg4, if ((D_8011D55C == -1) && (arg2 >= 3)) { arg0->segment.unk3B = 0; - arg1->unk1F2 = 0; + arg1->original.unk1F2 = 0; } else if (arg0->segment.unk3B == 0) { if (arg6 & 1) { if (arg0->segment.unk18 >= 0x29) { @@ -545,24 +514,24 @@ void func_80052988(Object *arg0, Object_64 *arg1, s32 arg2, s32 arg3, s32 arg4, } else { arg0->segment.unk3B = arg2; arg0->segment.unk18 = arg3; - arg1->unk1F3 &= ~0x80; + arg1->original.unk1F3 &= ~0x80; } } else if (arg0->segment.unk3B == arg2) { if (arg6 & 2) { - if (arg1->unk1F3 & 0x80) { + if (arg1->original.unk1F3 & 0x80) { arg0->segment.unk18 -= arg5; if (arg0->segment.unk18 <= 0) { arg0->segment.unk3B = 0; - arg1->unk1F2 = 0; + arg1->original.unk1F2 = 0; arg0->segment.unk18 = 0x28; - arg1->unk1F3 = 0; + arg1->original.unk1F3 = 0; } } else { arg0->segment.unk18 += arg5; if (arg0->segment.unk18 >= arg4) { arg0->segment.unk18 = arg4 - 1; if ((arg6 & 4) == 0) { - arg1->unk1F3 |= 0x80; + arg1->original.unk1F3 |= 0x80; } } } @@ -570,9 +539,9 @@ void func_80052988(Object *arg0, Object_64 *arg1, s32 arg2, s32 arg3, s32 arg4, arg0->segment.unk18 += arg5; if (arg0->segment.unk18 >= arg4) { arg0->segment.unk3B = 0; - arg1->unk1F2 = 0; + arg1->original.unk1F2 = 0; arg0->segment.unk18 = 0x28; - arg1->unk1F3 = 0; + arg1->original.unk1F3 = 0; } } } else { @@ -625,22 +594,22 @@ void func_800535C4(unk800535C4 *arg0, unk800535C4_2 *arg1) { } void func_80053664(Object_64 *arg0) { - if (arg0->throttle > 0.0) { - arg0->throttle -= 0.1; + if (arg0->original.throttle > 0.0) { + arg0->original.throttle -= 0.1; } if (D_8011D528 & 0x8000) { - arg0->throttle = 1.0f; + arg0->original.throttle = 1.0f; } if (D_8011D528 & 0x4000) { - if (arg0->brake < 1.0) { - arg0->brake += 0.2; + if (arg0->original.brake < 1.0) { + arg0->original.brake += 0.2; } } else { //! @bug Will cause a negative brake value resulting in higher velocity - if (arg0->brake > 0.05) { - arg0->brake -= 0.1; + if (arg0->original.brake > 0.05) { + arg0->original.brake -= 0.1; } } } @@ -659,7 +628,7 @@ void play_char_horn_sound(Object *obj, Object_64 *obj64) { func_800570B8(obj, 0x162, 8, 0x82); } else { // Play character's horn sound - func_80057048(obj, obj64->unk0_a.unk0_b.unk3 + 0x156); + func_80057048(obj, obj64->original.unk0_a.unk0_b.unk3 + 0x156); } } @@ -668,7 +637,7 @@ GLOBAL_ASM("asm/non_matchings/racer/func_80056E2C.s") void func_80057048(Object *obj, s32 arg1) { Object_64 *obj64 = obj->unk64; - if (D_8011D55C != -1 && obj64->unk108 == 0) { + if (D_8011D55C != -1 && obj64->original.unk108 == 0) { func_80001EA8(arg1, obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position, NULL); } } @@ -680,22 +649,11 @@ void func_800570A4(Object *obj, s32 arg1, s32 arg2) { } #ifdef NON_EQUIVALENT -typedef struct Object_64_800570B8 { - u8 pad0[3]; - s8 unk3; - u8 pad4[0x20]; - s32 unk24; - u16 unk28; - u16 unk2A; - u8 pad2C[0xDC]; - s32 unk108; -} Object_64_800570B8; - void func_800570B8(Object *obj, s32 arg1, s32 arg2, s32 arg3) { s32 phi_t0; - Object_64_800570B8 *obj64; + Object_800570B8 *obj64; - obj64 = obj->unk64; + obj64 = &obj->unk64->obj800570B8; if ((obj64->unk108 == 0) && ((!(arg3 & 0x80)) || (D_8011D55C != -1))) { if (arg3 == 2) { if ((obj64->unk24 != 0) && (arg1 != obj64->unk2A)) { From e9ebe20607e3352f00baa5ad3174bb4b17cf8e5a Mon Sep 17 00:00:00 2001 From: Antonio Date: Wed, 13 Apr 2022 19:13:50 -0700 Subject: [PATCH 2/9] Merge Object's inlined Object_64 into Object_Racer. --- include/structs.h | 225 +++++++++++++---------------------------- src/object_functions.c | 8 +- 2 files changed, 74 insertions(+), 159 deletions(-) diff --git a/include/structs.h b/include/structs.h index f5640a21..a575bff4 100644 --- a/include/structs.h +++ b/include/structs.h @@ -865,31 +865,74 @@ typedef struct Object_Exit { } Object_Exit; typedef struct Object_Racer { - s16 unk0; - u8 pad2; - s8 unk3; - u8 pad4[0x104]; - s32 unk108; - u8 pad10C[0x40]; - struct Object *unk14C; - u8 pad150[0x33]; - s8 unk183; - s8 pad184; - s8 unk185; - u8 pad186[0x4D]; - s8 unk1D3; - u8 pad1D4[0x4]; - s8 unk1D8; - u8 pad1D9[0x9]; - s8 unk1E2; - u8 pad1E3[0x12]; - u8 unk1F5; - u8 pad1F6[0xA]; - s8 unk200; - u8 pad201[0x2]; - s8 unk203; - u8 pad204[0x8]; - u8 unk20C; + /* 0x000 */ s16 playerIndex; // -1 = AI Controlled, 0 to 3 = Object controlled + /* 0x002 */ u8 pad2; + /* 0x003 */ s8 characterId; // Affects minimap color, horn, voice, etc. + /* 0x004 */ u8 pad4[0x28]; + /* 0x02C */ f32 velocity; + /* 0x030 */ f32 lateral_velocity; + /* 0x034 */ u8 pad34[0x28]; + /* 0x05C */ f32 prev_x_position; + /* 0x060 */ f32 prev_y_position; + /* 0x064 */ f32 prev_z_position; + /* 0x068 */ u8 pad68[0x24]; + /* 0x08C */ f32 stretch_height; + /* 0x090 */ f32 stretch_height_cap; + /* 0x094 */ f32 camera_zoom; + /* 0x098 */ u8 pad98[0x4]; + /* 0x09C */ f32 pitch; + /* 0x0A0 */ u8 padA0[0x8]; + /* 0x0A8 */ f32 checkpoint_distance; + /* 0x0AC */ u8 padAC[0x8]; + /* 0x0B4 */ f32 throttle; + /* 0x0B8 */ f32 brake; + /* 0x0BC */ u8 padBC[0x4C]; + /* 0x108 */ s32 unk108; + /* 0x10C */ u8 pad10C[0x1C]; + /* 0x128 */ u32 lap_times[3]; + /* 0x134 */ u8 pad134[0x10]; + /* 0x144 */ struct Object *held_obj; + /* 0x148 */ u8 pad148[0x4]; + /* 0x14C */ struct Object *unk14C; + /* 0x150 */ u8 pad150[0x22]; + /* 0x172 */ u8 balloon_type; + /* 0x173 */ u8 balloon_quantity; + /* 0x174 */ u8 balloon_level; + /* 0x175 */ u8 pad175[0xE]; + /* 0x183 */ s8 unk183; + /* 0x184 */ s8 pad184; + /* 0x185 */ s8 bananas; + /* 0x186 */ u8 pad186[0x4D]; + /* 0x1D3 */ s8 unk1D3; + /* 0x1D4 */ u8 pad1D4[0x4]; + /* 0x1D8 */ s8 unk1D8; + /* 0x1D9 */ u8 pad1D9[0x2]; + /* 0x1DB */ u8 spinout_timer; + /* 0x1DC */ u8 wheel_surfaces[4]; + /* 0x1E0 */ u8 pad1E0[0x2]; + /* 0x1E2 */ s8 unk1E2; + /* 0x1E3 */ u8 pad1E3[0x3]; + /* 0x1E6 */ u8 drift_direction; + /* 0x1E7 */ u8 pad1E7[0x6]; + /* 0x1ED */ s8 squish_timer; + /* 0x1EE */ u8 pad1EE[0x1]; + /* 0x1EF */ u8 boost_sound; + /* 0x1F0 */ u8 pad1F1[0x5]; + /* 0x1F5 */ u8 unk1F5; + /* 0x1F6 */ u8 pad1F6[0x1]; + /* 0x1F7 */ u8 transparency; + /* 0x0290 */ u8 indicator_type; + /* 0x0291 */ s8 indicator_timer; + /* 0x1FA */ u8 pad1FA[0x6]; + /* 0x200 */ s8 unk200; + /* 0x201 */ u8 pad201[0x2]; + /* 0x203 */ s8 unk203; + /* 0x204 */ u8 pad204[0x8]; + /* 0x20C */ u8 unk20C; + /* 0x20D */ u8 pad20D[0x1]; + /* 0x20E */ u16 unk20E; + /* 0x210 */ u8 pad210[0xC]; + /* 0x21C */ u8 unk21C; } Object_Racer; typedef struct Object_Bonus { @@ -1193,137 +1236,9 @@ typedef struct Object { /* 0x0094 */ u32 unk94; /* 0x0098 */ Object_64 obj; - - //------------------------------ REMOVE BEGIN ------------------------------ -// /* 0x0098 */ s16 playerIndex; // -1 = AI Controlled, 0 to 3 = Object controlled -// /* 0x009A */ u8 unk9A; -// /* 0x009B */ u8 characterId; // Affects minimap color, horn, voice, etc. -// /* 0x009C */ u32 unk9C; - -// /* 0x00A0 */ f32 unkA0; - -// /* 0x00A4 */ u32 unkA4; -// /* 0x00A8 */ u32 unkA8; -// /* 0x00AC */ u32 unkAC; -// /* 0x00B0 */ u32 unkB0; -// /* 0x00B4 */ u32 unkB4; -// /* 0x00B8 */ u32 unkB8; -// /* 0x00BC */ u32 unkBC; -// /* 0x00C0 */ u32 unkc0; - -// /* 0x00C4 */ f32 velocity; -// /* 0x00C8 */ f32 lateral_velocity; - -// u32 unkCC[10]; // Not an array. Unknown values. - -// /* 0x00F4 */ f32 prev_x_position; -// /* 0x00F8 */ f32 prev_y_position; -// /* 0x00FC */ f32 prev_z_position; - -// /* 0x0100 */ u32 unk100; -// /* 0x0104 */ u32 unk104; -// /* 0x0108 */ u32 unk108; -// /* 0x010C */ u32 unk10C; - -// /* 0x0110 */ f32 unk110; -// /* 0x0114 */ f32 unk114; -// /* 0x0118 */ f32 unk118; -// /* 0x011C */ f32 unk11C; -// /* 0x0120 */ u32 unk120; -// /* 0x0124 */ f32 stretch_height; -// /* 0x0128 */ f32 stretch_height_cap; -// /* 0x012C */ f32 camera_zoom; -// /* 0x0130 */ u32 unk130; -// /* 0x0134 */ f32 pitch; -// /* 0x0138 */ u32 unk138; -// /* 0x013C */ u32 unk13C; -// /* 0x0140 */ f32 checkpoint_distance; -// /* 0x0144 */ u32 unk144; -// /* 0x0148 */ f32 unk148; -// /* 0x014C */ f32 throttle; -// /* 0x0150 */ f32 brake; -// /* 0x0154 */ u32 unk154; -// /* 0x0158 */ u32 unk158; -// /* 0x015C */ u32 unk15C; -// /* 0x0160 */ f32 unk160; -// /* 0x0164 */ u32 unk164; -// /* 0x0168 */ u32 unk168; -// /* 0x016C */ u32 unk16C; -// /* 0x0170 */ f32 unk170; -// /* 0x0174 */ f32 unk174; -// /* 0x0178 */ f32 unk178; -// /* 0x017C */ f32 unk17C; -// /* 0x0180 */ f32 unk180; -// /* 0x0184 */ f32 unk184; -// /* 0x0188 */ f32 unk188; -// /* 0x018C */ f32 unk18C; -// /* 0x0190 */ f32 unk190; -// /* 0x0194 */ f32 unk194; -// /* 0x0198 */ f32 unk198; -// /* 0x019C */ f32 unk19C; - -// u32 unk1A0[8]; // Not an array. Unknown values. - -// /* 0x01C0 */ u32 lap_times[3]; - -// /* 0x01CC */ u32 unk1CC; -// /* 0x01D0 */ u32 unk1D0; -// /* 0x01D4 */ u32 unk1D4; -// /* 0x01D8 */ u32 unk1D8; - -// /* 0x01DC */ void *held_obj_ptr; - -// u32 unk1E0[10]; // Not an array. Unknown values. - -// /* 0x0208 */ u16 unk208; -// /* 0x020A */ u8 balloon_type; -// /* 0x020B */ u8 balloon_quantity; -// /* 0x020C */ u8 balloon_level; - -// /* 0x020D */ u8 unk20D; -// /* 0x020E */ u8 unk20E; -// /* 0x020F */ u8 unk20F; -// /* 0x0210 */ u32 unk210; -// /* 0x0214 */ u32 unk214; -// /* 0x0218 */ u32 unk218; -// /* 0x021A */ u16 unk21A; -// /* 0x021B */ u8 unk21B; - -// /* 0x021D */ s8 bananas; -// /* 0x021E */ u8 unk21E; - -// /* 0x0270 */ u8 unk270; -// /* 0x0271 */ u8 unk271; -// /* 0x0272 */ u8 unk272; - -// /* 0x0273 */ u8 spinout_timer; -// /* 0x0274 */ u8 wheel_surfaces[4]; - -// /* 0x0278 */ u32 unk278; -// /* 0x027C */ u16 unk27C; - -// /* 0x027E */ u8 drift_direction; -// /* 0x027F */ u8 unk27F; - -// /* 0x0280 */ u32 unk280; -// /* 0x0284 */ u8 unk284; - -// /* 0x0285 */ s8 squish_timer; -// /* 0x0286 */ u8 unk286; -// /* 0x0287 */ u8 boost_sound; -// /* 0x0288 */ u32 unk288; - -// /* 0x028C */ u16 unk28C; -// /* 0x028E */ u8 unk28E; - -// /* 0x028F */ u8 transparency; - //------------------------------ REMOVE END ------------------------------ - /* 0x0290 */ u8 indicator_type; - /* 0x0291 */ s8 indicator_timer; - /* 0x0292 */ u16 unk292; - - u32 unk294[11]; // Not an array. Unknown values. + // May be a part of obj (likely Object_Player). + /* 0x02B8 */ u8 pad2A8[0x8]; /* 0x02C0 */ f32 unk2C0; diff --git a/src/object_functions.c b/src/object_functions.c index 01d223d9..739a8066 100644 --- a/src/object_functions.c +++ b/src/object_functions.c @@ -868,7 +868,7 @@ void obj_loop_groundzipper(Object *obj, UNUSED s32 speed) { yDiff = curRacerObj->segment.trans.y_position - obj->segment.trans.y_position; zDiff = curRacerObj->segment.trans.z_position - obj->segment.trans.z_position; if ((s32) sqrtf((xDiff * xDiff) + (yDiff * yDiff) + (zDiff * zDiff)) < obj->unk78) { - if (racerObj64->unk0 != -1) { + if (racerObj64->playerIndex != -1) { func_80001EA8(263, curRacerObj->segment.trans.x_position, curRacerObj->segment.trans.y_position, curRacerObj->segment.trans.z_position, NULL); } racerObj64->unk1D3 = func_8000C8B4(45); @@ -877,7 +877,7 @@ void obj_loop_groundzipper(Object *obj, UNUSED s32 speed) { racerObj64->unk203 |= 4; } if (racerObj64->unk1D8 == 0) { - func_80072348(racerObj64->unk0, 8); + func_80072348(racerObj64->playerIndex, 8); } } } @@ -1529,7 +1529,7 @@ void obj_loop_exit(Object *obj, UNUSED s32 speed) { for (i = 0; i < numberOfRacers; i++) { racerObj = racerObjects[i]; racerObj64 = &racerObj->unk64->racer; - if ((racerObj64->unk0 != -1) && (racerObj64->unk108 == 0)) { + if ((racerObj64->playerIndex != -1) && (racerObj64->unk108 == 0)) { xDiff = racerObj->segment.trans.x_position - obj->segment.trans.x_position; yDiff = racerObj->segment.trans.y_position - obj->segment.trans.y_position; zDiff = racerObj->segment.trans.z_position - obj->segment.trans.z_position; @@ -1725,7 +1725,7 @@ void obj_loop_bonus(Object *obj, UNUSED s32 speed) { if ((s32) racerObj64->unk185 < 10) { racerObj64->unk185 = 10; func_80009558(34, racerObj->segment.trans.x_position, racerObj->segment.trans.y_position, racerObj->segment.trans.z_position, 4, NULL); - func_80001EA8(racerObj64->unk3 + 123, racerObj->segment.trans.x_position, racerObj->segment.trans.y_position, racerObj->segment.trans.z_position, NULL); + func_80001EA8(racerObj64->characterId + 123, racerObj->segment.trans.x_position, racerObj->segment.trans.y_position, racerObj->segment.trans.z_position, NULL); } } } From a3c4d99b882cb93196ebd9d3947d3c104c853bf5 Mon Sep 17 00:00:00 2001 From: Antonio Date: Wed, 13 Apr 2022 20:15:46 -0700 Subject: [PATCH 3/9] Name unnamed Object_64 types. --- include/structs.h | 192 ++++++++++++++++------------------------- src/object_functions.c | 84 +++++++++--------- src/racer.c | 26 +++--- 3 files changed, 128 insertions(+), 174 deletions(-) diff --git a/include/structs.h b/include/structs.h index a575bff4..e30e9a50 100644 --- a/include/structs.h +++ b/include/structs.h @@ -656,16 +656,16 @@ typedef struct Object_Original { // from object_functions.c -typedef struct Object_80034860 { +typedef struct Object_Laser { s16 unk0; u8 unk4[0x185]; s8 unk187; -} Object_80034860; +} Object_Laser; -typedef struct Object_80034E9C { +typedef struct Object_TrophyCabinet { s32 unk0; s16 unk4; -} Object_80034E9C; +} Object_TrophyCabinet; typedef struct Object_Animator { /* 0x00 */ s16 segmentId; @@ -676,11 +676,11 @@ typedef struct Object_Animator { /* 0x0A */ s16 ySpeed; } Object_Animator; -typedef struct Object_8003DFCC { +typedef struct Object_WeaponBalloon { f32 unk0; s16 unk4; s8 unk6[0x2]; -} Object_8003DFCC; +} Object_WeaponBalloon; typedef struct Object_Butterfly { /* 0x00 */ Triangle triangles[8]; @@ -698,23 +698,23 @@ typedef struct Object_Butterfly { // from object_functions.h -typedef struct Object_80034B74 { +typedef struct Object_EffectBox { u8 pad0[0x1FE]; u8 unk1FE; u8 unk1FF; -} Object_80034B74; +} Object_EffectBox; -typedef struct Object_8003564C { +typedef struct Object_EggCreator { u8 pad0[4]; struct Object *unk4; -} Object_8003564C; +} Object_EggCreator; -typedef struct Object_80035E34 { +typedef struct Object_UnkId58 { u8 pad0[0x1D6]; s8 unk1D6; -} Object_80035E34; +} Object_UnkId58; -typedef struct Object_80035F6C { +typedef struct Object_CharacterFlag { s32 unk0; s32 unk4; s32 unk8; @@ -725,22 +725,13 @@ typedef struct Object_80035F6C { s32 unk1C; s16 *unk20; u8 *unk24; -} Object_80035F6C; +} Object_CharacterFlag; typedef struct Object_80035F6C_2 { u8 pad0[3]; s8 unk3; } Object_80035F6C_2; -typedef struct Object_800376E0 { - s16 segmentId; - s16 unk2; - s16 unk4; - s16 unk6; - s16 unk8; - s16 unkA; -} Object_800376E0; - typedef struct Object_Snowball { u8 pad0[0x20]; u32 unk20; @@ -749,32 +740,23 @@ typedef struct Object_Snowball { s8 unk38; } Object_Snowball; -typedef struct Object_80038710 { +typedef struct Object_AnimCamera { u8 pad0[0x30]; s8 unk30; u8 pad31[0x13]; s8 unk44; -} Object_80038710; +} Object_AnimCamera; -typedef struct Object_800387CC { +typedef struct Object_AnimCar { u8 pad0[0x148]; struct Object *unk148; -} Object_800387CC; +} Object_AnimCar; -typedef struct Object_800388D4 { +typedef struct Object_InfoPoint { s16 unk0; -} Object_800388D4; +} Object_InfoPoint; -typedef struct Object_80038E3C { - f32 unk0; - f32 unk4; - f32 unk8; - f32 unkC; - s32 unk10; - s8 unk14; -} Object_80038E3C; - -typedef struct Object_8003C1E0 { +typedef struct Object_TTDoor { f32 unk0; u8 pad4[4]; s32 unk8; @@ -783,13 +765,13 @@ typedef struct Object_8003C1E0 { u8 pad10[2]; u8 unk12; u8 unk13; -} Object_8003C1E0; +} Object_TTDoor; -typedef struct Object_8003DF08 { +typedef struct Object_WorldKey { s16 unk0; -} Object_8003DF08; +} Object_WorldKey; -typedef struct Object_8003FEF4 { +typedef struct Object_AudioLine { u8 unk0; u8 pad1; u16 unk2; @@ -811,25 +793,25 @@ typedef struct Object_8003FEF4 { u8 unk10; u8 unk11; u8 unk12; -} Object_8003FEF4; +} Object_AudioLine; -typedef struct Object_8004001C { +typedef struct Object_AudioReverb { u16 pad0; s16 unk2; u8 unk4; u8 unk5; -} Object_8004001C; +} Object_AudioReverb; -typedef struct Object_800400A4 { +typedef struct Object_TexScroll { s16 unk0; s16 pad2; s16 unk4; s16 unk6; s16 unk8; s16 unkA; -} Object_800400A4; +} Object_TexScroll; -typedef struct Object_80042210 { +typedef struct Object_Frog { f32 unk0; f32 unk4; f32 unk8; @@ -844,7 +826,7 @@ typedef struct Object_80042210 { f32 unk24; u8 pad28[8]; f32 unk30; -} Object_80042210; +} Object_Frog; typedef struct Object_Wizpig2 { u8 pad0[0x70]; @@ -868,7 +850,10 @@ typedef struct Object_Racer { /* 0x000 */ s16 playerIndex; // -1 = AI Controlled, 0 to 3 = Object controlled /* 0x002 */ u8 pad2; /* 0x003 */ s8 characterId; // Affects minimap color, horn, voice, etc. - /* 0x004 */ u8 pad4[0x28]; + /* 0x004 */ u8 pad4[0x20]; + /* 0x024 */ s32 unk24; + /* 0x028 */ u16 unk28; + /* 0x02A */ u16 unk2A; /* 0x02C */ f32 velocity; /* 0x030 */ f32 lateral_velocity; /* 0x034 */ u8 pad34[0x28]; @@ -892,9 +877,11 @@ typedef struct Object_Racer { /* 0x128 */ u32 lap_times[3]; /* 0x134 */ u8 pad134[0x10]; /* 0x144 */ struct Object *held_obj; - /* 0x148 */ u8 pad148[0x4]; + /* 0x148 */ struct Object *unk148; /* 0x14C */ struct Object *unk14C; - /* 0x150 */ u8 pad150[0x22]; + /* 0x150 */ u8 pad150[0x4]; + /* 0x154 */ s32 unk154; + /* 0x158 */ u8 pad158[0x1A]; /* 0x172 */ u8 balloon_type; /* 0x173 */ u8 balloon_quantity; /* 0x174 */ u8 balloon_level; @@ -902,7 +889,15 @@ typedef struct Object_Racer { /* 0x183 */ s8 unk183; /* 0x184 */ s8 pad184; /* 0x185 */ s8 bananas; - /* 0x186 */ u8 pad186[0x4D]; + /* 0x186 */ u8 pad186[0x1A]; + /* 0x1A0 */ s16 unk1A0; + /* 0x1A2 */ s16 unk1A2; + /* 0x1A4 */ s16 unk1A4; + /* 0x1A6 */ u8 pad1A6[0x24]; + /* 0x1CA */ s8 unk1CA; + /* 0x1CB */ u8 pad1CB[0x3]; + /* 0x1CE */ u8 unk1CE; + /* 0x1CF */ u8 pad1CF[0x4]; /* 0x1D3 */ s8 unk1D3; /* 0x1D4 */ u8 pad1D4[0x4]; /* 0x1D8 */ s8 unk1D8; @@ -917,7 +912,9 @@ typedef struct Object_Racer { /* 0x1ED */ s8 squish_timer; /* 0x1EE */ u8 pad1EE[0x1]; /* 0x1EF */ u8 boost_sound; - /* 0x1F0 */ u8 pad1F1[0x5]; + /* 0x1F0 */ u8 pad1F0[0x2]; + /* 0x1F2 */ s8 unk1F2; + /* 0x1F3 */ u8 pad1F3[0x2]; /* 0x1F5 */ u8 unk1F5; /* 0x1F6 */ u8 pad1F6[0x1]; /* 0x1F7 */ u8 transparency; @@ -931,7 +928,11 @@ typedef struct Object_Racer { /* 0x20C */ u8 unk20C; /* 0x20D */ u8 pad20D[0x1]; /* 0x20E */ u16 unk20E; - /* 0x210 */ u8 pad210[0xC]; + /* 0x210 */ u8 pad210[0x3]; + /* 0x213 */ s8 unk213; + /* 0x214 */ s8 unk214; + /* 0x215 */ s8 unk215; + /* 0x216 */ u8 pad216[0x6]; /* 0x21C */ u8 unk21C; } Object_Racer; @@ -1040,73 +1041,29 @@ typedef struct Object_Banana { // from racer.c -typedef struct Object_80044170 { - char unk0[0x2C]; - f32 unk2C; - char unk30[0x124]; - s32 unk154; - char unk158[0x72]; - s8 unk1CA; - char unk1CB[0x3]; - u8 unk1CE; - char unk1CF[0x13]; - s8 unk1E2; - char unk1E3[0x30]; - s8 unk213; - s8 unk214; - s8 unk215; -} Object_80044170; - -typedef struct Object_80050754 { - u8 unk0[0x2C]; - f32 unk2C; - f32 unk30; - u8 unk34[0x114]; - /* 0x148 */ struct Object *someObj; - u8 unk14C[0x54]; - /* 0x1A0 */ s16 unk1A0; - /* 0x1A2 */ s16 unk1A2; - /* 0x1A4 */ s16 unk1A4; - u8 unk1A6[0x4C]; - /* 0x1F2 */ s8 unk1F2; -} Object_80050754; - -typedef struct Object_800570B8 { - u8 pad0[3]; - s8 unk3; - u8 pad4[0x20]; - s32 unk24; - u16 unk28; - u16 unk2A; - u8 pad2C[0xDC]; - s32 unk108; -} Object_800570B8; - typedef struct Object_64 { union { Object_Original original; - Object_80034860 obj80034860; - Object_80034E9C obj80034E9C; + Object_Laser laser; + Object_TrophyCabinet trophy_cabinet; Object_Animator animator; - Object_8003DFCC obj8003DFCC; + Object_WeaponBalloon weapon_balloon; Object_Butterfly butterfly; - Object_80034B74 obj80034B74; - Object_8003564C obj8003564C; - Object_80035E34 obj80035E34; - Object_80035F6C obj80035F6C; + Object_EffectBox effect_box; + Object_EggCreator egg_creator; + Object_UnkId58 unkid58; + Object_CharacterFlag character_flag; Object_80035F6C_2 obj80035F6C_2; - Object_800376E0 obj800376E0; Object_Snowball snowball; - Object_80038710 obj80038710; - Object_800387CC obj800387CC; - Object_800388D4 obj800388D4; - Object_80038E3C obj80038E3C; - Object_8003C1E0 obj8003C1E0; - Object_8003DF08 obj8003DF08; - Object_8003FEF4 obj8003FEF4; - Object_8004001C obj8004001C; - Object_800400A4 obj800400A4; - Object_80042210 obj80042210; + Object_AnimCamera anim_camera; + Object_AnimCar anim_car; + Object_InfoPoint info_point; + Object_TTDoor tt_door; + Object_WorldKey world_key; + Object_AudioLine audio_line; + Object_AudioReverb audio_reverb; + Object_TexScroll tex_scroll; + Object_Frog frog; Object_Wizpig2 wizpig2; Object_Exit exit; Object_Racer racer; @@ -1120,9 +1077,6 @@ typedef struct Object_64 { Object_MidiFadePoint midi_fade_point; Object_PosArrow pos_arrow; Object_Banana banana; - Object_80044170 obj80044170; - Object_80050754 obj80050754; - Object_800570B8 obj800570B8; }; } Object_64; diff --git a/src/object_functions.c b/src/object_functions.c index 739a8066..0246d7a4 100644 --- a/src/object_functions.c +++ b/src/object_functions.c @@ -372,7 +372,7 @@ void obj_loop_laserbolt(Object *obj, s32 speed) { Object *obj4C_obj; Object_7C_80034860 *obj7C; - Object_80034860 *obj4C_obj64; + Object_Laser *obj4C_obj64; s8 sp4F; // Boolean s8 sp4E; @@ -416,7 +416,7 @@ void obj_loop_laserbolt(Object *obj, s32 speed) { if (obj->unk4C->unk13 < 80) { obj4C_obj = (Object*)obj->unk4C->unk0; if (obj4C_obj && (obj4C_obj->behaviorId == 1)) { - obj4C_obj64 = &obj4C_obj->unk64->obj80034860; + obj4C_obj64 = &obj4C_obj->unk64->laser; sp4F = TRUE; if (obj4C_obj64->unk0 != -1) { obj4C_obj64->unk187 = 1; @@ -462,7 +462,7 @@ Object **get_object_struct_array(s32 *count); void obj_loop_effectbox(Object *obj, s32 speed) { Object **objList; Object_3C_80034B74 *obj3C; - Object_80034B74 *curObj64; + Object_EffectBox *curObj64; s32 i; s32 numberOfObjects; f32 xDiff; @@ -498,7 +498,7 @@ void obj_loop_effectbox(Object *obj, s32 speed) { if (((-temp4) < (((-xDiff) * temp1) + (zDiff * temp0))) && (temp5 < temp4)) { temp5 = temp3 / 2; - curObj64 = objList[i]->unk64; + curObj64 = &objList[i]->unk64->effect_box; curObj64->unk1FE = obj3C->unkC; curObj64->unk1FF = obj3C->unkD; if ((temp5 < yDiff) && (curObj64->unk1FE == 1)) @@ -562,7 +562,7 @@ void obj_loop_trophycab(Object *obj, s32 speed) { unk80027FC4 sp44; Settings *settings; LevelHeader *curLevelHeader; - Object_80034E9C *obj64; + Object_TrophyCabinet *obj64; Object *trophyObj; Object *playerObj; f32 xDiff; @@ -571,7 +571,7 @@ void obj_loop_trophycab(Object *obj, s32 speed) { settings = get_settings(); curLevelHeader = get_current_level_header(); - obj64 = &obj->unk64->obj80034E9C; + obj64 = &obj->unk64->trophy_cabinet; // Show trophy inside the cabinet if (obj->unk7C.word == 0) { @@ -709,7 +709,7 @@ void obj_loop_eggcreator(Object *obj, UNUSED s32 speed) { sp20.unk0 = 0x34; someObj = spawn_object(&sp20, 1); if (someObj != NULL) { - Object_8003564C *someObj64 = &someObj->unk64->obj8003564C; + Object_EggCreator *someObj64 = &someObj->unk64->egg_creator; someObj64->unk4 = obj; obj->unk78 = someObj; someObj->segment.unk3C_a.unk3C = 0; @@ -893,7 +893,7 @@ void obj_init_unknown58(Object *obj, LevelObjectEntry_Unknown58 *entry) { void obj_loop_unknown58(Object *obj, s32 speed) { Object *someObj; Object *someOtherObj; - Object_80035E34 *someOtherObj64; + Object_UnkId58 *someOtherObj64; Object_60 *obj60; obj->segment.unk3B = 0; @@ -904,7 +904,7 @@ void obj_loop_unknown58(Object *obj, s32 speed) { set_ghost_position_and_rotation(obj); func_800AFC3C(obj, speed); someOtherObj = get_object_struct(0); - someOtherObj64 = &someOtherObj->unk64->obj80035E34; + someOtherObj64 = &someOtherObj->unk64->unkid58; obj60 = obj->unk60; if (obj60->unk0 == 1) { s8 temp = someOtherObj64->unk1D6; @@ -934,13 +934,13 @@ void obj_loop_characterflag(Object *obj, UNUSED s32 speed) { s32 temp_t4; s32 temp_t5; Object *someObj; - Object_80035F6C *obj64; + Object_CharacterFlag *obj64; Object_80035F6C_2 *someObj64; if (obj->unk7C.word < 0) { someObj = get_object_struct(obj->unk78); if (someObj != NULL) { - obj64 = &obj->unk64->obj80035F6C; + obj64 = &obj->unk64->character_flag; someObj64 = &someObj->unk64->obj80035F6C_2; obj->unk7C.word = someObj64->unk3; if (obj->unk7C.word < 0 || obj->unk7C.word >= 0xA) { @@ -1034,27 +1034,27 @@ void obj_loop_posarrow(Object *obj, UNUSED s32 speed) { } void obj_init_animator(Object *obj, LevelObjectEntry_Animator *entry, s32 arg2) { - Object_800376E0 *obj64; + Object_Animator *obj64; LevelModel *levelModel; s16 segmentBatchCount; - obj64 = &obj->unk64->obj800376E0; + obj64 = &obj->unk64->animator; levelModel = func_8002C7C4(); - obj64->unk2 = entry->unk8; - obj64->unk4 = entry->unk9; - obj64->unk6 = entry->unkA; + obj64->batchId = entry->unk8; + obj64->xSpeedFactor = entry->unk9; + obj64->ySpeedFactor = entry->unkA; obj64->segmentId = get_level_segment_index_from_position(obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position); if (arg2 == 0) { - obj64->unk8 = 0; - obj64->unkA = 0; + obj64->xSpeed = 0; + obj64->ySpeed = 0; } if (obj64->segmentId != -1) { - if (obj64->unk2 < 0) { - obj64->unk2 = 0; + if (obj64->batchId < 0) { + obj64->batchId = 0; } segmentBatchCount = levelModel->segments[obj64->segmentId].numberOfBatches; - if (obj64->unk2 >= segmentBatchCount) { - obj64->unk2 = segmentBatchCount - 1; + if (obj64->batchId >= segmentBatchCount) { + obj64->batchId = segmentBatchCount - 1; } } obj_loop_animator(obj, 0x20000); @@ -1316,11 +1316,11 @@ GLOBAL_ASM("asm/non_matchings/unknown_032760/obj_loop_char_select.s") void obj_loop_animcamera(Object *obj, s32 speed) { s32 temp_v0; s32 phi_v1; - Object_80038710 *obj64; + Object_AnimCamera *obj64; temp_v0 = func_8001F460(obj, speed, obj); obj->segment.trans.unk6 |= 0x4000; - obj64 = &obj->unk64->obj80038710; + obj64 = &obj->unk64->anim_camera; if (temp_v0 == 0) { if (get_viewport_count() == VIEWPORTS_COUNT_1_PLAYER) { phi_v1 = func_800210CC(obj64->unk44); @@ -1347,7 +1347,7 @@ void obj_loop_animcar(Object *obj, s32 speed) { obj->unk7C.word = func_8001F460(obj, speed, obj); obj->segment.trans.unk6 |= 0x4000; if (obj->unk7C.word == 0 && someObj != NULL) { - Object_800387CC *someObj64 = &someObj->unk64->obj800387CC; + Object_AnimCar *someObj64 = &someObj->unk64->anim_car; someObj64->unk148 = obj; } } @@ -1381,7 +1381,7 @@ void obj_loop_infopoint(Object *obj, UNUSED s32 speed) { if (obj4C->unk13 < ((obj->unk78 >> 16) & 0xFF)) { playerObj = obj4C->unk0; if (playerObj->segment.header->behaviorId == 1) { - Object_800388D4 *playerObj64 = &playerObj->unk64->obj800388D4; + Object_InfoPoint *playerObj64 = &playerObj->unk64->info_point; temp_a0 = playerObj64->unk0; if ((temp_a0 != -1) && (get_buttons_pressed_from_player(temp_a0) & Z_TRIG)) { func_800C31EC(obj->unk78 & 0xFF); @@ -1477,12 +1477,12 @@ void obj_loop_teleport(Object *obj, UNUSED s32 speed) { void obj_init_exit(Object *obj, LevelObjectEntry_Exit *entry) { f32 phi_f0; - Object_80038E3C *obj64; + Object_Exit *obj64; phi_f0 = entry->unk10 & 0xFF; if (phi_f0 < 5) { phi_f0 = 5; } - obj64 = &obj->unk64->obj80038E3C; + obj64 = &obj->unk64->exit; phi_f0 /= 128; obj->segment.trans.scale = phi_f0; obj->segment.trans.y_rotation = entry->unk11 << 6 << 4; @@ -1722,8 +1722,8 @@ void obj_loop_bonus(Object *obj, UNUSED s32 speed) { if ((sqrtf((xDiff * xDiff) + (yDiff * yDiff) + (zDiff * zDiff)) < dist)) { f32 temp = (obj64->unk0 * racerObj->segment.trans.x_position) + (obj64->unk8 * racerObj->segment.trans.z_position) + obj64->unkC; if (temp < 0.0f) { - if ((s32) racerObj64->unk185 < 10) { - racerObj64->unk185 = 10; + if ((s32) racerObj64->bananas < 10) { + racerObj64->bananas = 10; func_80009558(34, racerObj->segment.trans.x_position, racerObj->segment.trans.y_position, racerObj->segment.trans.z_position, 4, NULL); func_80001EA8(racerObj64->characterId + 123, racerObj->segment.trans.x_position, racerObj->segment.trans.y_position, racerObj->segment.trans.z_position, NULL); } @@ -1905,11 +1905,11 @@ GLOBAL_ASM("asm/non_matchings/unknown_032760/obj_loop_door.s") void obj_init_ttdoor(Object *obj, LevelObjectEntry_TTDoor *entry) { f32 temp_f0; - Object_8003C1E0 *obj64; + Object_TTDoor *obj64; f32 phi_f0; obj->segment.unk3A = 0; - obj64 = &obj->unk64->obj8003C1E0; + obj64 = &obj->unk64->tt_door; obj->segment.trans.y_rotation = entry->unk8 << 6 << 4; obj64->unkF = entry->unkE; obj64->unk13 = entry->unkB; @@ -2167,7 +2167,7 @@ void obj_loop_worldkey(Object *worldKeyObj, s32 speed) { playerObj = worldKeyObj->unk4C->unk0; if (playerObj != NULL) { if (playerObj->segment.header->behaviorId == 1) { // Is the player a racer? - Object_8003DF08 *obj64 = &playerObj->unk64->obj8003DF08; + Object_WorldKey *obj64 = &playerObj->unk64->world_key; if (obj64->unk0 != -1) { // Player has grabbed the key! play_sound(SOUND_WORLD_KEY_GRAB); @@ -2185,7 +2185,7 @@ void obj_loop_worldkey(Object *worldKeyObj, s32 speed) { void obj_init_weaponballoon(Object *obj, LevelObjectEntry_WeaponBalloon *entry) { s32 cheats; - Object_8003DFCC *obj64; + Object_WeaponBalloon *obj64; f32 scalef; obj->unk4C->unk14 = 2; @@ -2224,7 +2224,7 @@ void obj_init_weaponballoon(Object *obj, LevelObjectEntry_WeaponBalloon *entry) } scalef /= 64; - obj64 = &obj->unk64->obj8003DFCC; + obj64 = &obj->unk64->weapon_balloon; obj->segment.trans.scale = obj->segment.header->scale * scalef; obj64->unk0 = obj->segment.trans.scale; @@ -2338,9 +2338,9 @@ void obj_init_audio(Object *obj, LevelObjectEntry_Audio *entry) { } void obj_init_audioline(Object *obj, LevelObjectEntry_AudioLine *entry) { - Object_8003FEF4 *obj64; + Object_AudioLine *obj64; - obj64 = &obj->unk64->obj8003FEF4; + obj64 = &obj->unk64->audio_line; obj64->unk0 = entry->unk8; obj64->unk2 = entry->unkA; obj64->unkC = entry->unkC; @@ -2360,7 +2360,7 @@ void obj_init_audioline(Object *obj, LevelObjectEntry_AudioLine *entry) { void obj_init_audioreverb(Object *obj, LevelObjectEntry_AudioReverb *entry) { s32 temp; - Object_8004001C *obj64 = &obj->unk64->obj8004001C; + Object_AudioReverb *obj64 = &obj->unk64->audio_reverb; obj64->unk2 = entry->unk8; temp = entry->unk9; obj64->unk4 = temp & 0xFF; @@ -2370,11 +2370,11 @@ void obj_init_audioreverb(Object *obj, LevelObjectEntry_AudioReverb *entry) { } void obj_init_texscroll(Object *obj, LevelObjectEntry_TexScroll *entry, s32 arg2) { - Object_800400A4 *obj64; + Object_TexScroll *obj64; LevelModel *levelModel; s16 numberOfTexturesInLevel; - obj64 = &obj->unk64->obj800400A4; + obj64 = &obj->unk64->tex_scroll; levelModel = func_8002C7C4(); obj64->unk0 = entry->unk8; if (obj64->unk0 < 0) { @@ -2673,9 +2673,9 @@ void obj_loop_rangetrigger(Object *obj, s32 speed) { } void obj_init_frog(Object *obj, LevelObjectEntry_Frog *entry) { - Object_80042210 *obj64; + Object_Frog *obj64; - obj64 = &obj->unk64->obj80042210; + obj64 = &obj->unk64->frog; obj64->unk15 = entry->unkA; obj64->unk0 = obj->segment.trans.x_position; obj64->unk4 = obj->segment.trans.y_position; diff --git a/src/racer.c b/src/racer.c index 09576ba5..5ad03d6e 100644 --- a/src/racer.c +++ b/src/racer.c @@ -197,7 +197,7 @@ s8 D_8011D5BC; GLOBAL_ASM("asm/non_matchings/racer/func_80042D20.s") GLOBAL_ASM("asm/non_matchings/racer/func_80043ECC.s") -void func_80044170(Object *arg0, Object_80044170 *arg1, s32 arg2) { +void func_80044170(Object *arg0, Object_Racer *arg1, s32 arg2) { s32 raceType; raceType = get_current_level_race_type(); @@ -216,14 +216,14 @@ void func_80044170(Object *arg0, Object_80044170 *arg1, s32 arg2) { break; } - if (arg1->unk214 == 0 && arg1->unk2C < -0.5) { + if (arg1->unk214 == 0 && arg1->velocity < -0.5) { arg1->unk215 -= arg2; if (arg1->unk215 < 0) { arg1->unk215 = 0; } } - if (arg1->unk2C > -1.0 && arg1->unk214 == 0 && D_8011D540 == 0 && D_8011D544 == 0.0f && arg1->unk1E2 != 0 && arg1->unk215 == 0) { + if (arg1->velocity > -1.0 && arg1->unk214 == 0 && D_8011D540 == 0 && D_8011D544 == 0.0f && arg1->unk1E2 != 0 && arg1->unk215 == 0) { arg1->unk213 += arg2; if (arg1->unk213 > 60) { @@ -436,28 +436,28 @@ GLOBAL_ASM("asm/non_matchings/racer/func_8004F7F4.s") #ifdef NON_EQUIVALENT // Mainly has regalloc issues. -void func_80050754(Object *obj, Object_80050754 *obj64, f32 arg2) { +void func_80050754(Object *obj, Object_Racer *obj64, f32 arg2) { f32 xDiff, yDiff, zDiff; Object *someObj; obj->segment.unk3B = 0; obj->segment.unk18 = 0x28; - someObj = obj64->someObj; + someObj = obj64->unk148; xDiff = someObj->segment.trans.x_position - obj->segment.trans.x_position; yDiff = someObj->segment.trans.y_position - obj->segment.trans.y_position; zDiff = someObj->segment.trans.z_position - obj->segment.trans.z_position; func_80011570(obj, xDiff, yDiff, zDiff); - obj->segment.trans.y_rotation = obj64->someObj->segment.trans.y_rotation; - obj->segment.trans.x_rotation = obj64->someObj->segment.trans.x_rotation; - obj->segment.trans.z_rotation = obj64->someObj->segment.trans.z_rotation; + obj->segment.trans.y_rotation = obj64->unk148->segment.trans.y_rotation; + obj->segment.trans.x_rotation = obj64->unk148->segment.trans.x_rotation; + obj->segment.trans.z_rotation = obj64->unk148->segment.trans.z_rotation; obj64->unk1A4 = obj->segment.trans.z_rotation; obj64->unk1A0 = obj->segment.trans.y_rotation; obj->segment.x_velocity = xDiff / arg2; obj->segment.y_velocity = yDiff / arg2; obj->segment.z_velocity = zDiff / arg2; obj64->unk1F2 = 0; - obj64->unk2C = 0.0f; - obj64->unk30 = 0.0f; + obj64->velocity = 0.0f; + obj64->lateral_velocity = 0.0f; } #else GLOBAL_ASM("asm/non_matchings/racer/func_80050754.s") @@ -651,9 +651,9 @@ void func_800570A4(Object *obj, s32 arg1, s32 arg2) { #ifdef NON_EQUIVALENT void func_800570B8(Object *obj, s32 arg1, s32 arg2, s32 arg3) { s32 phi_t0; - Object_800570B8 *obj64; + Object_Racer *obj64; - obj64 = &obj->unk64->obj800570B8; + obj64 = &obj->unk64->racer; if ((obj64->unk108 == 0) && ((!(arg3 & 0x80)) || (D_8011D55C != -1))) { if (arg3 == 2) { if ((obj64->unk24 != 0) && (arg1 != obj64->unk2A)) { @@ -664,7 +664,7 @@ void func_800570B8(Object *obj, s32 arg1, s32 arg2, s32 arg3) { if (obj64->unk24 == 0) { if (arg3 != 3 || get_random_number_from_range(0, 1) != 0) { obj64->unk2A = arg1; - arg1 += obj64->unk3; + arg1 += obj64->characterId; arg2--; phi_t0 = (get_random_number_from_range(0, arg2) * 12) + arg1; if (arg2 > 0) { From 76b0fde74da9aa177c80fe0e538cbd87d6a72ab1 Mon Sep 17 00:00:00 2001 From: Antonio Date: Wed, 13 Apr 2022 21:38:07 -0700 Subject: [PATCH 4/9] Migrate remaining Object_64 definitions. --- include/structs.h | 63 ++++++++++++++++++++--------- src/object_functions.c | 4 +- src/object_functions.h | 4 +- src/racer.c | 48 +++++++++++----------- src/racer.h | 92 ++++-------------------------------------- src/unknown_0255E0.c | 6 +-- 6 files changed, 81 insertions(+), 136 deletions(-) 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; From d32215d5eb46f41eba66814dd15500f42cca45de Mon Sep 17 00:00:00 2001 From: Antonio Date: Wed, 13 Apr 2022 23:15:54 -0700 Subject: [PATCH 5/9] Migrate objects off of Object_Original. --- include/structs.h | 140 ++++++++++++++++++----------------------- src/game_ui.c | 8 +-- src/object_functions.c | 58 ++++++++--------- src/objects.c | 44 ++++++------- src/racer.c | 42 ++++++------- src/racer.h | 6 +- 6 files changed, 140 insertions(+), 158 deletions(-) diff --git a/include/structs.h b/include/structs.h index d6320cfc..0047f202 100644 --- a/include/structs.h +++ b/include/structs.h @@ -577,82 +577,14 @@ typedef struct Object_60 { struct Object; -typedef struct Object_Original { - union { - f32 unk0; - struct { - s8 unk0; - s8 unk1; - s8 unk2; - s8 unk3; - } unk0_b; - } unk0_a; - s32 unk4; - u8 pad8[4]; - union { - struct { - u8 byteC; - u8 byteD; - } bytes; - s16 half; - } unkCD; +typedef struct Object_LaserGun { + u8 pad0[0xC]; + s16 unkC; u8 unkE; s8 unkF; u8 unk10; u8 unk11; - u8 pad12[6]; - u8 unk18; - u8 pad19[7]; - u32 unk20; - u32 unk24; - s16 unk28; - s16 unk2A; - s32 unk2C; - s32 unk30; - s16 unk34; - s8 unk36; - u8 pad37[0x39]; - u8 unk70; - u8 unk71; - u8 unk72; - u8 unk73; - f32 unk74; - f32 unk78; - f32 unk7C; - f32 unk80; - u8 pad84[0x30]; - /* 0xB4 */ f32 throttle; - /* 0xB8 */ f32 brake; - u8 padBC[0x14]; - f32 unkD0; - u8 padD0[0x24]; - u32 unkF8; - u8 unkFC; - u8 padFD[0xB]; - s32 unk108; - u8 pad10C[0xC]; - s32 unk118; - u8 pad11C[0x44]; - s16 unk160; - s16 unk162; - s16 unk164; - s16 unk166; - u8 pad166[0x28]; - u16 unk190; - u8 unk192; - u8 unk193; - u8 pad194[0x26]; - u16 unk1BA; - u8 pad1BC[0x1A]; - s8 unk1D6; - s8 unk1D7; - s8 unk1D8; - u8 pad1D9[0x19]; - u8 unk1F2; - u8 unk1F3; - u8 pad1F4[3]; - u8 unk1F7; // Used in func_8002A900 -} Object_Original; +} Object_LaserGun; typedef struct Object_Laser { s16 unk0; @@ -685,6 +617,11 @@ typedef struct Object_WeaponBalloon { s8 unk6[0x2]; } Object_WeaponBalloon; +typedef struct Object_Weapon { + u8 pad0[0x18]; + u8 unk18; +} Object_Weapon; + typedef struct Object_Butterfly { /* 0x00 */ Triangle triangles[8]; /* 0x80 */ Vertex vertices[12]; @@ -870,7 +807,11 @@ typedef struct Object_Racer { /* 0x05C */ f32 prev_x_position; /* 0x060 */ f32 prev_y_position; /* 0x064 */ f32 prev_z_position; - /* 0x068 */ u8 pad68[0x24]; + /* 0x068 */ u8 pad68[0x10]; + /* 0x078 */ f32 unk78; + /* 0x07C */ f32 unk7C; + /* 0x080 */ f32 unk80; + /* 0x084 */ u8 pad84[0x8]; /* 0x08C */ f32 stretch_height; /* 0x090 */ f32 stretch_height_cap; /* 0x094 */ f32 camera_zoom; @@ -881,7 +822,9 @@ typedef struct Object_Racer { /* 0x0AC */ u8 padAC[0x8]; /* 0x0B4 */ f32 throttle; /* 0x0B8 */ f32 brake; - /* 0x0BC */ u8 padBC[0x4C]; + /* 0x0BC */ u8 padBC[0x14]; + /* 0x0D0 */ f32 unkD0; + /* 0x0D4 */ u8 padD4[0x34]; /* 0x108 */ s32 unk108; /* 0x10C */ u8 pad10C[0xC]; /* 0x118 */ s32 unk118; @@ -893,7 +836,12 @@ typedef struct Object_Racer { /* 0x14C */ struct Object *unk14C; /* 0x150 */ u8 pad150[0x4]; /* 0x154 */ struct Object *unk154; - /* 0x158 */ u8 pad158[0x1A]; + /* 0x158 */ u8 pad158[0x8]; + /* 0x160 */ s16 unk160; + /* 0x162 */ s16 unk162; + /* 0x164 */ s16 unk164; + /* 0x166 */ s16 unk166; + /* 0x168 */ u8 pad168[0xA]; /* 0x172 */ u8 balloon_type; /* 0x173 */ u8 balloon_quantity; /* 0x174 */ u8 balloon_level; @@ -906,11 +854,16 @@ typedef struct Object_Racer { /* 0x188 */ u8 pad188[0x4]; /* 0x18C */ s16 unk18C; /* 0x18E */ s16 unk18E; - /* 0x190 */ u8 pad190[0x10]; + /* 0x190 */ u16 unk190; + /* 0x192 */ u8 unk192; + /* 0x193 */ u8 unk193; + /* 0x194 */ u8 pad194[0xC]; /* 0x1A0 */ s16 unk1A0; /* 0x1A2 */ s16 unk1A2; /* 0x1A4 */ s16 unk1A4; - /* 0x1A6 */ u8 pad1A6[0x23]; + /* 0x1A6 */ u8 pad1A6[0x14]; + /* 0x1BA */ u16 unk1BA; + /* 0x1BC */ u8 pad1BC[0xD]; /* 0x1C9 */ u8 unk1C9; /* 0x1CA */ s8 unk1CA; /* 0x1CB */ u8 pad1CB[0x3]; @@ -935,7 +888,8 @@ typedef struct Object_Racer { /* 0x1EF */ u8 boost_sound; /* 0x1F0 */ u8 pad1F0[0x2]; /* 0x1F2 */ u8 unk1F2; - /* 0x1F3 */ u8 pad1F3[0x2]; + /* 0x1F3 */ u8 unk1F3; + /* 0x1F4 */ u8 pad1F4[0x1]; /* 0x1F5 */ u8 unk1F5; /* 0x1F6 */ u8 pad1F6[0x1]; /* 0x1F7 */ u8 transparency; @@ -1066,14 +1020,39 @@ typedef struct Object_FogChanger { s16 unk0; } Object_FogChanger; +typedef struct Object_Taj { + f32 unk0; + u8 pad4[0x9]; + u8 unkD; + u8 padE[0x1A]; + s16 unk28; + u8 pad2A[0x2]; + s32 unk2C; + u8 pad30[0x4]; + s16 unk34; + s8 unk36; +} Object_Taj; + +typedef struct Object_TT { + f32 unk0; + u8 pad4[0x9]; + u8 unkD; +} Object_TT; + +typedef struct Object_Bridge_WhaleRamp { + f32 unk0; + s32 unk4; +} Object_Bridge_WhaleRamp; + typedef struct Object_64 { union { - Object_Original original; + Object_LaserGun laser_gun; Object_Laser laser; Object_TrophyCabinet trophy_cabinet; Object_Animator animator; Object_Animation animation; Object_WeaponBalloon weapon_balloon; + Object_Weapon weapon; Object_Butterfly butterfly; Object_EffectBox effect_box; Object_EggCreator egg_creator; @@ -1104,6 +1083,9 @@ typedef struct Object_64 { Object_PosArrow pos_arrow; Object_Banana banana; Object_FogChanger fog_changer; + Object_Taj taj; + Object_TT tt; + Object_Bridge_WhaleRamp bridge_whale_ramp; }; } Object_64; diff --git a/src/game_ui.c b/src/game_ui.c index a5be8017..a4f9bc72 100644 --- a/src/game_ui.c +++ b/src/game_ui.c @@ -269,7 +269,7 @@ void func_800A0B74(void) { GLOBAL_ASM("asm/non_matchings/game_ui/func_800A0BD4.s") void func_800A0DC0(s32 arg0, Object *arg1, s32 arg2) { - Object_64 *temp = arg1->unk64; + Object_Racer *temp = &arg1->unk64->racer; func_80068508(1); func_800A0EB4(temp, arg2); @@ -285,7 +285,7 @@ void func_800A0DC0(s32 arg0, Object *arg1, s32 arg2) { func_800A4C44(temp, arg2); func_800A3884(arg1, arg2); - if (D_80127188 != 0 && temp->original.unk1D8 == 0) { + if (D_80127188 != 0 && temp->unk1D8 == 0) { func_800A47A0(temp, arg2); } @@ -297,8 +297,8 @@ GLOBAL_ASM("asm/non_matchings/game_ui/func_800A0EB4.s") GLOBAL_ASM("asm/non_matchings/game_ui/func_800A1248.s") void func_800A1428(s32 arg0, Object *arg1, s32 arg2) { - Object_64 *temp = arg1->unk64; - if (temp->original.unk1D8 == 0) { + Object_Racer *temp = &arg1->unk64->racer; + if (temp->unk1D8 == 0) { func_80068508(1); func_800A3CE4(arg0, arg2); func_800A7520(arg1, arg2); diff --git a/src/object_functions.c b/src/object_functions.c index a867be8a..b3f11ca1 100644 --- a/src/object_functions.c +++ b/src/object_functions.c @@ -337,15 +337,15 @@ GLOBAL_ASM("asm/non_matchings/unknown_032760/obj_loop_fireball_octoweapon.s") #endif void obj_init_lasergun(Object *obj, LevelObjectEntry_Lasergun *entry) { - Object_64 *obj64; + Object_LaserGun *obj64; obj->unk4C->unk14 = 0x22; obj->unk4C->unk11 = 0; - obj64 = obj->unk64; - obj64->original.unkE = entry->unkA; - obj64->original.unkF = entry->unkB; - obj64->original.unk10 = entry->unkC; - obj64->original.unk11 = entry->unkD; - obj64->original.unkCD.half = obj64->original.unkF; + obj64 = &obj->unk64->laser_gun; + obj64->unkE = entry->unkA; + obj64->unkF = entry->unkB; + obj64->unk10 = entry->unkC; + obj64->unk11 = entry->unkD; + obj64->unkC = obj64->unkF; obj->segment.trans.y_rotation = entry->unk8 << 4 << 4; // Not sure about the shift amounts here, but it obj->segment.trans.x_rotation = entry->unk9 << 4 << 4; // just needs to be 2 left shifts that add up to 8. } @@ -965,14 +965,14 @@ void obj_loop_characterflag(Object *obj, UNUSED s32 speed) { GLOBAL_ASM("asm/non_matchings/unknown_032760/func_80036040.s") void obj_init_stopwatchman(Object *obj, UNUSED LevelObjectEntry_StopWatchMan *entry) { - Object_64 *temp; + Object_TT *temp; obj->unk4C->unk14 = 1; obj->unk4C->unk11 = 0; obj->unk4C->unk10 = 0x1E; obj->unk4C->unk12 = 0; - temp = obj->unk64; - temp->original.unkCD.bytes.byteD = 0xFF; - temp->original.unk0_a.unk0 = 0.0f; + temp = &obj->unk64->tt; + temp->unkD = 0xFF; + temp->unk0 = 0.0f; D_8011D4D8 = 0; } @@ -1593,18 +1593,18 @@ void obj_loop_dino_whale(Object *obj, s32 speed) { } void obj_init_parkwarden(Object *obj, UNUSED LevelObjectEntry_Parkwarden *entry) { - Object_64 *temp; + Object_Taj *temp; obj->unk4C->unk14 = (u16)1; obj->unk4C->unk11 = (u8)0; obj->unk4C->unk10 = (u8)0x1E; obj->unk4C->unk12 = (u8)0; - temp = obj->unk64; - temp->original.unkCD.bytes.byteD = 0xFF; - temp->original.unk0_a.unk0 = 0.0f; - temp->original.unk28 = 0; - temp->original.unk2C = 0; - temp->original.unk34 = 0; - temp->original.unk36 = 0; + temp = &obj->unk64->taj; + temp->unkD = 0xFF; + temp->unk0 = 0.0f; + temp->unk28 = 0; + temp->unk2C = 0; + temp->unk34 = 0; + temp->unk36 = 0; D_8011D4D4 = 0; D_8011D4E2 = 0x10F; } @@ -1971,15 +1971,15 @@ void obj_init_trigger(Object *obj, LevelObjectEntry_Trigger *entry) { GLOBAL_ASM("asm/non_matchings/unknown_032760/obj_loop_trigger.s") void obj_init_bridge_whaleramp(Object *obj, LevelObjectEntry_Bridge_WhaleRamp *entry) { - Object_64 *temp = obj->unk64; + Object_Bridge_WhaleRamp *temp = &obj->unk64->bridge_whale_ramp; obj->segment.unk3A = entry->unk8; obj->segment.trans.y_rotation = entry->unk9 << 6 << 4; - temp->original.unk0_a.unk0 = obj->segment.trans.y_position; + temp->unk0 = obj->segment.trans.y_position; obj->unk4C->unk14 = 0x21; obj->unk4C->unk11 = 2; obj->unk4C->unk10 = 0x14; obj->unk4C->unk12 = 0; - temp->original.unk4 = 0; + temp->unk4 = 0; if (obj->segment.unk3A >= obj->segment.header->numberOfModelIds) { obj->segment.unk3A = 0; } @@ -2254,8 +2254,8 @@ void obj_init_weapon(Object *obj, UNUSED LevelObjectEntry_Weapon *entry) { } void obj_loop_weapon(Object *obj, s32 speed) { - Object_64 *obj64 = obj->unk64; - switch (obj64->original.unk18) { + Object_Weapon *obj64 = &obj->unk64->weapon; + switch (obj64->unk18) { case 0: case 1: func_8003E694(obj, speed); @@ -2706,18 +2706,18 @@ GLOBAL_ASM("asm/non_matchings/unknown_032760/obj_loop_frog.s") void obj_loop_pigrocketeer(Object *obj, s32 speed) { Object *someObj; - Object_64 *obj64; + Object_Wizpig2 *obj64; func_8001F460(obj, speed, obj); someObj = func_8000BF44(-1); if (someObj != NULL) { - obj64 = someObj->unk64; + obj64 = &someObj->unk64->wizpig2; someObj->unk78 = 0; if (obj64 != 0) { - obj64->original.unk72 += speed; - obj64->original.unk70 = 2; - obj64->original.unk74 = 1.0f; + obj64->unk72 += speed; + obj64->unk70 = 2; + obj64->unk74 = 1.0f; func_8000B750(obj, -1, 2, 1, 1); } } diff --git a/src/objects.c b/src/objects.c index 76997326..db679de6 100644 --- a/src/objects.c +++ b/src/objects.c @@ -936,7 +936,7 @@ void func_80012D5C(Gfx **dlist, Mtx **mats, VertexList **verts, Object *object) void func_80012E28(Object *this) { s32 unused1; - Object_64 *sp_20; + Object_Racer *sp_20; f32 tmp_f2; f32 sp_1c; f32 tmp_f0; @@ -944,20 +944,20 @@ void func_80012E28(Object *this) { if (this->behaviorId == 1) { - sp_20 = this->unk64; - this->segment.trans.y_rotation += sp_20->original.unk160; - this->segment.trans.x_rotation += sp_20->original.unk162; - this->segment.trans.z_rotation += sp_20->original.unk164; + sp_20 = &this->unk64->racer; + this->segment.trans.y_rotation += sp_20->unk160; + this->segment.trans.x_rotation += sp_20->unk162; + this->segment.trans.z_rotation += sp_20->unk164; sp_1c = 0.0f; - if (sp_20->original.unk1D7 < 5) { + if (sp_20->unk1D7 < 5) { - sp_1c = func_800707F8(sp_20->original.unk164); + sp_1c = func_800707F8(sp_20->unk164); tmp_f2 = sp_1c; - tmp_f0 = func_800707F8(sp_20->original.unk162 - sp_20->original.unk166) * tmp_f2; + tmp_f0 = func_800707F8(sp_20->unk162 - sp_20->unk166) * tmp_f2; tmp_f0 = (tmp_f0 < 0.0f) ? 0.0f : tmp_f0 * tmp_f0; - temp = (1.0f - tmp_f0) * 24.0f + sp_20->original.unkD0; + temp = (1.0f - tmp_f0) * 24.0f + sp_20->unkD0; if(0){} sp_1c = temp; } @@ -968,10 +968,10 @@ void func_80012E28(Object *this) { void func_80012F30(Object *arg0) { if (arg0->behaviorId == 1) { - Object_64 *object_64 = arg0->unk64; - arg0->segment.trans.y_rotation -= object_64->original.unk160; - arg0->segment.trans.x_rotation -= object_64->original.unk162; - arg0->segment.trans.z_rotation -= object_64->original.unk164; + Object_Racer *object_64 = &arg0->unk64->racer; + arg0->segment.trans.y_rotation -= object_64->unk160; + arg0->segment.trans.x_rotation -= object_64->unk162; + arg0->segment.trans.z_rotation -= object_64->unk164; arg0->segment.trans.y_position -= D_8011ADD0; } } @@ -995,9 +995,9 @@ void render_object(Object *this) { void func_80013548(Object *arg0) { if ((arg0->segment.trans.unk6 & 0x8000) == 0 && arg0->segment.header->behaviorId == 1) { - arg0->segment.trans.x_position -= arg0->unk64->original.unk78; - arg0->segment.trans.y_position -= arg0->unk64->original.unk7C; - arg0->segment.trans.z_position -= arg0->unk64->original.unk80; + arg0->segment.trans.x_position -= arg0->unk64->racer.unk78; + arg0->segment.trans.y_position -= arg0->unk64->racer.unk7C; + arg0->segment.trans.z_position -= arg0->unk64->racer.unk80; } } @@ -1432,14 +1432,14 @@ UNUSED void func_800228DC(UNUSED s32 arg0, UNUSED s32 arg1, UNUSED s32 arg2) { } void func_800228EC(s32 arg0) { - Object_64 *object_64; + Object_Racer *object_64; D_8011AEF7 = 3; - object_64 = get_object_struct(0)->unk64; - object_64->original.unk190 = 0; - object_64->original.unk192 = 0; - object_64->original.unk193 = 0; - object_64->original.unk1BA = 0; + object_64 = &get_object_struct(0)->unk64->racer; + object_64->unk190 = 0; + object_64->unk192 = 0; + object_64->unk193 = 0; + object_64->unk1BA = 0; func_80017E74(arg0); func_8006F388(10); } diff --git a/src/racer.c b/src/racer.c index f50c652e..f6379989 100644 --- a/src/racer.c +++ b/src/racer.c @@ -490,12 +490,12 @@ void func_8005234C(unk8005234C *arg0) { GLOBAL_ASM("asm/non_matchings/racer/func_80052388.s") GLOBAL_ASM("asm/non_matchings/racer/func_8005250C.s") -void func_80052988(Object *arg0, Object_64 *arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7) { +void func_80052988(Object *arg0, Object_Racer *arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7) { arg5 *= arg7; if ((D_8011D55C == -1) && (arg2 >= 3)) { arg0->segment.unk3B = 0; - arg1->original.unk1F2 = 0; + arg1->unk1F2 = 0; } else if (arg0->segment.unk3B == 0) { if (arg6 & 1) { if (arg0->segment.unk18 >= 0x29) { @@ -514,24 +514,24 @@ void func_80052988(Object *arg0, Object_64 *arg1, s32 arg2, s32 arg3, s32 arg4, } else { arg0->segment.unk3B = arg2; arg0->segment.unk18 = arg3; - arg1->original.unk1F3 &= ~0x80; + arg1->unk1F3 &= ~0x80; } } else if (arg0->segment.unk3B == arg2) { if (arg6 & 2) { - if (arg1->original.unk1F3 & 0x80) { + if (arg1->unk1F3 & 0x80) { arg0->segment.unk18 -= arg5; if (arg0->segment.unk18 <= 0) { arg0->segment.unk3B = 0; - arg1->original.unk1F2 = 0; + arg1->unk1F2 = 0; arg0->segment.unk18 = 0x28; - arg1->original.unk1F3 = 0; + arg1->unk1F3 = 0; } } else { arg0->segment.unk18 += arg5; if (arg0->segment.unk18 >= arg4) { arg0->segment.unk18 = arg4 - 1; if ((arg6 & 4) == 0) { - arg1->original.unk1F3 |= 0x80; + arg1->unk1F3 |= 0x80; } } } @@ -539,9 +539,9 @@ void func_80052988(Object *arg0, Object_64 *arg1, s32 arg2, s32 arg3, s32 arg4, arg0->segment.unk18 += arg5; if (arg0->segment.unk18 >= arg4) { arg0->segment.unk3B = 0; - arg1->original.unk1F2 = 0; + arg1->unk1F2 = 0; arg0->segment.unk18 = 0x28; - arg1->original.unk1F3 = 0; + arg1->unk1F3 = 0; } } } else { @@ -593,23 +593,23 @@ void func_800535C4(unk800535C4 *arg0, unk800535C4_2 *arg1) { guMtxXFMF(mf, 0.0f, -1.0f, 0.0f, &arg1->ox, &arg1->oy, &arg1->oz); } -void func_80053664(Object_64 *arg0) { - if (arg0->original.throttle > 0.0) { - arg0->original.throttle -= 0.1; +void func_80053664(Object_Racer *arg0) { + if (arg0->throttle > 0.0) { + arg0->throttle -= 0.1; } if (D_8011D528 & 0x8000) { - arg0->original.throttle = 1.0f; + arg0->throttle = 1.0f; } if (D_8011D528 & 0x4000) { - if (arg0->original.brake < 1.0) { - arg0->original.brake += 0.2; + if (arg0->brake < 1.0) { + arg0->brake += 0.2; } } else { //! @bug Will cause a negative brake value resulting in higher velocity - if (arg0->original.brake > 0.05) { - arg0->original.brake -= 0.1; + if (arg0->brake > 0.05) { + arg0->brake -= 0.1; } } } @@ -622,13 +622,13 @@ GLOBAL_ASM("asm/non_matchings/racer/func_80054FD0.s") GLOBAL_ASM("asm/non_matchings/racer/func_80055A84.s") GLOBAL_ASM("asm/non_matchings/racer/func_80055EC0.s") -void play_char_horn_sound(Object *obj, Object_64 *obj64) { +void play_char_horn_sound(Object *obj, Object_Racer *obj64) { if (get_filtered_cheats() & CHEAT_HORN_CHEAT) { // Play character voice instead of horn. func_800570B8(obj, 0x162, 8, 0x82); } else { // Play character's horn sound - func_80057048(obj, obj64->original.unk0_a.unk0_b.unk3 + 0x156); + func_80057048(obj, obj64->characterId + 0x156); } } @@ -636,8 +636,8 @@ GLOBAL_ASM("asm/non_matchings/racer/func_8005698C.s") GLOBAL_ASM("asm/non_matchings/racer/func_80056E2C.s") void func_80057048(Object *obj, s32 arg1) { - Object_64 *obj64 = obj->unk64; - if (D_8011D55C != -1 && obj64->original.unk108 == 0) { + Object_Racer *obj64 = &obj->unk64->racer; + if (D_8011D55C != -1 && obj64->unk108 == 0) { func_80001EA8(arg1, obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position, NULL); } } diff --git a/src/racer.h b/src/racer.h index d7ba0de7..dd396d73 100644 --- a/src/racer.h +++ b/src/racer.h @@ -129,11 +129,11 @@ 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_80052988(Object *arg0, Object_Racer *arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7); 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_80053664(Object_Racer *arg0); +void play_char_horn_sound(Object *obj, Object_Racer *obj64); void func_80057048(Object *obj, s32 arg1); void func_800570A4(Object *obj, s32 arg1, s32 arg2); void func_800575EC(Object *obj, Object_Racer *obj64); From 83c9de2db6c7d8ac08ac4ec71265b75cba315f67 Mon Sep 17 00:00:00 2001 From: Antonio Date: Thu, 14 Apr 2022 00:09:23 -0700 Subject: [PATCH 6/9] Minor rename. --- include/structs.h | 6 +++--- src/object_functions.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/structs.h b/include/structs.h index 0047f202..f3cbc83a 100644 --- a/include/structs.h +++ b/include/structs.h @@ -665,10 +665,10 @@ typedef struct Object_CharacterFlag { u8 *unk24; } Object_CharacterFlag; -typedef struct Object_80035F6C_2 { +typedef struct Object_80035F6C { u8 pad0[3]; s8 unk3; -} Object_80035F6C_2; +} Object_80035F6C; typedef struct Object_Snowball { u8 pad0[0x20]; @@ -1058,7 +1058,7 @@ typedef struct Object_64 { Object_EggCreator egg_creator; Object_UnkId58 unkid58; Object_CharacterFlag character_flag; - Object_80035F6C_2 obj80035F6C_2; + Object_80035F6C obj80035F6C; Object_Snowball snowball; Object_AnimCamera anim_camera; Object_AnimCar anim_car; diff --git a/src/object_functions.c b/src/object_functions.c index b3f11ca1..0601a45d 100644 --- a/src/object_functions.c +++ b/src/object_functions.c @@ -935,13 +935,13 @@ void obj_loop_characterflag(Object *obj, UNUSED s32 speed) { s32 temp_t5; Object *someObj; Object_CharacterFlag *obj64; - Object_80035F6C_2 *someObj64; + Object_80035F6C *someObj64; if (obj->unk7C.word < 0) { someObj = get_object_struct(obj->unk78); if (someObj != NULL) { obj64 = &obj->unk64->character_flag; - someObj64 = &someObj->unk64->obj80035F6C_2; + someObj64 = &someObj->unk64->obj80035F6C; obj->unk7C.word = someObj64->unk3; if (obj->unk7C.word < 0 || obj->unk7C.word >= 0xA) { obj->unk7C.word = 0; From 5b6eeefc02d060ef1626ad801f9acb0137f91f97 Mon Sep 17 00:00:00 2001 From: Antonio Date: Thu, 14 Apr 2022 00:25:36 -0700 Subject: [PATCH 7/9] Make consistent offset comments. --- include/structs.h | 434 +++++++++++++++++++++++----------------------- 1 file changed, 217 insertions(+), 217 deletions(-) diff --git a/include/structs.h b/include/structs.h index f3cbc83a..2129258c 100644 --- a/include/structs.h +++ b/include/structs.h @@ -578,32 +578,32 @@ typedef struct Object_60 { struct Object; typedef struct Object_LaserGun { - u8 pad0[0xC]; - s16 unkC; - u8 unkE; - s8 unkF; - u8 unk10; - u8 unk11; + /* 0x00 */ u8 pad0[0xC]; + /* 0x0C */ s16 unkC; + /* 0x0E */ u8 unkE; + /* 0x0F */ s8 unkF; + /* 0x10 */ u8 unk10; + /* 0x11 */ u8 unk11; } Object_LaserGun; typedef struct Object_Laser { - s16 unk0; - u8 unk4[0x185]; - s8 unk187; + /* 0x000 */ s16 unk0; + /* 0x004 */ u8 unk4[0x185]; + /* 0x187 */ s8 unk187; } Object_Laser; typedef struct Object_TrophyCabinet { - s32 unk0; - s16 unk4; + /* 0x0 */ s32 unk0; + /* 0x4 */ s16 unk4; } Object_TrophyCabinet; typedef struct Object_Animator { - /* 0x00 */ s16 segmentId; - /* 0x02 */ s16 batchId; - /* 0x04 */ s16 xSpeedFactor; - /* 0x06 */ s16 ySpeedFactor; - /* 0x08 */ s16 xSpeed; - /* 0x0A */ s16 ySpeed; + /* 0x00 */ s16 segmentId; + /* 0x02 */ s16 batchId; + /* 0x04 */ s16 xSpeedFactor; + /* 0x06 */ s16 ySpeedFactor; + /* 0x08 */ s16 xSpeed; + /* 0x0A */ s16 ySpeed; } Object_Animator; typedef struct Object_Animation { @@ -612,24 +612,24 @@ typedef struct Object_Animation { } Object_Animation; typedef struct Object_WeaponBalloon { - f32 unk0; - s16 unk4; - s8 unk6[0x2]; + /* 0x0 */ f32 unk0; + /* 0x4 */ s16 unk4; + /* 0x6 */ s8 unk6[0x2]; } Object_WeaponBalloon; typedef struct Object_Weapon { - u8 pad0[0x18]; - u8 unk18; + /* 0x00 */ u8 pad0[0x18]; + /* 0x18 */ u8 unk18; } Object_Weapon; typedef struct Object_Butterfly { - /* 0x00 */ Triangle triangles[8]; - /* 0x80 */ Vertex vertices[12]; - /* 0xF8 */ TextureHeader *texture; - /* 0xFC */ u8 unkFC; - /* 0xFD */ u8 unkFD; - /* 0xFE */ u8 unkFE; - /* 0xFF */ u8 unkFF; + /* 0x000 */ Triangle triangles[8]; + /* 0x080 */ Vertex vertices[12]; + /* 0x0F8 */ TextureHeader *texture; + /* 0x0FC */ u8 unkFC; + /* 0x0FD */ u8 unkFD; + /* 0x0FE */ u8 unkFE; + /* 0x0FF */ u8 unkFF; /* 0x100 */ s32 unk100; /* 0x104 */ s16 unk104; /* 0x106 */ s16 unk106; @@ -637,151 +637,151 @@ typedef struct Object_Butterfly { } Object_Butterfly; typedef struct Object_EffectBox { - u8 pad0[0x1FE]; - u8 unk1FE; - u8 unk1FF; + /* 0x000 */ u8 pad0[0x1FE]; + /* 0x1FE */ u8 unk1FE; + /* 0x1FF */ u8 unk1FF; } Object_EffectBox; typedef struct Object_EggCreator { - u8 pad0[4]; - struct Object *unk4; + /* 0x0 */ u8 pad0[4]; + /* 0x4 */ struct Object *unk4; } Object_EggCreator; typedef struct Object_UnkId58 { - u8 pad0[0x1D6]; - s8 unk1D6; + /* 0x000 */ u8 pad0[0x1D6]; + /* 0x1D6 */ s8 unk1D6; } Object_UnkId58; typedef struct Object_CharacterFlag { - s32 unk0; - s32 unk4; - s32 unk8; - s32 unkC; - s32 unk10; - s32 unk14; - s32 unk18; - s32 unk1C; - s16 *unk20; - u8 *unk24; + /* 0x00 */ s32 unk0; + /* 0x04 */ s32 unk4; + /* 0x08 */ s32 unk8; + /* 0x0C */ s32 unkC; + /* 0x10 */ s32 unk10; + /* 0x14 */ s32 unk14; + /* 0x18 */ s32 unk18; + /* 0x1C */ s32 unk1C; + /* 0x20 */ s16 *unk20; + /* 0x24 */ u8 *unk24; } Object_CharacterFlag; typedef struct Object_80035F6C { - u8 pad0[3]; - s8 unk3; + /* 0x0 */ u8 pad0[3]; + /* 0x3 */ s8 unk3; } Object_80035F6C; typedef struct Object_Snowball { - u8 pad0[0x20]; - u32 unk20; - s16 unk24; - u8 pad28[0x12]; - s8 unk38; + /* 0x00 */ u8 pad0[0x20]; + /* 0x20 */ u32 unk20; + /* 0x24 */ s16 unk24; + /* 0x28 */ u8 pad28[0x12]; + /* 0x38 */ s8 unk38; } Object_Snowball; typedef struct Object_AnimCamera { - u8 pad0[0x30]; - s8 unk30; - u8 pad31[0x13]; - s8 unk44; + /* 0x00 */ u8 pad0[0x30]; + /* 0x30 */ s8 unk30; + /* 0x31 */ u8 pad31[0x13]; + /* 0x44 */ s8 unk44; } Object_AnimCamera; typedef struct Object_AnimCar { - u8 pad0[0x148]; - struct Object *unk148; + /* 0x000 */ u8 pad0[0x148]; + /* 0x148 */ struct Object *unk148; } Object_AnimCar; typedef struct Object_InfoPoint { - s16 unk0; + /* 0x0 */ s16 unk0; } Object_InfoPoint; typedef struct Object_TTDoor { - f32 unk0; - u8 pad4[4]; - s32 unk8; - u8 padC[3]; - s8 unkF; - u8 pad10[2]; - u8 unk12; - u8 unk13; + /* 0x00 */ f32 unk0; + /* 0x04 */ u8 pad4[4]; + /* 0x08 */ s32 unk8; + /* 0x0C */ u8 padC[3]; + /* 0x0F */ s8 unkF; + /* 0x10 */ u8 pad10[2]; + /* 0x12 */ u8 unk12; + /* 0x13 */ u8 unk13; } Object_TTDoor; typedef struct Object_WorldKey { - s16 unk0; + /* 0x0 */ s16 unk0; } Object_WorldKey; typedef struct Object_AudioLine { - u8 unk0; - u8 pad1; - u16 unk2; - u16 unk4; - u16 unk6; - union { - struct { - u8 unk8; - u8 unk9; - u8 unkA; - u8 padB; - } unk_struct; - s32 unk8_word; - } unk_union; - u8 unkC; - u8 unkD; - u8 unkE; - u8 unkF; - u8 unk10; - u8 unk11; - u8 unk12; + /* 0x00 */ u8 unk0; + /* 0x01 */ u8 pad1; + /* 0x02 */ u16 unk2; + /* 0x04 */ u16 unk4; + /* 0x06 */ u16 unk6; + /* 0x08 */ union { + struct { + u8 unk8; + u8 unk9; + u8 unkA; + u8 padB; + } unk_struct; + s32 unk8_word; + } unk_union; + /* 0x0C */ u8 unkC; + /* 0x0D */ u8 unkD; + /* 0x0E */ u8 unkE; + /* 0x0F */ u8 unkF; + /* 0x10 */ u8 unk10; + /* 0x11 */ u8 unk11; + /* 0x12 */ u8 unk12; } Object_AudioLine; typedef struct Object_AudioReverb { - u16 pad0; - s16 unk2; - u8 unk4; - u8 unk5; + /* 0x0 */ u16 pad0; + /* 0x2 */ s16 unk2; + /* 0x4 */ u8 unk4; + /* 0x5 */ u8 unk5; } Object_AudioReverb; typedef struct Object_TexScroll { - s16 unk0; - s16 pad2; - s16 unk4; - s16 unk6; - s16 unk8; - s16 unkA; + /* 0x0 */ s16 unk0; + /* 0x2 */ s16 pad2; + /* 0x4 */ s16 unk4; + /* 0x6 */ s16 unk6; + /* 0x8 */ s16 unk8; + /* 0xA */ s16 unkA; } Object_TexScroll; typedef struct Object_Frog { - f32 unk0; - f32 unk4; - f32 unk8; - f32 unkC; - f32 unk10; - u8 unk14; - u8 unk15; - u8 pad16[3]; - u8 unk19; - u8 pad1A[6]; - f32 unk20; - f32 unk24; - u8 pad28[8]; - f32 unk30; + /* 0x00 */ f32 unk0; + /* 0x04 */ f32 unk4; + /* 0x08 */ f32 unk8; + /* 0x0C */ f32 unkC; + /* 0x10 */ f32 unk10; + /* 0x14 */ u8 unk14; + /* 0x15 */ u8 unk15; + /* 0x16 */ u8 pad16[3]; + /* 0x19 */ u8 unk19; + /* 0x1A */ u8 pad1A[6]; + /* 0x20 */ f32 unk20; + /* 0x24 */ f32 unk24; + /* 0x28 */ u8 pad28[8]; + /* 0x30 */ f32 unk30; } Object_Frog; typedef struct Object_Wizpig2 { - u8 pad0[0x70]; - u8 unk70; - u8 pad71; - u8 unk72; - u8 pad73; - f32 unk74; + /* 0x00 */ u8 pad0[0x70]; + /* 0x70 */ u8 unk70; + /* 0x71 */ u8 pad71; + /* 0x72 */ u8 unk72; + /* 0x73 */ u8 pad73; + /* 0x74 */ f32 unk74; } Object_Wizpig2; typedef struct Object_Exit { - f32 unk0; - f32 unk4; - f32 unk8; - f32 unkC; - s32 unk10; - s8 unk14; + /* 0x00 */ f32 unk0; + /* 0x04 */ f32 unk4; + /* 0x08 */ f32 unk8; + /* 0x0C */ f32 unkC; + /* 0x10 */ s32 unk10; + /* 0x14 */ s8 unk14; } Object_Exit; typedef struct Object_Racer { @@ -893,8 +893,8 @@ typedef struct Object_Racer { /* 0x1F5 */ u8 unk1F5; /* 0x1F6 */ u8 pad1F6[0x1]; /* 0x1F7 */ u8 transparency; - /* 0x0290 */ u8 indicator_type; - /* 0x0291 */ s8 indicator_timer; + /* 0x290 */ u8 indicator_type; + /* 0x291 */ s8 indicator_timer; /* 0x1FA */ u8 pad1FA[0x6]; /* 0x200 */ s8 unk200; /* 0x201 */ u8 pad201[0x2]; @@ -914,134 +914,134 @@ typedef struct Object_Racer { } Object_Racer; typedef struct Object_Bonus { - f32 unk0; - f32 unk4; - f32 unk8; - f32 unkC; - s32 unk10; - s8 unk14; + /* 0x00 */ f32 unk0; + /* 0x04 */ f32 unk4; + /* 0x08 */ f32 unk8; + /* 0x0C */ f32 unkC; + /* 0x10 */ s32 unk10; + /* 0x14 */ s8 unk14; } Object_Bonus; typedef struct Object_ModeChange { - f32 unk0; - f32 unk4; - f32 unk8; - f32 unkC; - s32 unk10; - s8 unk14; + /* 0x00 */ f32 unk0; + /* 0x04 */ f32 unk4; + /* 0x08 */ f32 unk8; + /* 0x0C */ f32 unkC; + /* 0x10 */ s32 unk10; + /* 0x14 */ s8 unk14; } Object_ModeChange; typedef struct Object_GoldenBalloon { - f32 unk0; - u8 pad4[0x8]; - u8 unkC; - u8 unkD; - u8 unkE; - u8 unkF; - s8 unk10; - f32 unk14; + /* 0x00 */ f32 unk0; + /* 0x04 */ u8 pad4[0x8]; + /* 0x0C */ u8 unkC; + /* 0x0D */ u8 unkD; + /* 0x0E */ u8 unkE; + /* 0x0F */ u8 unkF; + /* 0x10 */ s8 unk10; + /* 0x14 */ f32 unk14; } Object_GoldenBalloon; typedef struct Object_Door { - f32 unk0; - u8 pad4[0x4]; - s32 unk8; - s16 padA; - s8 unkE; - u8 unkF; - u8 unk10; - u8 unk11; - u8 unk12; - u8 unk13; - u8 unk14; + /* 0x00 */ f32 unk0; + /* 0x04 */ u8 pad4[0x4]; + /* 0x08 */ s32 unk8; + /* 0x0A */ s16 padA; + /* 0x0E */ s8 unkE; + /* 0x0F */ u8 unkF; + /* 0x10 */ u8 unk10; + /* 0x11 */ u8 unk11; + /* 0x12 */ u8 unk12; + /* 0x13 */ u8 unk13; + /* 0x14 */ u8 unk14; } Object_Door; typedef struct Object_Trigger { - f32 unk0; - f32 unk4; - f32 unk8; - f32 unkC; - s32 unk10; - s8 unk14; + /* 0x00 */ f32 unk0; + /* 0x04 */ f32 unk4; + /* 0x08 */ f32 unk8; + /* 0x0C */ f32 unkC; + /* 0x10 */ s32 unk10; + /* 0x14 */ s8 unk14; } Object_Trigger; typedef struct Object_Audio { - /* 0x00 */ u16 unk0; - /* 0x02 */ u16 unk2; - /* 0x04 */ u8 unk4; - /* 0x05 */ u8 unk5; - /* 0x06 */ u8 unk6; - /* 0x07 */ u8 unk7; - /* 0x08 */ s32 unk8; - /* 0x0C */ u8 unkC; - /* 0x0D */ u8 unkD; + /* 0x00 */ u16 unk0; + /* 0x02 */ u16 unk2; + /* 0x04 */ u8 unk4; + /* 0x05 */ u8 unk5; + /* 0x06 */ u8 unk6; + /* 0x07 */ u8 unk7; + /* 0x08 */ s32 unk8; + /* 0x0C */ u8 unkC; + /* 0x0D */ u8 unkD; } Object_Audio; typedef struct Object_MidiFade { - u8 unk0; - u8 unk1; - u8 unk2; - f32 unk4; - f32 unk8; - f32 unkC; - f32 unk10; - f32 unk14; - f32 unk18; - f32 unk1C; - f32 unk20; - f32 unk24; - f32 unk28; - f32 unk2C; - u8 unk2F[16]; - u8 unk40; + /* 0x00 */ u8 unk0; + /* 0x01 */ u8 unk1; + /* 0x02 */ u8 unk2; + /* 0x04 */ f32 unk4; + /* 0x08 */ f32 unk8; + /* 0x0C */ f32 unkC; + /* 0x10 */ f32 unk10; + /* 0x14 */ f32 unk14; + /* 0x18 */ f32 unk18; + /* 0x1C */ f32 unk1C; + /* 0x20 */ f32 unk20; + /* 0x24 */ f32 unk24; + /* 0x28 */ f32 unk28; + /* 0x2C */ f32 unk2C; + /* 0x2F */ u8 unk2F[16]; + /* 0x40 */ u8 unk40; } Object_MidiFade; typedef struct Object_MidiFadePoint { - u16 unk0; - u16 unk2; - f32 unk4; - f32 unk8; - u8 unkC[16]; - u8 unk1C; + /* 0x00 */ u16 unk0; + /* 0x02 */ u16 unk2; + /* 0x04 */ f32 unk4; + /* 0x08 */ f32 unk8; + /* 0x0C */ u8 unkC[16]; + /* 0x1C */ u8 unk1C; } Object_MidiFadePoint; typedef struct Object_PosArrow { - s16 unk0; - u8 pad4[0x14E]; - struct Object *unk150; + /* 0x000 */ s16 unk0; + /* 0x004 */ u8 pad4[0x14E]; + /* 0x150 */ struct Object *unk150; } Object_PosArrow; typedef struct Object_Banana { - u8 pad0[4]; - struct Object *spawner; + /* 0x0 */ u8 pad0[4]; + /* 0x4 */ struct Object *spawner; } Object_Banana; typedef struct Object_FogChanger { - s16 unk0; + /* 0x0 */ s16 unk0; } Object_FogChanger; typedef struct Object_Taj { - f32 unk0; - u8 pad4[0x9]; - u8 unkD; - u8 padE[0x1A]; - s16 unk28; - u8 pad2A[0x2]; - s32 unk2C; - u8 pad30[0x4]; - s16 unk34; - s8 unk36; + /* 0x00 */ f32 unk0; + /* 0x04 */ u8 pad4[0x9]; + /* 0x0D */ u8 unkD; + /* 0x0E */ u8 padE[0x1A]; + /* 0x28 */ s16 unk28; + /* 0x2A */ u8 pad2A[0x2]; + /* 0x2C */ s32 unk2C; + /* 0x30 */ u8 pad30[0x4]; + /* 0x34 */ s16 unk34; + /* 0x36 */ s8 unk36; } Object_Taj; typedef struct Object_TT { - f32 unk0; - u8 pad4[0x9]; - u8 unkD; + /* 0x0 */ f32 unk0; + /* 0x4 */ u8 pad4[0x9]; + /* 0xD */ u8 unkD; } Object_TT; typedef struct Object_Bridge_WhaleRamp { - f32 unk0; - s32 unk4; + /* 0x0 */ f32 unk0; + /* 0x4 */ s32 unk4; } Object_Bridge_WhaleRamp; typedef struct Object_64 { From 4328930d91dd340d34afd5e5675ccd79dcdab1cd Mon Sep 17 00:00:00 2001 From: Antonio Date: Thu, 14 Apr 2022 18:48:14 -0700 Subject: [PATCH 8/9] Remove Object_80035F6C. --- include/structs.h | 6 ------ src/object_functions.c | 6 +++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/include/structs.h b/include/structs.h index 2129258c..eb049bcf 100644 --- a/include/structs.h +++ b/include/structs.h @@ -665,11 +665,6 @@ typedef struct Object_CharacterFlag { /* 0x24 */ u8 *unk24; } Object_CharacterFlag; -typedef struct Object_80035F6C { - /* 0x0 */ u8 pad0[3]; - /* 0x3 */ s8 unk3; -} Object_80035F6C; - typedef struct Object_Snowball { /* 0x00 */ u8 pad0[0x20]; /* 0x20 */ u32 unk20; @@ -1058,7 +1053,6 @@ typedef struct Object_64 { Object_EggCreator egg_creator; Object_UnkId58 unkid58; Object_CharacterFlag character_flag; - Object_80035F6C obj80035F6C; Object_Snowball snowball; Object_AnimCamera anim_camera; Object_AnimCar anim_car; diff --git a/src/object_functions.c b/src/object_functions.c index 0601a45d..42c6cc98 100644 --- a/src/object_functions.c +++ b/src/object_functions.c @@ -935,14 +935,14 @@ void obj_loop_characterflag(Object *obj, UNUSED s32 speed) { s32 temp_t5; Object *someObj; Object_CharacterFlag *obj64; - Object_80035F6C *someObj64; + Object_Racer *someObj64; if (obj->unk7C.word < 0) { someObj = get_object_struct(obj->unk78); if (someObj != NULL) { obj64 = &obj->unk64->character_flag; - someObj64 = &someObj->unk64->obj80035F6C; - obj->unk7C.word = someObj64->unk3; + someObj64 = &someObj->unk64->racer; + obj->unk7C.word = someObj64->characterId; if (obj->unk7C.word < 0 || obj->unk7C.word >= 0xA) { obj->unk7C.word = 0; } From 739568a63b1132f5b5314e4b05ca4450fc64273e Mon Sep 17 00:00:00 2001 From: Antonio Date: Thu, 14 Apr 2022 21:45:04 -0700 Subject: [PATCH 9/9] Make NON_EQUIVALENT compile. --- include/structs.h | 16 +++++++++++++++- src/object_functions.c | 6 +++--- src/objects.c | 24 ++++++++++++------------ src/unknown_0255E0.c | 1 + src/unknown_032760.c | 20 ++++++++++---------- 5 files changed, 41 insertions(+), 26 deletions(-) diff --git a/include/structs.h b/include/structs.h index eb049bcf..67834438 100644 --- a/include/structs.h +++ b/include/structs.h @@ -781,7 +781,7 @@ typedef struct Object_Exit { typedef struct Object_Racer { /* 0x000 */ s16 playerIndex; // -1 = AI Controlled, 0 to 3 = Object controlled - /* 0x002 */ u8 pad2; + /* 0x002 */ u8 unk2; /* 0x003 */ s8 characterId; // Affects minimap color, horn, voice, etc. /* 0x004 */ u8 pad4[0x20]; /* 0x024 */ s32 unk24; @@ -1039,6 +1039,19 @@ typedef struct Object_Bridge_WhaleRamp { /* 0x4 */ s32 unk4; } Object_Bridge_WhaleRamp; +typedef struct Object_80011AD0 { + /* 0x00 */ u8 pad0[0x20]; + /* 0x20 */ u32 unk20; + /* 0x24 */ u32 unk24; + /* 0x28 */ u8 pad28[0x48]; + /* 0x70 */ u8 unk70; + /* 0x71 */ u8 pad71[0x3]; + /* 0x74 */ f32 unk74; + /* 0x78 */ u8 pad78[0x80]; + /* 0xF8 */ u32 unkF8; + /* 0xFC */ u8 unkFC; +} Object_80011AD0; + typedef struct Object_64 { union { Object_LaserGun laser_gun; @@ -1080,6 +1093,7 @@ typedef struct Object_64 { Object_Taj taj; Object_TT tt; Object_Bridge_WhaleRamp bridge_whale_ramp; + Object_80011AD0 obj80011AD0; }; } Object_64; diff --git a/src/object_functions.c b/src/object_functions.c index 42c6cc98..fbb3635f 100644 --- a/src/object_functions.c +++ b/src/object_functions.c @@ -1819,7 +1819,7 @@ void obj_loop_goldenballoon(Object *obj, s32 speed) { obj4C = obj->unk4C; if ((obj4C->unk13 < 45) && (someBool == FALSE)) { racerObj = obj4C->unk0; - if (racerObj && (racerObj->segment.header->behaviorId == 1) && (racerObj->unk64->racer->unk0 == 0)) { + if (racerObj && (racerObj->segment.header->behaviorId == 1) && (racerObj->unk64->racer.playerIndex == 0)) { settings->balloonsPtr[settings->worldId]++; if (settings->worldId != 0) { settings->balloonsPtr[0]++; @@ -1832,7 +1832,7 @@ void obj_loop_goldenballoon(Object *obj, s32 speed) { func_800AFC3C(obj, speed); } } - obj64 = obj->unk64->golden_balloon; + obj64 = &obj->unk64->golden_balloon; obj->segment.unk3B = 0; obj64->unk14 = 0.0f; if (obj->segment.unk38.half.lower < 255) { @@ -2478,7 +2478,7 @@ void obj_loop_weather(Object *obj, s32 speed) { do { curObj = objects[1]; curObj64 = &curObj->unk64->racer; - } while (((++objects) < lastObj) && (sp54 != curObj64->unk0)); + } while (((++objects) < lastObj) && (sp54 != curObj64->playerIndex)); temp_f0 = obj->segment.trans.x_position - curObj->segment.trans.x_position; temp_f2 = obj->segment.trans.z_position - curObj->segment.trans.z_position; new_var = obj->unk78f; diff --git a/src/objects.c b/src/objects.c index db679de6..0116830a 100644 --- a/src/objects.c +++ b/src/objects.c @@ -620,7 +620,7 @@ void func_8000E2B4(void) { LevelObjectEntry8000E2B4 sp2C; Settings *settings; Object *player; - Object_64 *player_64; + Object_Racer *player_64; s16 object_id; if (D_8011AD44 == 0) { @@ -653,13 +653,13 @@ void func_8000E2B4(void) { (*gObjectStructArrayPtr)[0] = (s32) player; *D_8011AEEC = (s32) player; *D_8011AEE8 = player; - player_64 = player->unk64; + player_64 = &player->unk64->racer; player_64->unk1D6 = (s8) D_8011AD45; - player_64->unk0_a.unk0_b.unk2 = (u8)0; + player_64->unk2 = (u8)0; player_64->unk1D7 = (s8) D_8011AD45; - player_64->unk0_a.unk0_b.unk0 = (u16)0; + player_64->playerIndex = (u16)0; player_64->unk118 = 0; - player_64->unk0_a.unk0_b.unk3 = (s8) settings->racers[0].character; + player_64->characterId = (s8) settings->racers[0].character; if (get_filtered_cheats() & CHEAT_BIG_CHARACTERS) { player->segment.trans.scale *= 1.4f; } @@ -850,16 +850,16 @@ void func_80011AD0(Object *this) { //L80011B10 if (this->unk7C.word < 0) break; - func_80011960(this, this->unk64->unk20, 4, this->unk64, - 2, this->unk64->unk24, 11, 0, 1.0f); + func_80011960(this, this->unk64->obj80011AD0.unk20, 4, this->unk64, + 2, this->unk64->obj80011AD0.unk24, 11, 0, 1.0f); break; case 61: //L80011B58 - offset = (this->unk64->unkFC * 6); + offset = (this->unk64->obj80011AD0.unkFC * 6); offset *= 5; offset = offset * 2 + 0x80; - func_80011960(this, offset, 6, this->unk64, 8, this->unk64->unkF8, 10, 0, 1.0f); + func_80011960(this, offset, 6, this->unk64, 8, this->unk64->obj80011AD0.unkF8, 10, 0, 1.0f); break; case 3: //L80011BB4 @@ -867,16 +867,16 @@ void func_80011AD0(Object *this) { if (this->segment.unk3C_a.unk3C->unkD < 0) { tmp_f0 += 4294967296.0f; } - offset = (this->unk64->unkFC * 6); + offset = (this->unk64->obj80011AD0.unkFC * 6); offset *= 5; offset = offset * 2 + 0x80; - func_80011960(this, offset, 6, this->unk64, 8, this->unk64->unkF8, 26, 0, tmp_f0 * D_800E5550); + func_80011960(this, offset, 6, this->unk64, 8, this->unk64->obj80011AD0.unkF8, 26, 0, tmp_f0 * D_800E5550); break; case 89: //L80011C38 if (this->unk78 == 0) break; - if (this->unk64->unk70 > 0 || 0.0f < this->unk64->unk74) { + if (this->unk64->obj80011AD0.unk70 > 0 || 0.0f < this->unk64->obj80011AD0.unk74) { func_800135B8(this); } break; diff --git a/src/unknown_0255E0.c b/src/unknown_0255E0.c index 252c9a5c..33efbc21 100644 --- a/src/unknown_0255E0.c +++ b/src/unknown_0255E0.c @@ -181,6 +181,7 @@ s32 func_800249E0(s32 arg0) { } #ifdef NON_EQUIVALENT +void func_8002C0C4(s32 modelId); void func_800249F0(u32 arg0, u32 arg1, s32 arg2, u32 arg3, u32 arg4, u32 arg5, u32 arg6) { s32 i; s32 tmp_a2; diff --git a/src/unknown_032760.c b/src/unknown_032760.c index 346b6a42..65246d53 100644 --- a/src/unknown_032760.c +++ b/src/unknown_032760.c @@ -149,8 +149,8 @@ void func_80032C7C(Object *object) { s16 phi_a0, phi_a1; unk800DC950 *entry; - if (object->header->unk3D == 0) { - switch (object->header->modelType) { + if (object->segment.header->unk3D == 0) { + switch (object->segment.header->modelType) { case OBJECT_MODEL_TYPE_3D_MODEL: // 3D Model sp64 = 2; break; @@ -164,9 +164,9 @@ void func_80032C7C(Object *object) { break; } - sp82 = object->trans.x_position; - sp80 = object->trans.y_position; - sp7E = object->trans.z_position; + sp82 = object->segment.trans.x_position; + sp80 = object->segment.trans.y_position; + sp7E = object->segment.trans.z_position; D_800DC968 = 0; for (i = 0; i < D_800DC95C; i++) { entry = D_800DC950[i]; @@ -183,9 +183,9 @@ void func_80032C7C(Object *object) { D_800DC968 = D_800DC968 + 1; } } else { - D_8011D4C4 = entry->unk10 - object->trans.x_position; - D_8011D4C8 = entry->unk14 - object->trans.y_position; - D_8011D4CC = entry->unk18 - object->trans.z_position; + D_8011D4C4 = entry->unk10 - object->segment.trans.x_position; + D_8011D4C8 = entry->unk14 - object->segment.trans.y_position; + D_8011D4CC = entry->unk18 - object->segment.trans.z_position; if (entry->unk0 == 2) { D_8011D4C8 = 0.0f; } @@ -199,7 +199,7 @@ void func_80032C7C(Object *object) { if (f20 > 0.0f) { f20 *= func_80033A14(entry); if (f20 > 0.0f) { - if (object->header->unk71 != 0) { + if (object->segment.header->unk71 != 0) { if (D_8011D4C0 > 0.0f) { temp = 1.0f / sqrtf(D_8011D4C0); D_8011D4C4 *= temp; @@ -227,7 +227,7 @@ void func_80032C7C(Object *object) { } } - if (object->header->unk71 != 0) { + if (object->segment.header->unk71 != 0) { if (D_800DC968 == 0) { object->unk54->unk7 = 0; object->unk54->unk11 = 0;