From 216e1c132bf462f9452678fcdaaaa285e2b111e6 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sun, 28 Aug 2022 18:14:59 -0500 Subject: [PATCH] core2/code_C7CC0.c done --- include/structs.h | 15 +++++++++ progress/progress_core2.svg | 6 ++-- progress/progress_total.svg | 4 +-- src/core2/code_C7CC0.c | 62 ++++++++++++++++++++++++----------- subyaml/core2.us.v10.yaml | 4 +-- symbol_addrs.core2.us.v10.txt | 2 ++ 6 files changed, 66 insertions(+), 27 deletions(-) diff --git a/include/structs.h b/include/structs.h index 35d4eb53..70cade0e 100644 --- a/include/structs.h +++ b/include/structs.h @@ -793,6 +793,20 @@ typedef struct { f32 unk14; }Struct76s; +typedef struct { + f32 unk0; + f32 unk4; + f32 unk8; + f32 unkC; + f32 unk10; + f32 unk14; + u8 unk18[0x8]; + f32 unk20; + f32 unk24; + s16 unk28[2]; + f32 unk2C; +}Struct77s; + typedef union { Struct6Ds type_6D; Struct6Fs type_6F; @@ -800,6 +814,7 @@ typedef union { Struct72s type_72; Struct73s type_73; Struct74s type_74; + Struct77s type_77; }Struct70s; typedef struct { diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 5bdd7287..872c8b17 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core2 - 82.2258% - 82.2258% + 82.3791% + 82.3791% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index a1da3625..9d9022bf 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 84.7842% - 84.7842% + 84.8722% + 84.8722% \ No newline at end of file diff --git a/src/core2/code_C7CC0.c b/src/core2/code_C7CC0.c index e1bfaa6a..9ae59897 100644 --- a/src/core2/code_C7CC0.c +++ b/src/core2/code_C7CC0.c @@ -2,26 +2,17 @@ #include "functions.h" #include "variables.h" -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_C7CC0/func_8034EC50.s") -#else -void func_8034EC50(s32 arg0, BKVtxRef *ref, Vtx *dst, Struct74s *arg3) { - f32 cos; - f32 sin; - f32 temp_f2; - s32 temp_f16; +void func_8034EC50(s32 arg0, BKVtxRef *ref, Vtx *dst, Struct77s *arg3) { f32 tmp0; f32 tmp1; - f32 d0; - f32 d1; + f32 temp_f2; + s32 temp_f16; - tmp0 = (dst->v.ob[0] - arg3->unk10)*200.0f; - tmp1 = (dst->v.ob[2] - arg3->unk14)*200.0f; - tmp0 += arg3->unk4; - tmp1 += arg3->unk8; - sin = sinf(tmp0); - cos = cosf(tmp1); - temp_f2 = (cos + sin) * arg3->unk20; + tmp0 = arg3->unk4; + tmp1 = arg3->unk8; + tmp0 += (dst->v.ob[0] - arg3->unk10)*200.0f; + tmp1 += (dst->v.ob[2] - arg3->unk14)*200.0f; + temp_f2 = (sinf(tmp0) + cosf(tmp1)) * arg3->unk20; dst->v.ob[1] = arg3->unkC + temp_f2; temp_f16 = (s32) (((temp_f2 / arg3->unk24) * 50.0f) + 205.0f); dst->v.cn[0] = (s32)(ref->v.v.cn[0] * temp_f16) / 255; @@ -30,10 +21,41 @@ void func_8034EC50(s32 arg0, BKVtxRef *ref, Vtx *dst, Struct74s *arg3) { dst->v.tc[0] = ref->v.v.tc[0] + arg3->unk28[0]; dst->v.tc[1] = ref->v.v.tc[1] + arg3->unk28[1]; } -#endif void func_8034EE24(s32 arg0){} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_C7CC0/func_8034EE2C.s") +void func_8034EE2C(Struct77s *arg0, s32 arg1, BKModel *arg2, s32 arg3) { + s16 sp28[3]; + s16 sp20[3]; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_C7CC0/func_8034EF60.s") + func_8033F2B4(arg2, arg3, sp28, sp20); + arg0->unk0 = 1.0f; + arg0->unk4 = 0.0f; + arg0->unk8 = 0.0f; + arg0->unkC = sp28[1] + ((sp20[1] - sp28[1]) * 0.5); + arg0->unk10 = (f32) sp28[0]; + arg0->unk14 = (f32) sp28[2]; + arg0->unk20 = ((sp20[1] - sp28[1]) * 0.5) / 2; + arg0->unk24 = arg0->unk20 * 2; + arg0->unk28[0] = 0; + arg0->unk28[1] = 0; + arg0->unk2C = 0.0f; + if ((arg1 >= 0) && (arg1 < 0xB)) { + arg0->unk0 = arg1 / 10.0f; + } +} + +void func_8034EF60(Struct77s *arg0, BKModel *arg1, s32 arg2) { + f32 temp_f0; + f32 sp2C[2]; + + temp_f0 = time_getDelta(); + arg0->unk2C += temp_f0; + arg0->unk4 += temp_f0 * arg0->unk0 * 3; + arg0->unk8 += temp_f0 * (arg0->unk0 + 0.01) * 3; + sp2C[0] = ((150.0f * cosf(arg0->unk2C * 0.2 * BAD_PI)) + (sinf(arg0->unk2C * 0.08 * BAD_PI) * 100.0f)) * 0.8; + sp2C[1] = ((50.0f * sinf(arg0->unk2C * 0.5 * BAD_PI)) + (cosf(arg0->unk2C * 0.22 * BAD_PI) * 100.0f)) * 0.8; + arg0->unk28[0] = (sp2C[0] >= 0.0) ? (sp2C[0] + 0.5) : (sp2C[0] - 0.5); + arg0->unk28[1] = (sp2C[1] >= 0.0) ? (sp2C[1] + 0.5) : (sp2C[1] - 0.5); + func_8033F120(arg1, arg2, &func_8034EC50, arg0); +} diff --git a/subyaml/core2.us.v10.yaml b/subyaml/core2.us.v10.yaml index b1a86ac6..d8b1edc1 100644 --- a/subyaml/core2.us.v10.yaml +++ b/subyaml/core2.us.v10.yaml @@ -370,7 +370,7 @@ segments: - [0xC61C0, c, code_C61C0] #DONE - [0xC62B0, c, code_C62B0] - [0xC76D0, c, code_C76D0] - - [0xC7CC0, c, code_C7CC0] + - [0xC7CC0, c, code_C7CC0] #DONE - [0xC8230, c, code_C8230] #DONE - [0xC8360, c, code_C8360] #DONE - [0xC8490, c, code_C8490] #DONE @@ -811,7 +811,7 @@ segments: - [0xF2240, .rodata, code_C5F00] - [0xF2270, bin, data_F2230] - [0xF22A0, bin, data_F22A0] # .rodata, code_C76D0] - - [0xF22E0, bin, data_F22E0] + - [0xF22E0, .rodata, code_C7CC0] - [0xF2320, .rodata, code_C8230] - [0xF2330, .rodata, code_C8360] - [0xF2340, .rodata, code_C8490] diff --git a/symbol_addrs.core2.us.v10.txt b/symbol_addrs.core2.us.v10.txt index 31f4ffda..6f82656d 100644 --- a/symbol_addrs.core2.us.v10.txt +++ b/symbol_addrs.core2.us.v10.txt @@ -473,6 +473,8 @@ D_80379094 = 0x80379094; D_803790C0 = 0x803790C0; D_803790C8 = 0x803790C8; D_803790D0 = 0x803790D0; +D_80379278 = 0x80379278; +D_80379280 = 0x80379280; D_80379308 = 0x80379308; D_80379318 = 0x80379318; D_80379328 = 0x80379328;