From f4deee02a8f2928c2da21edb7dd0c51a5e7857bf Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Mon, 17 Oct 2022 13:25:30 -0500 Subject: [PATCH] core2/code_74910.c done --- README.md | 2 +- progress/progress_core2.svg | 4 +- progress/progress_total.svg | 6 +-- src/core2/code_74910.c | 92 ++++++++++++++++--------------------- subyaml/core2.us.v10.yaml | 2 +- 5 files changed, 46 insertions(+), 60 deletions(-) diff --git a/README.md b/README.md index 21b3026b..adfcfe4d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (91.1364%) +# banjo (91.1905%) diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 8d0ca20c..23bde523 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -17,7 +17,7 @@ core2 - 88.7824% - 88.7824% + 88.8768% + 88.8768% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index af9425d7..67bf78c3 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 91.1364% - 91.1364% + 91.1905% + 91.1905% \ No newline at end of file diff --git a/src/core2/code_74910.c b/src/core2/code_74910.c index 92afe05e..b717e0d1 100644 --- a/src/core2/code_74910.c +++ b/src/core2/code_74910.c @@ -2,6 +2,9 @@ #include "functions.h" #include "variables.h" +extern void func_802FB020(struct8s *, s32); + + extern f32 D_80369830[]; extern s32 D_80369854; @@ -35,44 +38,35 @@ void func_802FB8F8(void){ } } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_74910/func_802FB93C.s") -#else void func_802FB93C(struct8s *arg0) { - void *sp18; - s32 temp_a1; - s32 temp_t9; s32 var_v1; - void **var_v0; - void **var_v0_2; - void *temp_a0; - struct8s *temp_t0; - void *temp_v0; + struct8s *sp20; + for(var_v1 = 0; var_v1 < D_80369854; var_v1++){ if (arg0 == D_80381540[var_v1]) { + sp20 = D_80381540[0]; func_802FB020(D_80381540[var_v1], 1); - D_80381540[var_v1]->unk10 = 3.0f; - if (D_80381540[var_v1]->unk18 == 0) { - D_80381540[var_v1]->unk1C = 0.0f; + sp20->unk10 = 3.0f; + if (sp20->unk18 == 0) { + sp20->unk1C = 0.0f; } + return; } } - for(var_v1 = D_80369854; var_v1 > 0; var_v0--){ + for(var_v1 = D_80369854; var_v1 > 0; var_v1--){ D_80381540[var_v1] = D_80381540[var_v1 - 1]; - var_v1--; } - D_80381540[0] = arg0; - if ((temp_a1 != 0) && (func_802FDD0C(D_80381540[1]) == 0x2A)) { - temp_t0 = D_80381540[1]; - D_80381540[1] = D_80381540[0]; - D_80381540[0] = temp_t0; + + + if (D_80369854 && (func_802FDD0C(D_80381540[1]) == 0x2A)) { + D_80381540[0] = D_80381540[1]; + D_80381540[1] = arg0; } D_80369854++; } -#endif void func_802FBA54(s32 arg0, struct8s *arg1){ func_802FB93C(arg1); @@ -117,30 +111,23 @@ void func_802FBB18(void) { } } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_74910/func_802FBBC0.s") -#else void func_802FBBC0(void) { struct8s *sp1C; f32 temp_f0; - struct8s *temp_a2; - s32 temp_v0; - s32 temp_v0_2; - s32 temp_v0_3; - s32 temp_v1; - s32 var_a0; s32 var_v0; - s32 var_v1; + bool var_v1; - var_a0 = D_80369854; - sp1C = D_80381540; + sp1C = D_80381540[0]; if(D_80369854 != 0){ switch(sp1C->unk0){ + default: + break; case 1: - sp1C->unk1C += sp1C->unk14 * D_80369830[sp1C->unk18]; - if (D_80369830[sp1C->unk18] == 0.0) { - sp1C->unk0 = 2; + temp_f0 = D_80369830[sp1C->unk18]; + sp1C->unk1C += sp1C->unk14 * temp_f0; + if (temp_f0 == 0.0) { sp1C->unk10 = 3.0f; + sp1C->unk0 = 2; } else { sp1C->unk18++; } @@ -154,30 +141,29 @@ void func_802FBBC0(void) { break; case 3: - if (D_80381554 != 0) { - var_v1 = (sp1C->unk1C < -20.0f) ? TRUE : FALSE; - } else { - var_v1 = (sp1C->unk18 == 0); - } + var_v1 = (D_80381554 != 0) ? (sp1C->unk1C < -20.0f) : (!sp1C->unk18); if (var_v1) { D_80381554 = 0; func_802FB020(sp1C, 0); - } else { - temp_v0_3 = sp1C->unk18 - 1; - sp1C->unk18 = (temp_v0_3 < 0) ? 0 : temp_v0_3; - sp1C->unk1C -= sp1C->unk14 * D_80369830[sp1C->unk18]; + break; } + else{ + sp1C->unk18 = MAX(0, sp1C->unk18 - 1); + temp_f0 = D_80369830[sp1C->unk18]; + + sp1C->unk1C -= sp1C->unk14 * temp_f0; + } + break; } - } - - for(var_v0 = 1; var_v0 < D_80369854; var_v0++){ - if (temp_a2->unk0 == 2) { - D_80381540[var_v0]->unk0 = temp_a2->unk0; + + for(var_v0 = 1; var_v0 < D_80369854; var_v0++){ + if (sp1C->unk0 == 2) { + D_80381540[var_v0]->unk0 = sp1C->unk0; + } } - } + } } -#endif void func_802FBDFC(void){} diff --git a/subyaml/core2.us.v10.yaml b/subyaml/core2.us.v10.yaml index b57b2dbb..a105e4cd 100644 --- a/subyaml/core2.us.v10.yaml +++ b/subyaml/core2.us.v10.yaml @@ -271,7 +271,7 @@ segments: - [0x74090, c, code_74090] #DONE - [0x74290, c, code_74290] #DONE - [0x74420, c, code_74420] #DONE - - [0x74910, c, code_74910] + - [0x74910, c, code_74910] #DONE - [0x74ED0, c, code_74ED0] - [0x75480, c, code_75480] - [0x75930, c, code_75930]