From ebf23b94bdc1e3d65b63f13203218deef821d920 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Tue, 27 Sep 2022 21:33:09 -0500 Subject: [PATCH] FP/code_19E0.c done --- README.md | 2 +- progress/progress_FP.svg | 6 +-- progress/progress_total.svg | 6 +-- src/BGS/ch/tanktup.c | 9 ++-- src/FP/code_19E0.c | 34 +++++---------- src/FP/code_5CC0.c | 87 ++++++++++++++++++++----------------- subyaml/BGS.us.v10.yaml | 2 +- 7 files changed, 69 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index 41e9080a..30cb8fc4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (88.0412%) +# banjo (88.0773%) diff --git a/progress/progress_FP.svg b/progress/progress_FP.svg index ff57caf7..6d53b3a0 100644 --- a/progress/progress_FP.svg +++ b/progress/progress_FP.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ FP - 97.1669% - 97.1669% + 98.3860% + 98.3860% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index ebb9be46..f675b77f 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 88.0412% - 88.0412% + 88.0773% + 88.0773% \ No newline at end of file diff --git a/src/BGS/ch/tanktup.c b/src/BGS/ch/tanktup.c index 2a537a99..d40685cd 100644 --- a/src/BGS/ch/tanktup.c +++ b/src/BGS/ch/tanktup.c @@ -88,8 +88,6 @@ void func_8038F610(Actor *this) { } } -extern f32 D_803911B0; -extern f32 D_803911B4; void func_8028F94C(s32, f32[3]); void func_8028F918(s32); @@ -100,11 +98,10 @@ void func_8028F918(s32); void func_8038F6A4(Actor *this) { ActorLocal_TanktupBody * local = (ActorLocal_TanktupBody *)&this->local; f32 sp48[3]; - Prop *temp_v0; - volatile s32 sp44; + s32 sp44; + NodeProp *temp_v0; f32 sp34[3]; - if(!this->initialized){ temp_v0 = func_80304C38(ACTOR_32B_UNKNOWN, this); if (temp_v0 == NULL) { @@ -177,7 +174,7 @@ void func_8038F6A4(Actor *this) { break; case 3: - (local); + // (local); if (actor_animationIsAt(this, 0.1f) != 0) { timed_setCameraToNode(0.0f, 0xD); } diff --git a/src/FP/code_19E0.c b/src/FP/code_19E0.c index 4317e775..391c1208 100644 --- a/src/FP/code_19E0.c +++ b/src/FP/code_19E0.c @@ -39,9 +39,6 @@ Actor *func_80387DD0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ return func_80325888(marker, gfx, mtx, vtx); } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/FP/code_19E0/func_80387EE4.s") -#else bool func_80387EE4(Actor *this) { ActorLocal_FP_19E0 *local = (ActorLocal_FP_19E0 *)&this->local; f32 temp_f2; @@ -51,15 +48,14 @@ bool func_80387EE4(Actor *this) { f32 sp38[3]; f32 sp34; f32 temp_f12; - f32 temp_f14; s32 var_v1; player_getPosition(sp38); - temp_f22 = (this->unk1C[0] - this->position[0]); temp_f20 = (this->position[2] - this->unk1C[2]); + temp_f22 = (this->unk1C[0] - this->position[0]); temp_f2 = ((temp_f20 * this->position[0]) + (temp_f22* this->position[2])); temp_f0 = ((temp_f20 * sp38[0]) + (temp_f22*sp38[2])); - sp34 = ((sp38[0] - this->position[0]) * temp_f22) + ((sp38[2] - this->position[2])*(this->unk1C[2] - this->position[2])); + sp34 = ((sp38[0] - this->position[0])*(this->unk1C[0] - this->position[0])) + ((sp38[2] - this->position[2])*(this->unk1C[2] - this->position[2])); var_v1 = (temp_f0 < temp_f2) ? 1 : 0; if (!(this->initialized) || (local->unk0 == var_v1) || !(sp34 >= 0.0f) || !(sp34 <= ((temp_f20 * temp_f20) + (temp_f22 * temp_f22)))) { local->unk0 = var_v1; @@ -69,39 +65,33 @@ bool func_80387EE4(Actor *this) { local->unk0 = var_v1; return 1; } -#endif -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/FP/code_19E0/func_80388000.s") -#else bool func_80388000(Actor *this) { ActorLocal_FP_19E0 *local = (ActorLocal_FP_19E0 *)&this->local; - f32 sp38[3]; - f32 sp34; + f32 temp_f2; f32 temp_f0; - f32 temp_f12; f32 temp_f20; f32 temp_f22; - f32 temp_f2; + f32 sp38[3]; + f32 sp34; + f32 temp_f12; s32 var_v1; - func_8038A09C(sp38, this); - temp_f22 = (this->unk1C[0] - this->position[0]); + func_8038A09C(sp38); temp_f20 = (this->position[2] - this->unk1C[2]); + temp_f22 = (this->unk1C[0] - this->position[0]); temp_f2 = ((temp_f20 * this->position[0]) + (temp_f22* this->position[2])); temp_f0 = ((temp_f20 * sp38[0]) + (temp_f22*sp38[2])); - sp34 = ((sp38[0] - this->position[0]) * temp_f22) + ((sp38[2] - this->position[2])*(this->unk1C[2] - this->position[2])); - var_v1 = ((temp_f0 < temp_f2)? 1 : 0) ; + sp34 = ((sp38[0] - this->position[0])*(this->unk1C[0] - this->position[0])) + ((sp38[2] - this->position[2])*(this->unk1C[2] - this->position[2])); + var_v1 = (temp_f0 < temp_f2) ? 1 : 0; if ((this->velocity[2] == 0.0f) || (local->unk1 == var_v1) || !(sp34 >= 0.0f) || !(sp34 <= ((temp_f20 * temp_f20) + (temp_f22 * temp_f22)))) { local->unk1 = var_v1; this->velocity[2] = 1.0f; - return FALSE; + return 0; } local->unk1 = var_v1; - return TRUE; - + return 1; } -#endif void func_8038811C(ActorMarker *this_marker, ActorMarker *other_marker){ Actor *this = marker_getActor(this_marker); diff --git a/src/FP/code_5CC0.c b/src/FP/code_5CC0.c index e7321608..4568367c 100644 --- a/src/FP/code_5CC0.c +++ b/src/FP/code_5CC0.c @@ -151,64 +151,69 @@ void func_8038C398(f32 position[3], enum marker_e marker_id){ void func_8038C428(Actor *this, f32 arg1[3], f32 arg2); #pragma GLOBAL_ASM("asm/nonmatchings/FP/code_5CC0/func_8038C428.s") #else -void func_8038C428(Actor *this, f32 arg1[3], f32 arg2) { +void func_8038C428(Actor *arg0, f32 arg1[3], f32 arg2) { u8 sp7F; s32 sp78; f32 sp74; f32 sp70; + f32 temp_f14; + f32 var_f22; + f32 var_f24; + f32 temp_f0; f32 sp5C[3]; f32 sp54; - f32 sp50; - f32 sp48; + f32 sp48[3]; + f32 var_f2; + s32 var_v0; f32 temp_f0_2; - f32 phi_f22; - f32 phi_f24; - f32 phi_f16; - s32 phi_v0; - s32 phi_v1; + + sp78 = 0; sp74 = arg2; - sp70 = this->position[1]; - phi_v1 = (arg2 == 0.0f) ? FALSE : TRUE; - phi_f22 = arg1[0] - this->position[0]; - phi_f24 = arg1[2] - this->position[2]; - sp78 = 0; - sp48 = phi_f22 / sp54; - sp50 = phi_f24 / sp54; - sp54 = gu_sqrtf((phi_f22 * phi_f22) + (phi_f24 * phi_f24)); - if (sp7F = phi_v1) { - temp_f0_2 = randf2(130.0f, 150.0f); - if (!(sp54 < temp_f0_2)) { - sp54 = temp_f0_2; - } - phi_f22 = sp48 * sp54; - phi_f24 = sp50 * sp54; - } - sp5C[0] = this->position[0] + phi_f22; - sp5C[1] = this->position[1]; - sp5C[2] = this->position[2] + phi_f24; - sp78 = 0; + sp70 = arg0->position[1]; + + sp7F =(arg2 == 0.0f) ? 0 : 1; + + var_f22 = (arg1[0] - arg0->position[0]); + var_f24 = (arg1[2] - arg0->position[2]); + sp54 = gu_sqrtf((var_f22 * var_f22) + (var_f24 * var_f24)); + sp48[0] = var_f22 / sp54; + sp48[2] = var_f24 / sp54; + if (sp7F) { + temp_f0 = randf2(130.0f, 150.0f); + sp54 = MIN(sp54, temp_f0); + var_f22 = sp48[0] * sp54; + var_f24 = sp48[2] * sp54; + } + + sp5C[0] = arg0->position[0] + var_f22; + sp5C[1] = arg0->position[1]; + sp5C[2] = arg0->position[2] + var_f24; + temp_f14 = func_80309724(sp5C); + if (sp7F) { + do { - // sp70 += arg2 += D_80392D80; - // sp70 += arg2 += D_80392D80; - sp70 += arg2 += -3.2; - sp78++; - } while (func_80309724(sp5C) < sp70 || arg2 > 0.0f); + sp78 += 1; + sp74 += -3.2; + sp70 += sp74; + } while ((temp_f14 < sp70) || (sp74 > 0.0f)); } else { - sp74 = (f32) ((f64) (((arg1[1] + 40.0f) - this->position[1]) / 28.0f) - (-3.2 * (f64) 28.0f * 0.5)); sp78 = 0x1C; + temp_f0_2 = sp78; + sp74 = ((arg1[1] + 40.0f) - arg0->position[1]) / temp_f0_2 - -3.2 * temp_f0_2 /2.0; } - animctrl_setAnimTimer(this->animctrl, 0.0f); - this->unk1C[0] = D_80392D90 / sp78; - this->velocity[1] = sp74; - this->velocity[0] = phi_f22 / sp78; - this->velocity[2] = phi_f24 / sp78; + animctrl_setAnimTimer(arg0->animctrl, 0.0f); + arg0->unk1C[0] = 0.99999 / (f32)sp78; + arg0->velocity[0] = var_f22 / sp78; + arg0->velocity[1] = sp74; + arg0->velocity[2] = var_f24 / sp78; + if (sp7F) { - func_8030E878(SFX_3F2_UNKNOWN, randf2(D_80392D98, D_80392D9C), 32000, this->position, D_80392DA0, D_80392DA4); + func_8030E878(SFX_3F2_UNKNOWN, randf2(1.2f, 1.3f), 0x7D00U, arg0->position, 1750.0f, 3500.0f); } else{ - func_8030E878(SFX_53_BANJO_HUIII, randf2(D_80392DA8, 1.5f), 32000, this->position, D_80392DAC, D_80392DB0); + func_8030E878(SFX_53_BANJO_HUIII, randf2(1.4f, 1.5f), 0x7D00U, arg0->position, 1750.0f, 3500.0f); } } #endif diff --git a/subyaml/BGS.us.v10.yaml b/subyaml/BGS.us.v10.yaml index e13963e4..bd9ac3ac 100644 --- a/subyaml/BGS.us.v10.yaml +++ b/subyaml/BGS.us.v10.yaml @@ -74,7 +74,7 @@ segments: - [0x0000ACB0, .rodata, ch/yellowflibbit] - [0x0000ADA0, .rodata, done/ch/mudhut] - [0x0000ADB0, .rodata, done/ch/code_8A60] - - [0x0000ADC0, bin, data_ADC0] # .rodata, ch/tanktup] + - [0x0000ADC0, .rodata, ch/tanktup] - [0x0000ADD0, .rodata, code_9750] - [0x0000ADE0, .rodata, ch/leafboat] - [0x0000AE40, .bss, done/ch/code_6730]