diff --git a/include/functions.h b/include/functions.h index 61778f3f..92b540ca 100644 --- a/include/functions.h +++ b/include/functions.h @@ -327,7 +327,7 @@ void func_80293350(void); void func_80293D48(f32, f32); f32 func_80294438(void); f32 func_80294500(void); -Struct60s *func_802946F0(void); +BKCollisionTri *func_802946F0(void); void func_80294980(f32 arg0[3]); f32 get_slope_timer(void); f32 func_80294A40(void); diff --git a/include/model.h b/include/model.h index 17f80a62..7551d08a 100644 --- a/include/model.h +++ b/include/model.h @@ -49,7 +49,7 @@ typedef struct { typedef struct { s16 unk0[3]; //vtx_indx - //u8 pad6[2]; + s16 unk6; s32 flags; //flags } BKCollisionTri; //BKCollisionTri diff --git a/include/structs.h b/include/structs.h index 9e7d277c..35d4eb53 100644 --- a/include/structs.h +++ b/include/structs.h @@ -115,16 +115,10 @@ typedef struct portrait_info_s{ PortraitVoice voiceInfo[5]; } PortraitInfo; -typedef struct struct_60_s{ - s16 unk0[3]; - s16 unk6; - s32 unk8; -}Struct60s; - typedef struct struct_0_s{ //floor void * model; - Struct60s unk4; - Struct60s unk10; + BKCollisionTri unk4; + BKCollisionTri unk10; f32 unk1C[3]; f32 unk28[3]; f32 normX; @@ -879,4 +873,13 @@ typedef struct{ typedef struct{ u8 pad0[1]; }struct85s; + +typedef struct{ + f32 unk0[3]; + f32 unkC; + u32 flags; + s16 unk14; + // u8 pad16[2]; + void *unk18; +}struct86s; #endif diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 90ebd6b6..00cf48df 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core2 - 81.3568% - 81.3568% + 81.4658% + 81.4658% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index fa6ff1f3..a62a3e43 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 84.2857% - 84.2857% + 84.3482% + 84.3482% \ No newline at end of file diff --git a/src/CC/code_1F70.c b/src/CC/code_1F70.c index 74ceab21..e628d557 100644 --- a/src/CC/code_1F70.c +++ b/src/CC/code_1F70.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -extern Struct60s *func_8028EF48(void); +extern BKCollisionTri *func_8028EF48(void); extern void func_8030E9FC(enum sfx_e uid, f32 arg1, f32 arg2, u32 arg3, f32 arg4[3], f32 arg5, f32 arg6); extern void func_8030EA54(enum sfx_e uid, f32 arg1, f32 arg2, u32 arg3, f32 arg4[3], f32 arg5, f32 arg6); extern void func_8031CE28(s32, s32, f32); @@ -324,7 +324,7 @@ void func_80388F4C(void){ f32 sp60; f32 sp54[3]; f32 sp48[3]; - Struct60s *tmp_v0; + BKCollisionTri *tmp_v0; f32 pad[3]; func_80387D4C(); @@ -389,11 +389,11 @@ void func_80388F4C(void){ tmp_v0 = func_8028EF48(); if( tmp_v0 && !D_80389FA0.unk49 ){ - if(tmp_v0->unk8 & 2){ + if(tmp_v0->flags & 2){ func_8031CE28(0x22, 5, 180.0f); D_80389FA0.unk49++; } - else if(tmp_v0->unk8 & 4){ + else if(tmp_v0->flags & 4){ func_8031CE28(0x22, 4, 0.0f); D_80389FA0.unk49++; } diff --git a/src/core1/code_72B0.c b/src/core1/code_72B0.c index 7ba95af5..8a51a08f 100644 --- a/src/core1/code_72B0.c +++ b/src/core1/code_72B0.c @@ -198,11 +198,11 @@ int func_8024549C(f32 arg0[3], f32 arg1){ #pragma GLOBAL_ASM("asm/nonmatchings/core1/code_72B0/func_802457C4.s") -void func_8024587C(Struct60s *dst, Struct60s *src){ +void func_8024587C(BKCollisionTri *dst, BKCollisionTri *src){ dst->unk0[0] = src->unk0[0]; dst->unk0[1] = src->unk0[1]; dst->unk0[2] = src->unk0[2]; - dst->unk8 = src->unk8; + dst->flags = src->flags; dst->unk6 = src->unk6; } diff --git a/src/core2/bs/bFly.c b/src/core2/bs/bFly.c index ae8c5803..443adf7d 100644 --- a/src/core2/bs/bFly.c +++ b/src/core2/bs/bFly.c @@ -362,7 +362,7 @@ s32 func_802A40E0(void){ void func_802A411C(void) { s32 next_state; AnimCtrl *sp58; - Struct60s *phi_v0; + BKCollisionTri *phi_v0; f32 sp48[3]; s32 sp44; s32 sp40; @@ -401,7 +401,7 @@ void func_802A411C(void) { phi_v0 = func_802946F0(); } if (phi_v0 != NULL) { - sp44 = phi_v0->unk8; + sp44 = phi_v0->flags; } else { sp44 = 0; } diff --git a/src/core2/code_12F30.c b/src/core2/code_12F30.c index 58f184c2..2e06ab5d 100644 --- a/src/core2/code_12F30.c +++ b/src/core2/code_12F30.c @@ -114,7 +114,7 @@ void func_80299EC0(f32 arg0[3]) { s32 sp78; s32 i; f32 sp70; - Struct60s *sp6C; //floor_vtx_list + BKCollisionTri *sp6C; //floor_vtx_list f32 sp48[3][3]; //tri_vtx_coord f32 temp_f0_2; f32 temp_f2_2; diff --git a/src/core2/code_16010.c b/src/core2/code_16010.c index 1eebae44..fa1d5f8e 100644 --- a/src/core2/code_16010.c +++ b/src/core2/code_16010.c @@ -238,7 +238,7 @@ bool func_8029D7B4(void){ void func_8029D968(void){ s32 sp24; - Struct60s *temp_v0; + BKCollisionTri *temp_v0; s32 sp1C; s32 sp18; @@ -248,11 +248,11 @@ void func_8029D968(void){ sp1C = 0; temp_v0 = func_802946F0(); if(temp_v0 != NULL){ - sp1C = temp_v0->unk8 & 0x4000; + sp1C = temp_v0->flags & 0x4000; } temp_v0 = func_8029463C(); if(temp_v0 != NULL){ - sp18 = (temp_v0->unk8 & 0x4000) && func_8028B2E8(); + sp18 = (temp_v0->flags & 0x4000) && func_8028B2E8(); } if (sp1C || sp18) { func_80250D94(1.0f, 0.5f, 0.4f); diff --git a/src/core2/code_7060.c b/src/core2/code_7060.c index eb84419b..b11986a9 100644 --- a/src/core2/code_7060.c +++ b/src/core2/code_7060.c @@ -534,7 +534,7 @@ void func_8028EF28(f32 arg0[3]){ func_80294A1C(arg0); } -Struct60s *func_8028EF48(void){ +BKCollisionTri *func_8028EF48(void){ return func_802946F0(); } diff --git a/src/core2/code_94A20.c b/src/core2/code_94A20.c index da3918cf..6e314054 100644 --- a/src/core2/code_94A20.c +++ b/src/core2/code_94A20.c @@ -6,7 +6,7 @@ //f32 mlAbsF(f32, f32); extern void func_8028F760(s32, f32, f32); -void *func_80309B48(f32 *, f32 *, f32 *, u32); +BKCollisionTri *func_80309B48(f32 *, f32 *, f32 *, u32); void *func_80309B98(f32 *, f32 *, f32 *, u32); s32 func_8031FF1C(s32); void func_8031FFAC(void); @@ -26,7 +26,6 @@ void func_8031CD44(s32, s32, f32, f32, s32); void func_80256E24(f32 *, f32, f32, f32, f32, f32); void func_8031C608(struct0 *this); -void *func_8031BABC(f32 *, f32, f32, u32, void*); void func_8031BD98(struct0 *, f32, s32, s32, f32 *, void *, s32); void func_8031BE98(struct0*, f32, s32); @@ -49,7 +48,8 @@ extern u32 D_8036DDD4; /* .rodata */ extern f32 D_80378D30; extern f32 D_80378D34; - +extern f32 D_80378D38; +extern f32 D_80378D3C; extern f32 D_80378D40; extern f32 D_80378D44; @@ -97,41 +97,34 @@ void func_8031BA9C(struct0 *this){ free(this); } -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_94A20/func_8031BABC.s") -// void *func_8031BABC(f32 *arg0, f32 arg1, f32 arg2, u32 arg3, void *arg4) { -// //f32 sp38; -// f32 sp34[3]; -// //f32 sp2C; -// f32 sp28[3]; -// void *sp24; -// void *temp_v1; -// void *phi_v0; +BKCollisionTri *func_8031BABC(f32 *arg0, f32 arg1, f32 arg2, u32 arg3, struct86s *arg4) { + f32 sp34[3]; + f32 sp28[3]; + BKCollisionTri *sp24; -// ml_vec3f_copy(&sp34, arg0); -// sp34[1] = sp34[1] + arg1; -// ml_vec3f_copy(&sp28, arg0); -// sp28[1] = sp28[1] + arg2; -// if (arg3 == 0xF800FF0F) { -// phi_v0 = func_80309B48(&sp34, &sp28, arg4, arg3); -// } else { -// phi_v0 = func_80320B98(&sp34, &sp28, arg4, arg3); -// } -// temp_v1 = phi_v0; -// if (phi_v0 != 0) { -// arg4->unk10 = (s32) phi_v0->unk8; -// arg4->unk14 = (s16) phi_v0->unk6; -// } else { -// arg4->unk10 = 0; -// arg4->unk14 = (u16)0; -// } -// arg4->unkC = sp28[1]; -// sp24 = temp_v1; -// arg4->unk18 = func_803209EC(); -// return temp_v1; -// } + ml_vec3f_copy(sp34, arg0); + sp34[1] = sp34[1] + arg1; + ml_vec3f_copy(sp28, arg0); + sp28[1] = sp28[1] + arg2; + if (arg3 == 0xF800FF0F) { + sp24 = func_80309B48(&sp34, &sp28, arg4->unk0, arg3); + } else { + sp24 = func_80320B98(&sp34, &sp28, arg4->unk0, arg3); + } + if (sp24 != 0) { + arg4->flags = (s32) sp24->flags; + arg4->unk14 = (s16) sp24->unk6; + } else { + arg4->flags = 0; + arg4->unk14 = (u16)0; + } + arg4->unkC = sp28[1]; + arg4->unk18 = func_803209EC(); + return sp24; +} -s32 *func_8031BBA0(f32 *this, f32 arg1, f32 arg2, u32 arg3, void *arg4) { - s32* phi_v1; +BKCollisionTri *func_8031BBA0(f32 *this, f32 arg1, f32 arg2, u32 arg3, struct86s *arg4) { + BKCollisionTri* phi_v1; if (mlAbsF(arg2 - arg1) > 500.0f) { if (arg1 < arg2) { @@ -187,14 +180,9 @@ void func_8031BD98(struct0 *this, f32 arg1, s32 arg2, s32 arg3, f32 *normPtr, vo ml_vec3f_copy(&this->normX, normPtr); } -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_94A20/func_8031BE0C.s") -// void func_8031BE0C(struct0 *this, s32 *arg1, s32 arg2) { -// s32 a = arg1[4]; -// s32 b = arg1[5]; -// func_8031BD98(this, *(f32*)&arg1[3], a, b, &this->model, arg1[6], arg2); -// // func_8031BD98(this, *(f32*)&arg1[3], arg1[4], arg1[5], this, *(s32*)&this->unk10[4], arg2); -// } - +void func_8031BE0C(struct0 *this, struct86s *arg1, BKCollisionTri *arg2) { + func_8031BD98(this, arg1->unkC, arg1->flags, arg1->unk14, arg1->unk0, arg1->unk18, arg2); +} void func_8031BE58(struct0 *this){ func_8031BD98(this, -9000.0f, 0, 0, &D_8036DDC0, 0, 0); @@ -211,15 +199,180 @@ void func_8031BEE0(struct0 *this){ func_8031BE98(this, -10000.0, 0); } +#ifndef NONMATCHING #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_94A20/func_8031BF08.s") +#else +void func_8031BF08(struct0 *arg0) { + f32 sp64; + struct86s sp48; + BKCollisionTri *temp_v0; + f32 sp38[3]; + f32 temp_f0; + bool sp30; + u32 tmp = 0x1E0000; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_94A20/func_8031C1A4.s") -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_94A20/func_8031C29C.s") + sp30 = 0; + ml_vec3f_copy(&sp38, arg0->unk1C); + sp64 = arg0->posZ; + temp_v0 = func_8031BBA0(sp38, max_f(arg0->unk28[1] - arg0->unk1C[1], 150.0f) + 10.0f, -5.0f, 0xF800FF0F, &sp48); + if (temp_v0 != NULL) { + func_8031BE98(arg0, sp48.unkC, temp_v0); + sp30 = 1; + } + temp_v0 = func_8031BBA0(&sp38, sp64, -1300.0f, arg0->unk54, &sp48); + if (temp_v0 == NULL) { + func_8031BE58(arg0); + if (!sp30) { + func_8031BEE0(arg0); + } + else if (arg0->unk1C[1] < arg0->posY) { + func_8031B9B0(arg0, 3); + } + } else { + if (temp_v0->flags & tmp) { + func_8031BE98(arg0, sp48.unkC, temp_v0); + if ((arg0->posX < arg0->posY) && (arg0->unk1C[1] < arg0->posY)) { + func_8031B9B0(arg0, 3); + } + temp_v0 = func_8031BBA0(sp38, sp64, -450.0f, tmp | arg0->unk54, &sp48); + if (temp_v0 == NULL) { + func_8031BE58(arg0); + }else if (sp48.unk0[1] >= 0.0f) { + func_8031BE0C(arg0, &sp48, temp_v0); + } + } else { + if ((sp48.unk0[1] < 0.0f) && !(temp_v0->flags & 0x10000)) { + temp_f0 = sp48.unkC - sp38[1]; + temp_v0 = func_8031BBA0(sp38, temp_f0 - 1.0f, temp_f0 - D_80378D38, arg0->unk54 | 0x1E0000, &sp48); + if (temp_v0 != NULL) { + func_8031BE0C(arg0, &sp48, temp_v0); + } + else{ + func_8031BE58(arg0); + } + } + else{ + func_8031BE0C(arg0, &sp48, temp_v0); + if (sp30) { + func_8031B9B0(arg0, 3); + } + else{ + func_8031BEE0(arg0); + } + } + } + } +} +#endif + +void func_8031C1A4(struct0 *arg0) { + struct86s sp44; + BKCollisionTri *temp_v0; + s32 temp_v0_3; + f32 sp30[3]; + f32 temp_f0; + + ml_vec3f_copy(sp30, arg0->unk1C); + temp_v0 = func_8031BBA0(&sp30, 100.0f, -1300.0f, arg0->unk54 | 0x1E0000, &sp44); + if ((temp_v0 != 0) && (sp44.unk0[1] >= 0.0f)) { + func_8031BE0C(arg0, &sp44, temp_v0); + } + temp_f0 = arg0->posY - sp30[1]; + temp_v0 = func_8031BBA0(&sp30, temp_f0 + 50.0f, temp_f0 - 50.0f, 0xF800FF0F, &sp44); + if (temp_v0 != 0) { + func_8031BE98(arg0, sp44.unkC, temp_v0); + } + temp_v0_3 = func_8031BCF4(arg0); + if (temp_v0_3 != 3) { + func_8031B9B0(arg0, temp_v0_3); + } +} + +void func_8031C29C(struct0 *arg0) { + struct86s sp4C; + s32 sp48; + BKCollisionTri *temp_v0; + s32 sp40; + s32 temp_v0_4; + f32 sp30[3]; + f32 temp_f0; + + + ml_vec3f_copy(sp30, arg0->unk1C); + sp48 = ((arg0->unk1C[1] - arg0->posX) > 120.0) ? 1 : 0; + sp40 = func_8023DB4C(1); + if ((sp48 == 0) || (sp40 != 0)) { + arg0->unk59 = arg0->unk5B; + temp_v0 = func_8031BBA0(&sp30, 60.0f, -390.0f, arg0->unk54 | 0x1E0000, &sp4C); + if (temp_v0 != NULL) { + if (sp4C.unk0[1] >= 0.0f) { + func_8031BE0C(arg0, &sp4C, temp_v0); + } + } else { + func_8031BE58(arg0); + } + } + if ((sp48 == 0) || (sp40 == 0)) { + arg0->unk58 = arg0->unk5A; + temp_f0 = arg0->posY - sp30[1]; + temp_v0 = func_8031BBA0(sp30, temp_f0 + 70.0f, temp_f0 - 70.0f, 0xF800FF0F, &sp4C); + if (temp_v0 != 0) { + func_8031BE98(arg0, sp4C.unkC, temp_v0); + arg0->unk5C = 1U; + } else if (arg0->unk5C != 0) { + arg0->unk5C = 0U; + arg0->unk59 = 1U; + } + } + temp_v0_4 = func_8031BCF4(arg0); + if (temp_v0_4 != 4) { + func_8031B9B0(arg0, temp_v0_4); + } +} void func_8031C444(struct0 * this){} +#ifndef NONMATCHING #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_94A20/func_8031C44C.s") +#else +void func_8031C44C(struct0 *arg0) { + struct86s sp3C; + BKCollisionTri *sp38; + + arg0->unk5A = arg0->unk58; + arg0->unk5B = arg0->unk59; + arg0->unk59 = 0U; + arg0->unk58 = 0U; + if ((arg0->unk5E == 1) || (arg0->unk5D != 0)) { + arg0->unk5D--; + sp38 = func_8031BABC(arg0->unk1C, -100.0f, 7000.0f, 0xF800FF0F, &sp3C); + if (sp38 != NULL) { + func_8031BE98(arg0, sp3C.unkC, sp38); + } + if (sp38 != NULL) { + func_8031B9B0(arg0, 3); + } else { + func_8031B9B0(arg0, 2); + } + } + switch (arg0->unk5E) { /* irregular */ + case 2: + func_8031BF08(arg0); + break; + case 3: + func_8031C1A4(arg0); + break; + case 4: + func_8031C29C(arg0); + break; + case 5: + func_8031C444(arg0); + break; + } + ml_vec3f_copy(arg0->unk28, arg0->unk1C); +} +#endif u8 func_8031C58C(struct0 *this){ return this->unk58; @@ -253,9 +406,11 @@ f32 func_8031C5E4(struct0 *this){ return this->posY; } -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_94A20/func_8031C5EC.s") +BKCollisionTri *func_8031C5EC(struct0* this){ + return &this->unk10; +} -Struct60s *func_8031C5F4(struct0* this){ +BKCollisionTri *func_8031C5F4(struct0* this){ return &this->unk4; } diff --git a/src/core2/code_C4B0.c b/src/core2/code_C4B0.c index 2f8b60f2..bb00b3d4 100644 --- a/src/core2/code_C4B0.c +++ b/src/core2/code_C4B0.c @@ -44,8 +44,8 @@ extern f64 D_80374780; f32 D_8037C1F0[2]; f32 D_8037C1F8[2]; struct0 * D_8037C200; -Struct60s * D_8037C204; -Struct60s D_8037C208; +BKCollisionTri * D_8037C204; +BKCollisionTri D_8037C208; f32 D_8037C218[3]; f32 D_8037C228[3]; f32 D_8037C238[3]; @@ -517,7 +517,7 @@ void func_802946CC(void){ func_8031C5EC(D_8037C200); } -Struct60s *func_802946F0(void){ +BKCollisionTri *func_802946F0(void){ return D_8037C204; } diff --git a/src/core2/code_D9B0.c b/src/core2/code_D9B0.c index 65e8eb87..35886e4e 100644 --- a/src/core2/code_D9B0.c +++ b/src/core2/code_D9B0.c @@ -120,7 +120,7 @@ void func_80294B0C(void){ } void func_80294BDC(void) { - Struct60s *temp_v0; + BKCollisionTri *temp_v0; f32 sp30; f32 sp2C; f32 sp28; @@ -139,8 +139,8 @@ void func_80294BDC(void) { if (!func_80294548() && !(sp24 & 0x50)) { temp_v0 = func_802946F0(); if (temp_v0) { - if (temp_v0->unk8 & 0x50) { - sp24 = temp_v0->unk8; + if (temp_v0->flags & 0x50) { + sp24 = temp_v0->flags; } } }