From 9744a6fa0d7cb0ef6451f701eb209f2b427c38ac Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Fri, 28 Oct 2022 17:35:44 -0500 Subject: [PATCH] core2/code_72060.c func_802F962C done --- README.md | 2 +- include/functions.h | 20 +++--- include/model.h | 3 +- progress/progress_core2.svg | 6 +- progress/progress_total.svg | 6 +- src/core2/code_637D0.c | 125 ++++++++++++++++++++++++------------ src/core2/code_72060.c | 87 +++++++++++-------------- src/core2/code_73640.c | 54 ++++++++-------- src/core2/code_76390.c | 8 +-- src/core2/code_763D0.c | 10 +-- src/core2/code_78100.c | 9 +-- src/core2/sla.c | 30 ++++++++- 12 files changed, 211 insertions(+), 149 deletions(-) diff --git a/README.md b/README.md index 94b97fc8..216eb244 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (92.0219%) +# banjo (92.1173%) diff --git a/include/functions.h b/include/functions.h index 2a9a18ec..c41bfa19 100644 --- a/include/functions.h +++ b/include/functions.h @@ -175,15 +175,15 @@ void jiggySpawn(enum jiggy_e jiggy_id, f32 pos[3]); struct3s *func_802F8264(s32 arg0); struct6s *func_802F8BE0(s32 arg0); -struct7s *func_802FD320(enum asset_e item_id); -void func_802FD330(enum item_e, struct8s *); -void func_802FD33C(enum item_e arg0, struct8s *arg1, Gfx **arg2, Mtx **arg3, Vtx **arg4); -void func_802FD350(enum item_e item_id, struct8s *); +struct7s *fxcommon1score_new(enum asset_e item_id); +void fxcommon1score_update(enum item_e, struct8s *); +void fxcommon1score_draw(enum item_e arg0, struct8s *arg1, Gfx **arg2, Mtx **arg3, Vtx **arg4); +void fxcommon1score_free(enum item_e item_id, struct8s *); -struct8s *func_802FD7B0(enum item_e); -void func_802FD80C(s32, struct8s *); -void func_802FDAF4(enum item_e, struct8s *, Gfx**, Mtx**, Vtx **); -void func_802FDC80(enum item_e, struct8s *); +struct8s *fxcommon2score_new(enum item_e); +void fxcommon2score_update(s32, struct8s *); +void fxcommon2score_draw(enum item_e, struct8s *, Gfx**, Mtx**, Vtx **); +void fxcommon2score_free(enum item_e, struct8s *); struct7s *func_802FDE2C(s32); void func_802FE844(s32, struct8s *); @@ -191,9 +191,9 @@ void func_802FDEE0(s32, struct8s *, Gfx**, Mtx**, s32*); void func_802FDDC4(s32, struct8s *); struct7s *func_802FF090(enum item_e); -void func_802FFA50(enum item_e, struct8s *); +void fxjinjoscore_update(enum item_e, struct8s *); void func_802FF3B8(s32, struct8s *, Gfx**, Mtx**, Vtx **); -void func_802FF358(enum item_e, struct8s *); +void fxjinjoscore_free(enum item_e, struct8s *); struct7s *func_802FFE4C(s32); void func_803005BC(enum item_e, struct8s *); diff --git a/include/model.h b/include/model.h index cce62efb..1a7f0d6d 100644 --- a/include/model.h +++ b/include/model.h @@ -126,7 +126,8 @@ typedef struct { s16 unk0; s16 unk2[3]; u8 unk8; - u8 pad9[3]; + s8 unk9; + u8 padA[2]; }BKModelUnk14_2; typedef struct { diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 063bb935..86958d6b 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core2 - 90.2709% - 90.2709% + 90.4371% + 90.4371% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 9fcd7ccb..2a246656 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 92.0219% - 92.0219% + 92.1173% + 92.1173% \ No newline at end of file diff --git a/src/core2/code_637D0.c b/src/core2/code_637D0.c index 65da711f..a59a63fe 100644 --- a/src/core2/code_637D0.c +++ b/src/core2/code_637D0.c @@ -80,6 +80,7 @@ s32 func_802EA864(BKModelUnk14List *arg0, f32 position[3], f32 rotation[3], f32 } #ifndef NONMATCHING +s32 func_802EAB34(BKModelUnk14List *arg0, f32 position[3], f32 rotation[3], f32 scale, f32 arg4[3], f32 arg5[3], f32 arg6); #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_637D0/func_802EAB34.s") #else s32 func_802EAB34(BKModelUnk14List *arg0, f32 position[3], f32 rotation[3], f32 scale, f32 arg4[3], f32 arg5[3], f32 arg6){ @@ -312,55 +313,95 @@ s32 func_802EB458(BKModelUnk14List *arg0, f32 position[3], f32 rotation[3], f32 } #endif -s32 func_802EB8A0(BKModelUnk14List *arg0, f32 position[3], f32 rotation[3], f32 scale, s32 arg4, s32 arg5, f32 arg6[3], f32 arg7); -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_637D0/func_802EB8A0.s") +s32 func_802EB8A0(BKModelUnk14List *arg0, f32 *position, f32 *rotation, f32 scale, s32 arg4, s32 arg5, f32 *arg6, f32 arg7) { + BKModelUnk14_0 *t0_ptr; + BKModelUnk14_1 *t1_ptr; + f32 sp74[3]; + f32 sp68[3]; + f32 sp5C[3]; + BKModelUnk14_2 *temp_s4; + BKModelUnk14_2 *var_s0; + f32 temp_f0; + f32 sp44[3]; + + mlMtxIdent(); + func_80252CC4(position, rotation, scale, arg4); + func_8025235C(&sp74, arg6); + t0_ptr = (BKModelUnk14_0 *)(arg0 + 1); + t1_ptr = (BKModelUnk14_1 *)(t0_ptr + arg0->cnt0); + var_s0 = (BKModelUnk14_2 *)(t1_ptr + arg0->cnt2); + temp_s4 = var_s0 + arg0->unk4; + arg7 /= scale; + for(var_s0 = var_s0; var_s0 < temp_s4; var_s0++){ + sp68[0] = (f32) var_s0->unk2[0]; + sp68[1] = (f32) var_s0->unk2[1]; + sp68[2] = (f32) var_s0->unk2[2]; + sp5C[0] = sp68[0] + (f32) var_s0->unk0; + sp5C[1] = sp68[1]; + sp5C[2] = sp68[2]; + func_80251BCC(func_802EA110(arg5, var_s0->unk9)); + func_8025235C(sp68, sp68); + func_8025235C(sp5C, sp5C); + sp44[0] = sp5C[0] - sp68[0]; + sp44[1] = sp5C[1] - sp68[1]; + sp44[2] = sp5C[2] - sp68[2]; + temp_f0 = gu_sqrtf(sp44[0]*sp44[0] + sp44[1]*sp44[1] + sp44[2]*sp44[2]); + if ((arg7 + temp_f0 >= ml_vec3f_distance(sp68, sp74))) { + return (s32) var_s0->unk8; + } + } + return 0; +} bool func_802EBA98(BKModelUnk14List *arg0, f32 arg1[3], s32 arg2, f32 arg3, s32 arg4, f32 arg5[3], f32 arg6, f32 arg7[3]){ return func_802EBAE0(arg0, arg1, arg2, arg3, arg4, NULL, arg5, arg6, arg7); } +#ifndef NONMATCHING #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_637D0/func_802EBAE0.s") -// s32 func_802EBAE0(BKModelUnk14List *arg0, f32 position[3], f32 rotation[3], f32 scale, s32 arg4, s32 arg5, f32 arg6[3], f32 arg7, f32 arg8[3]) { -// f32 sp3C[3]; -// f32 temp_f0; -// s32 phi_v0; +#else +s32 func_802EBAE0(BKModelUnk14List *arg0, f32 position[3], f32 rotation[3], f32 scale, s32 arg4, s32 arg5, f32 arg6[3], f32 arg7, f32 arg8[3]) { + f32 sp3C[3]; + f32 temp_f0; + s32 phi_v0; -// sp3C[0] = arg6[0] - position[0]; -// sp3C[1] = arg6[1] - position[1]; -// sp3C[2] = arg6[2] - position[2]; -// temp_f0 = (arg7 + (arg0->unk6 * scale)); -// if( (arg0->unk6 > 0) -// && ((temp_f0 * temp_f0) < (sp3C[0] * sp3C[0]) + (sp3C[1] * sp3C[1]) + (sp3C[2] * sp3C[2])) -// ) { -// return 0; -// } -// if (arg5 != NULL) { -// mlMtxIdent(); -// func_80252C08(position, rotation, scale, arg4); -// func_802513B0(&D_80380880); -// phi_v0 = func_802EB8A0(arg0, position, rotation, scale, arg4, arg5, arg6, arg7); -// if (phi_v0 == 0) { -// phi_v0 = func_802EAED4(arg0, position, rotation, scale, arg4, arg5, arg6, arg7); -// } -// if (phi_v0 == 0) { -// phi_v0 = func_802EB458(arg0, position, rotation, scale, arg4, arg5, arg6, arg7); -// } -// } else { -// phi_v0 = func_802EAD5C(arg0, position, rotation, scale, arg4, arg6, arg7); -// if(phi_v0 == 0){ -// phi_v0 = func_802EA864(arg0, position, rotation, scale, arg4, arg6, arg7); -// } -// if(phi_v0 == 0){ -// phi_v0 = func_802EAB34(arg0, position, rotation, scale, arg4, arg6, arg7); -// } -// } -// if (phi_v0 != 0) { -// arg8[0] = 0.0f; -// arg8[1] = 1.0f; -// arg8[2] = 0.0f; -// } -// return phi_v0; -// } + sp3C[0] = arg6[0] - position[0]; + sp3C[1] = arg6[1] - position[1]; + sp3C[2] = arg6[2] - position[2]; + temp_f0 = (arg7 + (arg0->unk6 * scale)); + if( (arg0->unk6 > 0) + && ((temp_f0 * temp_f0) < (sp3C[0] * sp3C[0]) + (sp3C[1] * sp3C[1]) + (sp3C[2] * sp3C[2])) + ) { + return 0; + } + if (arg5 != NULL) { + mlMtxIdent(); + func_80252C08(position, rotation, scale, arg4); + func_802513B0(&D_80380880); + phi_v0 = func_802EB8A0(arg0, position, rotation, scale, arg4, arg5, arg6, arg7); + if (phi_v0 == 0) { + phi_v0 = func_802EAED4(arg0, position, rotation, scale, arg4, arg5, arg6, arg7); + } + if (phi_v0 == 0) { + phi_v0 = func_802EB458(arg0, position, rotation, scale, arg4, arg5, arg6, arg7); + } + } else { + phi_v0 = func_802EAD5C(arg0, position, rotation, scale, arg4, arg6, arg7); + if(phi_v0 == 0){ + phi_v0 = func_802EA864(arg0, position, rotation, scale, arg4, arg6, arg7); + } + if(phi_v0 == 0){ + phi_v0 = func_802EAB34(arg0, position, rotation, scale, arg4, arg6, arg7); + } + } + if (phi_v0 != 0) { + arg8[0] = 0.0f; + arg8[1] = 1.0f; + arg8[2] = 0.0f; + } + return phi_v0; +} +#endif #ifndef NONMATCHING s32 func_802EBD3C(BKModelUnk14List *arg0, f32 arg1[3], f32 arg2[3], f32 arg3, s32 arg4, f32 arg5[3], s32 arg6); diff --git a/src/core2/code_72060.c b/src/core2/code_72060.c index 5f19b37d..11396108 100644 --- a/src/core2/code_72060.c +++ b/src/core2/code_72060.c @@ -14,12 +14,15 @@ extern void func_80251F8C(f32); extern void func_8025208C(f32); extern void func_80252A38(f32, f32, f32); extern void mlMtxApply(Mtx *); +extern f32 func_802EC920(BKVertexList *); +extern bool func_8024DB50(f32[3], f32); extern struct4Cs * D_80369280; extern s32 D_80369284; -extern void * D_80369288; +extern BKModelBin * D_80369288; extern s32 D_8036928C; extern Gfx D_80369290[]; +extern Gfx D_803692B0[]; extern f32 D_80377350; extern f32 D_80377354; @@ -31,7 +34,7 @@ f32 D_80381050[3]; f32 D_80381060[3]; f32 D_80381070[3]; f32 D_80381080[3]; -s32 D_8038108C; +f32 D_8038108C; Gfx *D_80381090; Struct_core2_72060_0 *D_80381094; @@ -161,54 +164,42 @@ void func_802F919C(void) { } #endif +void func_802F962C(Gfx **gfx, Mtx **mtx, Vtx **vtx) { + u32 temp_s0_3; + u32 temp_s0_4; + void *temp_s0; + void *temp_s0_2; + BKVertexList *temp_s3; + void *temp_s3_2; + void *temp_s4; + void *temp_s4_2; + BKGfxList *gfx_list; + struct4Ds *phi_s0; + void *phi_s0_2; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_72060/func_802F962C.s") -// void func_802F962C(Gfx **gfx, Mtx **mtx, Vtx **vtx) { -// u32 temp_s0_3; -// u32 temp_s0_4; -// void *temp_s0; -// void *temp_s0_2; -// void *temp_s3; -// void *temp_s3_2; -// void *temp_s4; -// void *temp_s4_2; -// void *temp_v1; -// void *temp_v1_2; -// void *temp_v1_3; -// void *phi_s0; -// void *phi_s0_2; + if ((D_80369280 != NULL) && (D_80369284 != 0)) { + func_8024C5CC(D_80381050); + func_8024C764(D_80381060); + D_80381090 = (s32)D_80369288 + D_80369288->gfx_list_offset_C + sizeof(BKGfxList); + temp_s3 = (BKVertexList *)((s32)D_80369288 + D_80369288->vtx_list_offset_10); + D_8038108C = func_802EC920(temp_s3); + func_80349AD0(); + gSPSegment((*gfx)++, 0x01, osVirtualToPhysical(temp_s3 + 1)); + gSPSegment((*gfx)++, 0x02, osVirtualToPhysical((s32)D_80369288 + D_80369288->texture_list_offset_8 + sizeof(BKTextureList) + sizeof(BKTextureHeader))); + gSPSetGeometryMode((*gfx)++, G_ZBUFFER); + gSPDisplayList((*gfx)++, D_80369290); + gSPSegment((*gfx)++, 0x03, osVirtualToPhysical(&D_803692B0)); -// if ((D_80369280 != NULL) && (D_80369284 != 0)) { -// func_8024C5CC(D_80381050); -// func_8024C764(D_80381060); -// temp_v1 = D_80369288; -// D_80381090 = temp_v1 + temp_v1->unkC + 8; -// temp_s3 = temp_v1 + temp_v1->unk10; -// D_8038108C = func_802EC920(temp_s3); -// func_80349AD0(); -// gSPSegment((*gfx)++, 0x01, osVirtualToPhysical(temp_s3 + 0x18)); -// gSPSegment((*gfx)++, 0x02, osVirtualToPhysical(temp_v1_2 + temp_v1_2->unk8 + 0x18)); -// gSPSetGeometryMode((*gfx)++, G_ZBUFFER); -// gSPDisplayList((*gfx)++, D_80369290); -// gSPSegment((*gfx)++, 0x03, osVirtualToPhysical(&D_803692B0)); - -// temp_v1_3 = D_80369288; -// D_80381094 = temp_v1_3 + temp_v1_3->unk4; -// temp_s0_3 = D_80369280->unk1C; -// phi_s0 = (void *) temp_s0_3; -// if (temp_s0_3 < (u32) (temp_s0_3 + (D_80369284 * 0x18))) { -// do { -// phi_s0_2 = phi_s0; -// if ((func_802F989C(gfx, mtx, phi_s0) == 0) && (phi_s0->unk4 < D_8038104C)) { -// func_802F9134((s32) (phi_s0 - D_80369280->unk1C) / 24); -// phi_s0_2 = phi_s0 - 0x18; -// } -// temp_s0_4 = phi_s0_2 + 0x18; -// phi_s0 = (void *) temp_s0_4; -// } while (temp_s0_4 < (u32) (D_80369280->unk1C + (D_80369284 * 0x18))); -// } -// } -// } + D_80381094 = (BKGeoList *)((s32)D_80369288 + D_80369288->geo_list_offset_4); + + for(phi_s0 = D_80369280->unk1C; phi_s0 < D_80369280->unk1C + D_80369284; phi_s0++) { + if ((func_802F989C(gfx, mtx, phi_s0) == 0) && (phi_s0->unk0[1] < D_8038104C)) { + func_802F9134(phi_s0 - D_80369280->unk1C); + phi_s0--; + } + } + } +} bool func_802F989C(Gfx **gfx, Mtx **mtx, f32 arg2[3]) { diff --git a/src/core2/code_73640.c b/src/core2/code_73640.c index a54a573b..b96daa10 100644 --- a/src/core2/code_73640.c +++ b/src/core2/code_73640.c @@ -40,35 +40,35 @@ s16 D_803692EC[6] = { }; ItemPrint D_803692F8[0x2C] = { - { func_802FD7B0, func_802FD80C, func_802FDAF4, func_802FDC80, 5, NULL }, //ITEM_0_HOURGLASS_TIMER - { func_802FD7B0, func_802FD80C, func_802FDAF4, func_802FDC80, 0, NULL }, // ITEM_1_SKULL_HOURGLASS_TIMER - { func_802FD320, func_802FD330, func_802FD33C, func_802FD350, 0, NULL }, //2 - { func_802FD7B0, func_802FD80C, func_802FDAF4, func_802FDC80, 5, NULL }, //ITEM_3_PROPELLOR_TIMER - { func_802FD320, func_802FD330, func_802FD33C, func_802FD350, 0, NULL }, // - { func_802FD7B0, func_802FD80C, func_802FDAF4, func_802FDC80, 0, NULL }, //ITEM_5_XMAS_TREE_TIMER - { func_802FD320, func_802FD330, func_802FD33C, func_802FD350, 0, NULL }, //ITEM_6_HOURGLASS - { func_802FD320, func_802FD330, func_802FD33C, func_802FD350, 0, NULL }, //ITEM_7_SKULL_HOURGLASS - { func_802FD320, func_802FD330, func_802FD33C, func_802FD350, 0, NULL }, //8 - { func_802FD320, func_802FD330, func_802FD33C, func_802FD350, 0, NULL }, //ITEM_9_PROPELLOR - { func_802FD320, func_802FD330, func_802FD33C, func_802FD350, 0, NULL }, //10 - { func_802FD320, func_802FD330, func_802FD33C, func_802FD350, 0, NULL }, //ITEM_B_XMAS_TREE - { func_802FD7B0, func_802FD80C, func_802FDAF4, func_802FDC80, 1, NULL }, //ITEM_C_NOTE - { func_802FD7B0, func_802FD80C, func_802FDAF4, func_802FDC80, 1, NULL }, //ITEM_D_EGGS + { fxcommon2score_new, fxcommon2score_update, fxcommon2score_draw, fxcommon2score_free, 5, NULL }, //ITEM_0_HOURGLASS_TIMER + { fxcommon2score_new, fxcommon2score_update, fxcommon2score_draw, fxcommon2score_free, 0, NULL }, // ITEM_1_SKULL_HOURGLASS_TIMER + { fxcommon1score_new, fxcommon1score_update, fxcommon1score_draw, fxcommon1score_free, 0, NULL }, //2 + { fxcommon2score_new, fxcommon2score_update, fxcommon2score_draw, fxcommon2score_free, 5, NULL }, //ITEM_3_PROPELLOR_TIMER + { fxcommon1score_new, fxcommon1score_update, fxcommon1score_draw, fxcommon1score_free, 0, NULL }, // + { fxcommon2score_new, fxcommon2score_update, fxcommon2score_draw, fxcommon2score_free, 0, NULL }, //ITEM_5_XMAS_TREE_TIMER + { fxcommon1score_new, fxcommon1score_update, fxcommon1score_draw, fxcommon1score_free, 0, NULL }, //ITEM_6_HOURGLASS + { fxcommon1score_new, fxcommon1score_update, fxcommon1score_draw, fxcommon1score_free, 0, NULL }, //ITEM_7_SKULL_HOURGLASS + { fxcommon1score_new, fxcommon1score_update, fxcommon1score_draw, fxcommon1score_free, 0, NULL }, //8 + { fxcommon1score_new, fxcommon1score_update, fxcommon1score_draw, fxcommon1score_free, 0, NULL }, //ITEM_9_PROPELLOR + { fxcommon1score_new, fxcommon1score_update, fxcommon1score_draw, fxcommon1score_free, 0, NULL }, //10 + { fxcommon1score_new, fxcommon1score_update, fxcommon1score_draw, fxcommon1score_free, 0, NULL }, //ITEM_B_XMAS_TREE + { fxcommon2score_new, fxcommon2score_update, fxcommon2score_draw, fxcommon2score_free, 1, NULL }, //ITEM_C_NOTE + { fxcommon2score_new, fxcommon2score_update, fxcommon2score_draw, fxcommon2score_free, 1, NULL }, //ITEM_D_EGGS { fxcommon3score_new, fxcommon3score_update, fxcommon3score_draw, fxcommon3score_free, 3, NULL }, //ITEM_14_HEALTH - { func_802FD7B0, func_802FD80C, func_802FDAF4, func_802FDC80, 1, NULL }, //ITEM_F_RED_FEATHER - { func_802FD7B0, func_802FD80C, func_802FDAF4, func_802FDC80, 1, NULL }, //ITEM_10_GOLD_FEATHER - { func_802FD320, func_802FD330, func_802FD33C, func_802FD350, 0, NULL }, //17 - { func_802FF090, func_802FFA50, func_802FF3B8, func_802FF358, 3, NULL }, //ITEM_12_JINJOS + { fxcommon2score_new, fxcommon2score_update, fxcommon2score_draw, fxcommon2score_free, 1, NULL }, //ITEM_F_RED_FEATHER + { fxcommon2score_new, fxcommon2score_update, fxcommon2score_draw, fxcommon2score_free, 1, NULL }, //ITEM_10_GOLD_FEATHER + { fxcommon1score_new, fxcommon1score_update, fxcommon1score_draw, fxcommon1score_free, 0, NULL }, //17 + { func_802FF090, fxjinjoscore_update, func_802FF3B8, fxjinjoscore_free, 3, NULL }, //ITEM_12_JINJOS { func_802FDE2C, func_802FE844, func_802FDEE0, func_802FDDC4, 0, NULL }, //ITEM_13_EMPTY_HONEYCOMB { func_80300CD8, func_80301348, func_80300D0C, func_80300C70, 0, NULL }, //ITEM_14_HEALTH - { func_802FD320, func_802FD330, func_802FD33C, func_802FD350, 0, NULL }, //ITEM_15_HEALTH_TOTAL + { fxcommon1score_new, fxcommon1score_update, fxcommon1score_draw, fxcommon1score_free, 0, NULL }, //ITEM_15_HEALTH_TOTAL { func_802FFE4C, func_803005BC, func_802FFF34, func_802FFED4, 6, NULL }, //ITEM_16_LIFE { func_8030179C, func_80301DE4, func_803017D0, func_80301754, 0, NULL }, //ITEM_17_AIR { fxcommon3score_new, fxcommon3score_update, fxcommon3score_draw, fxcommon3score_free, 2, NULL }, //ITEM_18_GOLD_BULLIONS { fxcommon3score_new, fxcommon3score_update, fxcommon3score_draw, fxcommon3score_free, 2, NULL }, //ITEM_19_ORANGE - { func_802FD7B0, func_802FD80C, func_802FDAF4, func_802FDC80, 6, NULL }, //ITEM_1A_PLAYER_VILE_SCORE - { func_802FD7B0, func_802FD80C, func_802FDAF4, func_802FDC80, 0, NULL }, //ITEM_1B_VILE_VILE_SCORE - { func_802FD7B0, func_802FD80C, func_802FDAF4, func_802FDC80, 2, NULL }, //ITEM_1C_MUMBO_TOKEN + { fxcommon2score_new, fxcommon2score_update, fxcommon2score_draw, fxcommon2score_free, 6, NULL }, //ITEM_1A_PLAYER_VILE_SCORE + { fxcommon2score_new, fxcommon2score_update, fxcommon2score_draw, fxcommon2score_free, 0, NULL }, //ITEM_1B_VILE_VILE_SCORE + { fxcommon2score_new, fxcommon2score_update, fxcommon2score_draw, fxcommon2score_free, 2, NULL }, //ITEM_1C_MUMBO_TOKEN { fxcommon3score_new, fxcommon3score_update, fxcommon3score_draw, fxcommon3score_free, 0, NULL }, //ITEM_1D_GRUMBLIE { fxcommon3score_new, fxcommon3score_update, fxcommon3score_draw, fxcommon3score_free, 0, NULL }, //ITEM_1E_YUMBLIE { fxcommon3score_new, fxcommon3score_update, fxcommon3score_draw, fxcommon3score_free, 2, NULL }, //ITEM_1F_GREEN_PRESENT @@ -77,12 +77,12 @@ ItemPrint D_803692F8[0x2C] = { { fxcommon3score_new, fxcommon3score_update, fxcommon3score_draw, fxcommon3score_free, 2, NULL }, //ITEM_22_CATERPILLAR { fxcommon3score_new, fxcommon3score_update, fxcommon3score_draw, fxcommon3score_free, 2, NULL }, //ITEM_23_ACORNS { fxcommon3score_new, fxcommon3score_update, fxcommon3score_draw, fxcommon3score_free, 0, NULL }, //ITEM_24_TWINKLY_SCORE - { func_802FD7B0, func_802FD80C, func_802FDAF4, func_802FDC80, 4, NULL }, //ITEM_25_MUMBO_TOKEN_TOTAL + { fxcommon2score_new, fxcommon2score_update, fxcommon2score_draw, fxcommon2score_free, 4, NULL }, //ITEM_25_MUMBO_TOKEN_TOTAL { fxcommon3score_new, fxcommon3score_update, fxcommon3score_draw, fxcommon3score_free, 4, NULL }, //ITEM_26_JIGGY_TOTAL - { func_802FD7B0, func_802FD80C, func_802FDAF4, func_802FDC80, 2, NULL }, //ITEM_27_JOKER_CARD - { func_802FD7B0, func_802FD80C, func_802FD33C, func_802FDC80, 5, NULL }, //40 - { func_802FD7B0, func_802FD80C, func_802FD33C, func_802FDC80, 3, NULL }, //41 - { func_802FD7B0, func_802FD80C, func_802FD33C, func_802FDC80, 2, NULL }, //42 + { fxcommon2score_new, fxcommon2score_update, fxcommon2score_draw, fxcommon2score_free, 2, NULL }, //ITEM_27_JOKER_CARD + { fxcommon2score_new, fxcommon2score_update, fxcommon1score_draw, fxcommon2score_free, 5, NULL }, //40 + { fxcommon2score_new, fxcommon2score_update, fxcommon1score_draw, fxcommon2score_free, 3, NULL }, //41 + { fxcommon2score_new, fxcommon2score_update, fxcommon1score_draw, fxcommon2score_free, 2, NULL }, //42 { fxcommon3score_new, fxcommon3score_update, fxcommon3score_draw, fxcommon3score_free, 2, NULL } //43 }; diff --git a/src/core2/code_76390.c b/src/core2/code_76390.c index 2e0c18d8..bdee37f9 100644 --- a/src/core2/code_76390.c +++ b/src/core2/code_76390.c @@ -6,12 +6,12 @@ struct7s D_803815A0; /* .code */ -struct7s *func_802FD320(enum asset_e item_id){ +struct7s *fxcommon1score_new(enum asset_e item_id){ return &D_803815A0; } -void func_802FD330(enum item_e item_id, struct8s *arg1){} +void fxcommon1score_update(enum item_e item_id, struct8s *arg1){} -void func_802FD33C(enum item_e item_id, struct8s *arg1, Gfx **arg2, Mtx **arg3, Vtx **arg4){} +void fxcommon1score_draw(enum item_e item_id, struct8s *arg1, Gfx **arg2, Mtx **arg3, Vtx **arg4){} -void func_802FD350(enum item_e item_id, struct8s *arg1){} +void fxcommon1score_free(enum item_e item_id, struct8s *arg1){} diff --git a/src/core2/code_763D0.c b/src/core2/code_763D0.c index db054bb3..f77b42d4 100644 --- a/src/core2/code_763D0.c +++ b/src/core2/code_763D0.c @@ -191,7 +191,7 @@ void func_802FD360(struct8s *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx){ func_8024C904(gfx, mtx); } -struct8s *func_802FD7B0(enum item_e item_id) { +struct8s *fxcommon2score_new(enum item_e item_id) { s32 i; struct8s *v1; @@ -204,7 +204,7 @@ struct8s *func_802FD7B0(enum item_e item_id) { return NULL; } -void func_802FD80C(s32 arg0, struct8s * arg1){ +void fxcommon2score_update(s32 arg0, struct8s * arg1){ s32 tmp; f32 two = 2.0f; f32 phi_f16; @@ -213,7 +213,7 @@ void func_802FD80C(s32 arg0, struct8s * arg1){ tmp = func_802FB0D4(arg1); phi_f16 = 1.0f; if(!tmp) { - func_802FDC80(arg0, arg1); + fxcommon2score_free(arg0, arg1); } else{ if(arg1->unk50 == NULL && arg1->unk24){ @@ -271,7 +271,7 @@ void func_802FD80C(s32 arg0, struct8s * arg1){ } } -void func_802FDAF4(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vtx **vtx){ +void fxcommon2score_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vtx **vtx){ f32 pad; s32 sp38; f32 sp34; @@ -308,7 +308,7 @@ void func_802FDAF4(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vt func_802FD360(arg1, gfx, mtx, vtx); } -void func_802FDC80(enum item_e item_id, struct8s *arg1){ +void fxcommon2score_free(enum item_e item_id, struct8s *arg1){ if(arg1->unk50){ func_8033BD4C(arg1->unk50); //assetCache_free arg1->unk50 = NULL; diff --git a/src/core2/code_78100.c b/src/core2/code_78100.c index b4c6a6e2..35ece2d9 100644 --- a/src/core2/code_78100.c +++ b/src/core2/code_78100.c @@ -106,7 +106,7 @@ struct7s *func_802FF090(s32 arg0) { } #endif -void func_802FF358(enum item_e item_id, struct8s * arg1){ +void fxjinjoscore_free(enum item_e item_id, struct8s * arg1){ s32 i; for(i = 0; i < 5; i++){ @@ -121,6 +121,7 @@ void func_802FF358(enum item_e item_id, struct8s * arg1){ #ifndef NONMATCHING #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_78100/func_802FF3B8.s") #else +//fxjinjoscore_draw void func_802FF3B8(s32 arg0, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vtx **vtx) { s32 sp11C; s32 sp118; @@ -154,7 +155,7 @@ void func_802FF3B8(s32 arg0, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vtx **vtx) { gDPPipeSync((*gfx)++); for (var_s5 = spF0; var_s5 >= 0; var_s5--){ gDPPipeSync((*gfx)++); - if (spF0) { + if (var_s5) { gDPSetCombineLERP((*gfx)++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, 0x8C); } else { @@ -195,7 +196,7 @@ bool func_802FFA10(f32 arg0, s32 arg1, s32 arg2){ return (D_80381E78[arg1 - 1] < arg0); } -void func_802FFA50(enum item_e item_id, struct8s *arg1) { +void fxjinjoscore_update(enum item_e item_id, struct8s *arg1) { f32 var_f24; s32 temp_s3; s32 jinjo_id; @@ -215,7 +216,7 @@ void func_802FFA50(enum item_e item_id, struct8s *arg1) { break; case 0: - func_802FF358(item_id, arg1); + fxjinjoscore_free(item_id, arg1); break; default: diff --git a/src/core2/sla.c b/src/core2/sla.c index 876f0575..22b10c9a 100644 --- a/src/core2/sla.c +++ b/src/core2/sla.c @@ -27,7 +27,35 @@ void *array_begin(SLA *this){ return (void*)(this + 1); } -#pragma GLOBAL_ASM("asm/nonmatchings/core2/sla/func_802EDAA4.s") +void *func_802EDAA4(SLA **this, s32 *arg1) { + s32 new_cnt; + SLA *var_s0; + s16 *first_ptr; + s16 *i_ptr; + s32 prev_cnt; + s32 i; + + var_s0 = *this; + first_ptr = (s16*)var_s0->unk4; + if (*first_ptr == 0) { + prev_cnt = var_s0->elem_cnt; + new_cnt = prev_cnt + 10; + var_s0 = realloc(var_s0, (var_s0->elem_size * new_cnt) + sizeof(SLA)); + first_ptr = (s16*)var_s0->unk4; + var_s0->elem_cnt = new_cnt; + *this = var_s0; + for(i = new_cnt - 1, i_ptr = &var_s0->unk4[i * var_s0->elem_size]; i >= prev_cnt; i--){ + *i_ptr = *first_ptr; + *first_ptr = i; + i_ptr = (s32)i_ptr - var_s0->elem_size; + } + } + i = *first_ptr; + i_ptr = (s32)first_ptr + (i * var_s0->elem_size); + *arg1 = i; + *first_ptr = *i_ptr; + return (s32) i_ptr; +} #ifndef NONMATCHING #pragma GLOBAL_ASM("asm/nonmatchings/core2/sla/func_802EDC18.s")