diff --git a/README.md b/README.md index fbe2952f..04d023b2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (92.2342%) +# banjo (92.3375%) diff --git a/include/functions.h b/include/functions.h index c41bfa19..2e5c58ab 100644 --- a/include/functions.h +++ b/include/functions.h @@ -192,7 +192,7 @@ void func_802FDDC4(s32, struct8s *); struct7s *func_802FF090(enum item_e); void fxjinjoscore_update(enum item_e, struct8s *); -void func_802FF3B8(s32, struct8s *, Gfx**, Mtx**, Vtx **); +void fxjinjoscore_draw(s32, struct8s *, Gfx**, Mtx**, Vtx **); void fxjinjoscore_free(enum item_e, struct8s *); struct7s *func_802FFE4C(s32); diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 86958d6b..2045dc6a 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core2 - 90.4371% - 90.4371% + 90.6170% + 90.6170% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 01fc829c..a686c7b8 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 92.2342% - 92.2342% + 92.3375% + 92.3375% \ No newline at end of file diff --git a/src/core2/code_73640.c b/src/core2/code_73640.c index b96daa10..a766a06a 100644 --- a/src/core2/code_73640.c +++ b/src/core2/code_73640.c @@ -58,7 +58,7 @@ ItemPrint D_803692F8[0x2C] = { { 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_802FF090, fxjinjoscore_update, fxjinjoscore_draw, 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 { fxcommon1score_new, fxcommon1score_update, fxcommon1score_draw, fxcommon1score_free, 0, NULL }, //ITEM_15_HEALTH_TOTAL diff --git a/src/core2/code_78100.c b/src/core2/code_78100.c index 35ece2d9..b47da5b4 100644 --- a/src/core2/code_78100.c +++ b/src/core2/code_78100.c @@ -118,75 +118,79 @@ void fxjinjoscore_free(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; - s32 sp114; - s32 spF0; - f32 temp_f14; - f32 temp_f20; - f32 var_f28; - f32 var_f30; - BKSprite *temp_a1; - s32 var_s5; - s32 var_v0; - s32 var_v0_2; - s32 var_v1; +void fxjinjoscore_draw(s32 arg0, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vtx **vtx) { + BKSprite *sprite; // s1 + s32 draw_index; // s5 + s32 texture_width; // sp11C + s32 texture_height; // sp118 + s32 jinjo_id; // sp114 + f32 center_y; // f14 (sp110) + f32 center_x; // f20 (sp10C) + f32 x_offset; // f26 (sp108) + f32 y_offset; // f28 (sp104) + f32 pos_x; // f30 (sp100) + s32 i; // v1 (spFC) + s32 j; // v0_2 (spF8) gSPDisplayList((*gfx)++, D_8036A228); func_8024C7B8(gfx, mtx); - var_f30 = 44.0f; - for(sp114 = 0; sp114 < 5; sp114++){ - temp_a1 = D_80381E40[sp114]; - spF0 = (D_80381E58[sp114] != 0) ? 1 : 0; - if (temp_a1 != NULL) { - var_f28 = 0.0f; - func_80347FC0(gfx, temp_a1, (s32) D_80381E60[sp114], 0, 0, 0, 0, 2, 2, &sp11C, &sp118); - gDPSetTextureImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, D_80381620[(s32)D_80381E60[sp114]][sp114]); - // gDPSetTextureImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, 0); - gDPTileSync((*gfx)++); - gDPSetTile((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_4b, 0, 0x0100, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPLoadSync((*gfx)++); - gDPLoadTLUTCmd((*gfx)++, G_TX_LOADTILE, 15); - gDPPipeSync((*gfx)++); - for (var_s5 = spF0; var_s5 >= 0; var_s5--){ + pos_x = 44.0f; + // Draw all jinjo heads + for(jinjo_id = 0; jinjo_id < 5; jinjo_id++){ + s32 jinjo_collected; // spF0 <---- + sprite = D_80381E40[jinjo_id]; + jinjo_collected = (D_80381E58[jinjo_id] != 0) ? 1 : 0; + if (sprite != NULL) { + func_80347FC0(gfx, sprite, (s32) D_80381E60[jinjo_id], 0, 0, 0, 0, 2, 2, &texture_width, &texture_height); + // Load the palette for the corresponding jinjo color + gDPLoadTLUT_pal16((*gfx)++, 0, D_80381620[(s32)D_80381E60[jinjo_id]][jinjo_id]); + x_offset = 0.0f; + y_offset = 0.0f; + // Draw the jinjo head, once if uncollected and twice if collected + // If the head is drawn twice then the first draw will be the drop shadow + for (draw_index = jinjo_collected; draw_index >= 0; draw_index--){ gDPPipeSync((*gfx)++); - if (var_s5) { + // Draw 0 is the jinjo's head, anything else is a shadow + if (draw_index != 0) { + // Use only primitive color as the color input in order to make a solid color shadow gDPSetCombineLERP((*gfx)++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); + // Set up a translucent black for primitive color to draw the shadow gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, 0x8C); } else { + // Use the texture as the color input gDPSetCombineLERP((*gfx)++, 0, 0, 0, TEXEL0, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, TEXEL0, TEXEL0, 0, PRIMITIVE, 0); - gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, spF0 ? 0xFF : 0x6E); + // If the jinjo is collected then it's drawn fully opaque, otherwise it's drawn with partial alpha + gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, jinjo_collected ? 0xFF : 0x6E); } - temp_f20 = (var_f30 - ((f32) D_80276588 / 2)) - var_f28; - temp_f14 = ((((f32) D_8027658C / 2) + func_802FB0E4(arg1)) - 266.0f + 40.0f + var_f28) - D_80381E78[sp114]; + center_x = pos_x - (f32) D_80276588 / 2 + x_offset; + center_y = (f32) D_8027658C / 2 + func_802FB0E4(arg1) - 266.0f + 40.0f + y_offset - D_80381E78[jinjo_id]; gSPVertex((*gfx)++, *vtx, 4, 0); - for(var_v1 = 0; var_v1 < 2; var_v1++){ - for(var_v0_2 = 0; var_v0_2 < 2; var_v0_2++){ - (*vtx)->v.ob[0] = (s16) (s32) (((((sp11C * D_80381E54) * (f32) var_v0_2) - ((sp11C * D_80381E54) / 2)) + temp_f20) * 4); - (*vtx)->v.ob[1] = (s16) (s32) (((((sp118 * D_80381E54) / 2) - ((sp118 * D_80381E54) * var_v1)) + temp_f14) * 4); - (*vtx)->v.ob[2] = -0x14; - (*vtx)->v.tc[0] = (s16) (((sp11C - 1) * var_v0_2) << 6); - (*vtx)->v.tc[1] = (s16) (((sp118 - 1) * var_v1) << 6); + // Set up the positions of the four vertices + for(i = 0; i < 2; i++){ + for(j = 0; j < 2; j++){ + (*vtx)->v.ob[0] = ((texture_width * D_80381E54 * j) - (texture_width * D_80381E54 / 2) + center_x) * 4; + (*vtx)->v.ob[1] = ((texture_height * D_80381E54 / 2) - (texture_height * D_80381E54 * i) + center_y) * 4; + (*vtx)->v.ob[2] = -20; + (*vtx)->v.tc[0] = ((texture_width - 1) * j) << 6; + (*vtx)->v.tc[1] = ((texture_height - 1) * i) << 6; (*vtx)++; } } + // Draw a quad made of the four vertices gSP1Quadrangle((*gfx)++, 0, 1, 3, 2, 0); - var_f28 += 2.0f; + x_offset += -2; + y_offset += 2; } } - var_f30 += 32.0f; + // Move the next jinjo head over by 32 pixels + pos_x += 32.0f; } gDPPipeSync((*gfx)++); gDPSetTextureLUT((*gfx)++, G_TT_NONE); gDPPipelineMode((*gfx)++, G_PM_NPRIMITIVE); func_8024C904(gfx, mtx); } -#endif; bool func_802FFA10(f32 arg0, s32 arg1, s32 arg2){ if(arg1 == 0){ diff --git a/subyaml/core2.us.v10.yaml b/subyaml/core2.us.v10.yaml index 7df6c347..c3393800 100644 --- a/subyaml/core2.us.v10.yaml +++ b/subyaml/core2.us.v10.yaml @@ -280,7 +280,7 @@ segments: - [0x763D0, c, code_763D0] #DONE - [0x76D90, c, code_76D90] - [0x77E50, c, code_77E50] #DONE - - [0x78100, c, code_78100] + - [0x78100, c, code_78100] #DONE - [0x78E50, c, code_78E50] - [0x79830, c, fxcommon3score] #DONE - [0x79C80, c, code_79C80] #DONE