From a2b18a0cc5a81e5f908b64f3b9c7a8d15d0fc1b6 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Wed, 4 Jan 2023 18:59:11 -0600 Subject: [PATCH] func_803311D4() match --- README.md | 2 +- include/prop.h | 14 +++-- progress/progress_core2.svg | 4 +- progress/progress_total.svg | 4 +- src/core2/code_A5BC0.c | 122 +++++++++++++++--------------------- 5 files changed, 66 insertions(+), 80 deletions(-) diff --git a/README.md b/README.md index 7865f4b5..8706ea0c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (97.2689%) +# banjo (97.3403%) diff --git a/include/prop.h b/include/prop.h index 2e4d8a7a..4ef94b3d 100644 --- a/include/prop.h +++ b/include/prop.h @@ -28,18 +28,24 @@ typedef struct sprite_prop_s{ } SpriteProp; typedef struct model_prop_s{ - u16 unk0_31:12; - u16 pad0_19:4; + union{ + u16 unk0; + struct{ + u16 unk0_31:12; + u16 pad0_19:4; + }; + }; u8 unk0_15; - u8 unk0_7; + u8 unk0_7; s16 unk4[3]; - u8 unkA; //scale * 100.0 + u8 unkA; u8 padB_7 :2; u8 unkB_5 :1; u8 unkB_4 :1; u8 padB_3 :4; } ModelProp; + typedef struct actor_prop_s{ struct actorMarker_s* marker; s16 x; diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 600ed47d..ae4df4e0 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -17,7 +17,7 @@ core2 - 96.1093% - 96.1093% + 96.2338% + 96.2338% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 685a579e..f6d4763b 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 97.2689% - 97.2689% + 97.3403% + 97.3403% \ No newline at end of file diff --git a/src/core2/code_A5BC0.c b/src/core2/code_A5BC0.c index 82ad1c30..00e6dd07 100644 --- a/src/core2/code_A5BC0.c +++ b/src/core2/code_A5BC0.c @@ -12,6 +12,7 @@ extern bool func_80340020(s32, f32[3], f32[3], f32, s32, BKVertexList *, f32[3], extern void func_80340200(s32, f32[3], f32[3], f32, s32, s32, BKVertexList *, s32); extern s32 func_802E9DD8(BKCollisionList *collisionList, BKVertexList *vtxList, f32 arg2[3], f32 *arg3, f32 arg4, f32 arg5[3], f32 arg6, f32 arg7[3], s32 arg8); extern void *func_802EBAE0(UNK_TYPE(s32), f32 position[3], f32 rotation[3], f32 scale, UNK_TYPE(s32), UNK_TYPE(s32), UNK_TYPE(s32), f32, UNK_TYPE(s32)); +extern int func_802E805C(BKCollisionList *, BKVertexList *, f32[3], f32[3], f32, f32[3], f32[3], f32[3], u32); extern f32 func_8030A590(void); @@ -1369,7 +1370,7 @@ void func_803308A0(void) { var_a1 = var_s0->unkC; if (var_a1) { func_80349CD8(var_a1); - modelCache[i].unkC = 0; + modelCache[i].unkC = 0; } } @@ -1592,53 +1593,33 @@ bool func_80331158(ActorMarker *arg0, s32 arg1, s32 arg2) { return FALSE; } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_A5BC0/func_803311D4.s") -#else -extern int func_802E805C(BKCollisionList *, BKVertexList *, f32[3], f32[3], f32, f32[3], f32[3], f32[3], u32); s32 func_803311D4(Cube *arg0, f32 *arg1, f32 *arg2, f32 *arg3, u32 arg4) { - f32 spAC[3]; - f32 spA0[3]; - f32 sp88[3]; - f32 sp7C[3]; - Actor *temp_s2_2; - Actor *temp_v0_6; + Actor *temp_s2_2; ActorMarker *temp_a0; - ActorMarker *temp_a0_2; - BKModelBin *temp_v0_2; - BKModelBin *temp_v0_3; BKModelBin *var_a0; - BKModelBin *var_s0; - BKModelBin *var_v0_2; + BKModelBin *var_s0 = NULL; BKVertexList *temp_a1; Prop *var_s1; - Struct6Cs *temp_v0_8; - f32 var_f10; - f32 var_f4; - f32 var_f6; - s32 (*temp_v1_2)(struct actorMarker_s *, f32 [3], f32, f32 [3], s32); - s32 temp_s0; + f32 spAC[3]; + f32 spA0[3]; + BKCollisionList *temp_s0; s32 temp_s0_2; BKCollisionList *temp_s2; - s32 temp_v0; - s32 temp_v0_4; - s32 temp_v0_5; - s32 temp_v0_7; - s32 temp_v1; + + f32 sp88[3]; + f32 sp7C[3]; + s32 var_s6; s32 var_v0; - u32 temp_t3; - u32 temp_t6; - u32 temp_t9; u32 var_s5; - var_s5 = arg0->prop2Cnt; var_s6 = 0; - var_s1 = arg0->prop2Ptr; - for(var_s5 = arg0->prop2Cnt; var_s5 > 0; var_s5--) { + for(var_s1 = arg0->prop2Ptr, var_s5 = arg0->prop2Cnt; var_s5 > 0; var_s5--, var_s1++) { + if(var_s1); + if (!var_s1->markerFlag && var_s1->unk8_1 && var_s1->unk8_4) { //ModelProp - var_s0 = func_8030A4B4(var_s1->modelProp.unk0_31); - if ((var_s0 != NULL) || (func_8028F280() && ((var_s0 = func_8030A428(var_s1->modelProp.unk0_31)) != NULL))) { + var_s0 = func_8030A4B4(((u32)var_s1->modelProp.unk0 >> 0x4)); + if ((var_s0 != NULL) || (func_8028F280() && ((var_s0 = func_8030A428(((u32)var_s1->modelProp.unk0 >> 0x4))) != NULL))) { temp_s2 = func_8033A084(var_s0); if (temp_s2 != 0) { spAC[0] = (f32) var_s1->modelProp.unk4[0]; @@ -1647,63 +1628,62 @@ s32 func_803311D4(Cube *arg0, f32 *arg1, f32 *arg2, f32 *arg3, u32 arg4) { spA0[0] = 0.0f; spA0[1] = (f32) (var_s1->modelProp.unk0_15 * 2); spA0[2] = (f32) (var_s1->modelProp.unk0_7 * 2); - var_v0 = func_802E805C(temp_s2, func_8033A148(var_s0), spAC, spA0, var_s1->modelProp.unkA / 100.0, arg1, arg2, arg3, arg4); + var_v0 = func_802E805C(temp_s2, func_8033A148(var_s0), spAC, spA0, (f32)var_s1->modelProp.unkA / 100.0, arg1, arg2, arg3, arg4); if (var_v0 != 0) { var_s6 = var_v0; } } } } else if (var_s1->markerFlag && var_s1->unk8_3 && var_s1->unk8_4 && !func_80331158(var_s1->actorProp.marker, arg1, arg2)) { - temp_a0 = var_s1->actorProp.marker; - if (temp_a0->collidable && (marker_getActor(temp_a0)->unk3C & 0x000010000)) { - var_a0 = func_80330B1C(var_s1->actorProp.marker); - } else { + if (!(var_s1->actorProp.marker->unk3E_0 && (marker_getActor(var_s1->actorProp.marker)->unk3C & 0x008000000))) { var_a0 = func_80330DE4(var_s1->actorProp.marker); + } else { + var_a0 = func_80330B1C(var_s1->actorProp.marker); } - if (var_a0 == NULL && func_8028F280(var_a0)) { - var_a0 = func_80330B1C(var_s1->actorProp.marker); - } - temp_s0 = func_8033A084(var_a0); - if (temp_s0 != 0) { - temp_s2_2 = marker_getActor(var_s1->actorProp.marker); - temp_a1 = func_80330C74(temp_s2_2); - sp88[0] = (f32) var_s1->actorProp.x; - sp88[1] = (f32) var_s1->actorProp.y; - sp88[2] = (f32) var_s1->actorProp.z; - sp7C[0] = (f32) var_s1->actorProp.marker->pitch; - sp7C[1] = (f32) var_s1->actorProp.marker->yaw; - sp7C[2] = (f32) var_s1->actorProp.marker->roll; - temp_s0_2 = func_802E805C(temp_s0, temp_a1, &sp88, &sp7C, temp_s2_2->scale, arg1, arg2, arg3, arg4); - if ((temp_s0_2 != 0) && (func_8029453C() != 0)) { - func_80330B1C(var_s1->actorProp.marker); - if (var_s1->actorProp.marker->unk50 != 0) { - D_80383410[0] = (f32) arg2[0]; - D_80383410[1] = (f32) arg2[1]; - D_80383410[2] = (f32) arg2[2]; - D_8038341C = var_s1->actorProp.marker; - D_80383420 = temp_s0_2; + + if(var_a0 != NULL || (func_8028F280() && (var_a0 = func_80330B1C(var_s1->actorProp.marker), TRUE))){ + temp_s0 = func_8033A084(var_a0); + if (temp_s0 != 0) { + temp_s2_2 = marker_getActor(var_s1->actorProp.marker); + temp_a1 = func_80330C74(temp_s2_2); + sp88[0] = (f32) var_s1->actorProp.x; + sp88[1] = (f32) var_s1->actorProp.y; + sp88[2] = (f32) var_s1->actorProp.z; + sp7C[0] = (f32) var_s1->actorProp.marker->pitch; + sp7C[1] = (f32) var_s1->actorProp.marker->yaw; + sp7C[2] = (f32) var_s1->actorProp.marker->roll; + temp_s0_2 = func_802E805C(temp_s0, temp_a1, &sp88, &sp7C, temp_s2_2->scale, arg1, arg2, arg3, arg4); + if ((temp_s0_2 != 0) && (func_8029453C())) { + func_80330B1C(var_s1->actorProp.marker); + if (var_s1->actorProp.marker->unk50 != 0) { + D_80383410[0] = arg2[0]; + D_80383410[1] = arg2[1]; + D_80383410[2] = arg2[2]; + D_8038341C = var_s1->actorProp.marker; + if ((temp_s0_2 && temp_s0_2) && temp_s0_2) + { + } + D_80383420 = temp_s0_2; + } + } + if (temp_s0_2 != 0) { + var_s6 = temp_s0_2; } - } - if (temp_s0_2 != 0) { - var_s6 = temp_s0_2; } } } else if (var_s1->markerFlag) { - temp_a0_2 = var_s1->actorProp.marker; - if (temp_a0_2->unk18 != NULL) { - if (temp_a0_2->unk18->unk0 != NULL) { - var_v0 = temp_a0_2->unk18->unk0(temp_a0_2, arg1, arg2, arg3, arg4); + if (var_s1->actorProp.marker->unk18 != NULL) { + if (var_s1->actorProp.marker->unk18->unk0 != NULL) { + var_v0 = var_s1->actorProp.marker->unk18->unk0(var_s1->actorProp.marker, arg1, arg2, arg3, arg4); if (var_v0 != 0) { var_s6 = var_v0; } } } } - var_s1++; } return var_s6; } -#endif #ifndef NONMATCHING #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_A5BC0/func_80331638.s")