diff --git a/include/model.h b/include/model.h index 7551d08a..cce62efb 100644 --- a/include/model.h +++ b/include/model.h @@ -152,6 +152,19 @@ typedef struct{ //BKModelUnk20_0[] }BKModelUnk20List; +typedef struct{ + s16 unk0[3]; + s8 unk6; + u8 vtx_count; + s16 vtx_list[1]; +}BKModelUnk28; + +typedef struct{ + s16 count; + u8 pad2[2]; + //BKModelUnk28_0[] +}BKModelUnk28List; + typedef struct{ u8 pad0[1]; //BKModelUnk20_0[] diff --git a/progress/progress_core1.svg b/progress/progress_core1.svg index 13bb3ebd..f601619a 100644 --- a/progress/progress_core1.svg +++ b/progress/progress_core1.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core1 - 72.1884% - 72.1884% + 72.4669% + 72.4669% \ No newline at end of file diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index d6368f96..1913f6fe 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -17,7 +17,7 @@ core2 - 83.9966% - 83.9966% + 84.0320% + 84.0320% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 179ac3eb..35e2d91b 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 85.9490% - 85.9490% + 86.0097% + 86.0097% \ No newline at end of file diff --git a/src/core1/code_13990.c b/src/core1/code_13990.c index fec223f3..08e8dd7e 100644 --- a/src/core1/code_13990.c +++ b/src/core1/code_13990.c @@ -182,9 +182,30 @@ void func_80252330(f32 x, f32 y, f32 z){ #pragma GLOBAL_ASM("asm/nonmatchings/core1/code_13990/func_80252434.s") -#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_13990/func_802524F0.s") +void func_802524F0(f32 dst[3], f32 x, f32 y, f32 z) { + dst[0] = x*((f32 (*)[4])D_80282FD0)[0][0] + y*((f32 (*)[4])D_80282FD0)[1][0] + z*((f32 (*)[4])D_80282FD0)[2][0] + ((f32 (*)[4])D_80282FD0)[3][0]; + dst[1] = x*((f32 (*)[4])D_80282FD0)[0][1] + y*((f32 (*)[4])D_80282FD0)[1][1] + z*((f32 (*)[4])D_80282FD0)[2][1] + ((f32 (*)[4])D_80282FD0)[3][1]; + dst[2] = x*((f32 (*)[4])D_80282FD0)[0][2] + y*((f32 (*)[4])D_80282FD0)[1][2] + z*((f32 (*)[4])D_80282FD0)[2][2] + ((f32 (*)[4])D_80282FD0)[3][2]; +} -#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_13990/func_802525A4.s") +void mlMtx_apply_vec3s(s16 dst[3], s16 src[3]) { + f32 spC[3]; + f32 sp0[3]; + f32 (*temp_v0)[4]; + + temp_v0 = D_80282FD0; + sp0[0] = (f32) src[0]; + sp0[1] = (f32) src[1]; + sp0[2] = (f32) src[2]; + + spC[0] = sp0[0]*temp_v0[0][0] + sp0[1]*temp_v0[1][0] + sp0[2]*temp_v0[2][0] + temp_v0[3][0]; + spC[1] = sp0[0]*temp_v0[0][1] + sp0[1]*temp_v0[1][1] + sp0[2]*temp_v0[2][1] + temp_v0[3][1]; + spC[2] = sp0[0]*temp_v0[0][2] + sp0[1]*temp_v0[1][2] + sp0[2]*temp_v0[2][2] + temp_v0[3][2]; + + dst[0] = (spC[0] >= 0.0) ? spC[0] + 0.5 : spC[0] - 0.5; + dst[1] = (spC[1] >= 0.0) ? spC[1] + 0.5 : spC[1] - 0.5; + dst[2] = (spC[2] >= 0.0) ? spC[2] + 0.5 : spC[2] - 0.5; +} #pragma GLOBAL_ASM("asm/nonmatchings/core1/code_13990/func_8025276C.s") diff --git a/src/core2/code_5DBC0.c b/src/core2/code_5DBC0.c index 2ccf3c19..17b7a52a 100644 --- a/src/core2/code_5DBC0.c +++ b/src/core2/code_5DBC0.c @@ -10,12 +10,12 @@ typedef struct { }struct5DBC0_3s; typedef struct { - BKSprite *unk0; - u8 unk4; + BKSprite *font_bin; + u8 font_id; // u8 pad5[0x3]; - BKSpriteTextureBlock **unk8; - u8 unkC; - u8 unkD; + BKSpriteTextureBlock **letter_texture; + u8 unkC; // x_margin + u8 unkD; // y_margin u8 padE[0x2]; }struct5DBC0_2s; @@ -117,9 +117,10 @@ s32 func_802E4CF8(u8 arg0) { BKSpriteTextureBlock *func_802E4D5C(s32 arg0, char arg1){ - return D_8037E900->unk4[arg0].unk8[arg1 - 0x21]; + return D_8037E900->unk4[arg0].letter_texture[arg1 - 0x21]; } +/* font_bin to char texture blocks */ BKSpriteTextureBlock **func_802E4D8C(BKSprite *sprite) { BKSpriteFrame *frame; BKSpriteTextureBlock **chunkPtrArray; @@ -141,20 +142,21 @@ BKSpriteTextureBlock **func_802E4D8C(BKSprite *sprite) { return chunkPtrArray; } -s32 func_802E4E54(u8 arg0) { +/* get index from font_id */ +s32 func_802E4E54(u8 font_id) { s32 sp24; - sp24 = func_802E4CF8(arg0); - if (sp24 == -1) { + sp24 = func_802E4CF8(font_id); + if (sp24 == -1) { //font not loaded sp24 = D_8037E900->unk10++; if (D_8037E900->unk10 > 1) { D_8037E900->unk4 = (struct5DBC0_2s *)realloc(D_8037E900->unk4, (D_8037E900->unk10 + 1)*sizeof(struct5DBC0_2s)); } - D_8037E900->unk4[sp24].unk4 = arg0; - D_8037E900->unk4[sp24].unk0 = (BKSprite *)assetcache_get(arg0 + 0x6E9); - D_8037E900->unk4[sp24].unk8 = func_802E4D8C(D_8037E900->unk4[sp24].unk0); - D_8037E900->unk4[sp24].unkC = D_8037E900->unk4[sp24].unk8[0x36]->x/2; - D_8037E900->unk4[sp24].unkD = D_8037E900->unk4[sp24].unk8[0x36]->y; + D_8037E900->unk4[sp24].font_id = font_id; + D_8037E900->unk4[sp24].font_bin = (BKSprite *)assetcache_get(font_id + 0x6E9); + D_8037E900->unk4[sp24].letter_texture = func_802E4D8C(D_8037E900->unk4[sp24].font_bin); + D_8037E900->unk4[sp24].unkC = D_8037E900->unk4[sp24].letter_texture['W' - 0x21]->x/2; + D_8037E900->unk4[sp24].unkD = D_8037E900->unk4[sp24].letter_texture['W' - 0x21]->y; } func_802E6820(5); return sp24; @@ -174,7 +176,7 @@ s32 func_802E4F98(char *arg0) { return sp1C; } -void func_802E502C(s32 arg0, s32 arg1, s32 arg2, char *arg3, u8 arg4[3]) { +void func_802E502C(s32 arg0, s32 arg1, s32 arg2, char *arg3, u8 rgb[3]) { s32 sp24; sp24 = D_8037E900->unkC++; @@ -186,9 +188,9 @@ void func_802E502C(s32 arg0, s32 arg1, s32 arg2, char *arg3, u8 arg4[3]) { D_8037E900->unk0[sp24].unkE = arg2; D_8037E900->unk0[sp24].unkC = func_802E4F98(arg3); D_8037E900->unk0[sp24].unk8 = D_8037E900->flags; - D_8037E900->unk0[sp24].unkF[0] = arg4[0]; - D_8037E900->unk0[sp24].unkF[1] = arg4[1]; - D_8037E900->unk0[sp24].unkF[2] = arg4[2]; + D_8037E900->unk0[sp24].unkF[0] = rgb[0]; + D_8037E900->unk0[sp24].unkF[1] = rgb[1]; + D_8037E900->unk0[sp24].unkF[2] = rgb[2]; D_8037E900->unk0[sp24].unk18 = -1; } @@ -561,4 +563,32 @@ void func_802E6820(s32 arg0) { #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5DBC0/func_802E6A90.s") -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5DBC0/func_802E6BD0.s") +void func_802E6BD0(BKModelUnk28List *arg0, BKVertexList *arg1, struct58s *arg2) { + Vtx *vtx_list; + Vtx *i_vtx; + s32 i; + BKModelUnk28 *var_s1; + s16 sp50[3]; + s32 temp_v0; + s32 var_s3; + s32 var_s4; + + vtx_list = vtxList_getVertices(arg1); + var_s1 = (BKModelUnk28 *)(arg0 + 1); + var_s3 = -2; + for(var_s4 = 0; var_s4 < arg0->count; var_s4++){ + if (var_s3 != var_s1->unk6) { + var_s3 = var_s1->unk6; + func_80251BCC(func_802EA110(arg2, var_s3)); + } + mlMtx_apply_vec3s(sp50, var_s1->unk0); + for(i = 0; i < var_s1->vtx_count; i++){ + i_vtx = &vtx_list[var_s1->vtx_list[i]]; + i_vtx->v.ob[0] = sp50[0]; + i_vtx->v.ob[1] = sp50[1]; + i_vtx->v.ob[2] = sp50[2]; + } + var_s1 = (s16*)(var_s1 + 1) + (var_s1->vtx_count - 1); + } + osWritebackDCache(vtx_list, vtxList_getVtxCount(arg1) * sizeof(Vtx)); +} diff --git a/src/core2/code_654C0.c b/src/core2/code_654C0.c index 8a765a29..169e4792 100644 --- a/src/core2/code_654C0.c +++ b/src/core2/code_654C0.c @@ -138,7 +138,7 @@ void func_802EC8FC(BKVertexList *this, Vtx **vtx, Vtx **vtx_end){ } //vtxList_getVtxCount -s32 func_802EC918(BKVertexList *this){ +s32 vtxList_getVtxCount(BKVertexList *this){ return this->cnt_14; } diff --git a/symbol_addrs.core1.us.v10.txt b/symbol_addrs.core1.us.v10.txt index 5e8cb19e..3d239d79 100644 --- a/symbol_addrs.core1.us.v10.txt +++ b/symbol_addrs.core1.us.v10.txt @@ -27,16 +27,17 @@ spriteGetFramePtr = 0x802510C8; get_loaded_overlay_id = 0x80251230; is_overlay_loaded = 0x8025123C; load_overlay = 0x80251250; -mlMtxApply = 0x80251494; -mlMtxPop = 0x802516C8; -mlMtxIdent = 0x80251B0C; -mlMtxRotate = 0x80252188; -mlMtxRotPitch = 0x80251C78; -mlMtxRotYaw = 0x80251D84; -mlMtxRotRoll = 0x80251E80; -mlMtxScale_xyz = 0x802521C0; -mlMtxScale = 0x80252280; -mlMtxTranslate = 0x80252980; +mlMtxApply = 0x80251494; +mlMtxPop = 0x802516C8; +mlMtxIdent = 0x80251B0C; +mlMtxRotPitch = 0x80251C78; +mlMtxRotYaw = 0x80251D84; +mlMtxRotRoll = 0x80251E80; +mlMtxRotate = 0x80252188; +mlMtxScale_xyz = 0x802521C0; +mlMtxScale = 0x80252280; +mlMtx_apply_vec3s = 0x802525A4; +mlMtxTranslate = 0x80252980; memcpy = 0x80254608; _heap_defragEmptyBlock = 0x8025449C;