From d89b777c9eb65e7ab0c40b21ea76911c3df5f7a8 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sat, 10 Dec 2022 14:10:22 -0600 Subject: [PATCH] core2/code_C0E60.c done --- README.md | 2 +- decompressed.us.v10.yaml | 2 +- progress/progress_core2.svg | 6 +-- progress/progress_total.svg | 6 +-- src/core2/code_C0E60.c | 76 ++++++++++++++++++------------------- 5 files changed, 45 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 9ca4874e..34433d1f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (95.3650%) +# banjo (95.7970%) diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index f84a2aad..adbac4ef 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -828,7 +828,7 @@ segments: - [0x1014880, c, code_BEF20] - [0x10164E0, c, code_C0B80] #DONE - [0x1016650, c, code_C0CF0] #DONE - - [0x10167C0, c, code_C0E60] + - [0x10167C0, c, code_C0E60] #DONE - [0x1018580, c, code_C2C20] #DONE - [0x1018890, c, code_C2F30] #DONE - [0x1018B00, c, code_C31A0] #DONE diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 4060ed52..9567af62 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core2 - 93.7877% - 93.7877% + 94.5406% + 94.5406% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 72340c16..77cd9f35 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 95.3650% - 95.3650% + 95.7970% + 95.7970% \ No newline at end of file diff --git a/src/core2/code_C0E60.c b/src/core2/code_C0E60.c index 61675943..4317a7a5 100644 --- a/src/core2/code_C0E60.c +++ b/src/core2/code_C0E60.c @@ -22,8 +22,8 @@ void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, tmem, rtile, pal, cmt, \ maskt, shiftt, cms, masks, shifts); \ gDPSetTileSize(pkt, rtile, \ - (uls)<w; - *argC = (s32) temp_v0->h; + sprite_frame = spriteGetFramePtr(sprite, frame); + *argB = (s32) sprite_frame->w; + *argC = (s32) sprite_frame->h; if (*argF == -1) { - *argF = (s32) temp_v0->chunkCnt; + *argF = (s32) sprite_frame->chunkCnt; } (*argF)--; - chunk_count = *argF; + chunk_count = (*argF); if (sprite->type & SPRITE_TYPE_CI4) { - for(palette_addr = (s32)(temp_v0 + 1); palette_addr % 8; palette_addr++); + for(palette_addr = (s32)(sprite_frame + 1); palette_addr % 8; palette_addr++); gDPSetTextureLUT((*gfx)++, G_TT_RGBA16); gDPLoadTLUT_pal16((*gfx)++, 0, palette_addr); - D_803860B0 = TRUE; + spriteRenderHasPalette = TRUE; D_803860B4 = 0; - D_80386074 = NULL; - D_8038607C = 0; - D_80386098 = 0; + D_80386074 = 0; + var_v1 = palette_addr + 0x20; + D_80386098 = D_8038607C = 0; } else if (sprite->type & SPRITE_TYPE_CI8) { gDPPipelineMode((*gfx)++, G_PM_1PRIMITIVE); - for(palette_addr = (s32)(temp_v0 + 1); palette_addr % 8; palette_addr++); - D_803860B0 = TRUE; - D_803860B4 = 1; + for(palette_addr = (s32)(sprite_frame + 1); palette_addr % 8; palette_addr++); + D_803860B4 = spriteRenderHasPalette = TRUE; + // D_803860B4 = 1; D_80386074 = NULL; D_8038607C = 0; var_v1 = palette_addr + 0x200; @@ -173,24 +169,24 @@ void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, gDPSetTextureLUT((*gfx)++, G_TT_RGBA16); gDPLoadTLUT_pal256((*gfx)++, palette_addr); } else { - D_803860B0 = FALSE; - var_v1 = temp_v0 + 0x14; + var_v1 = (BKSpriteTextureBlock *)(sprite_frame + 1); + spriteRenderHasPalette = FALSE; } if ((D_8038607C == 0) || (tmem == D_80386078)) { D_80386078 = tmem; - D_80386070 = temp_v0; + D_80386070 = sprite_frame; D_80386080 = arg5; D_80386084 = arg6; - sp144 = 0; D_80386088 = rtile; + sp144 = 0; } else { D_80386094 = tmem; - D_80386074 = temp_v0; + D_80386074 = sprite_frame; D_8038609C = arg5; D_803860A0 = arg6; - sp144 = 1; D_803860A4 = rtile; + sp144 = 1; } *width = (s32) var_v1->w; @@ -217,8 +213,9 @@ void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, } else { masks = 0; } - - var_v0 = *height - 1; + + maskt = *height - 1; + var_v0 = maskt; if ((*height & 7) == 0) { maskt = 0; while (var_v0 != 0) { @@ -272,25 +269,26 @@ void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, D_80386098 = (s32) D_80386098 >> 1; } } else if (sprite->type & SPRITE_TYPE_CI4) { - rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_CI, G_IM_SIZ_4b, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + rare_gDPLoadMultiBlock_4b((*gfx)++, timg, tmem, rtile, G_IM_FMT_RGBA, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); D_8038607C = D_8038607C >> 4; } else if (sprite->type & SPRITE_TYPE_CI8) { rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_CI, G_IM_SIZ_8b, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); D_8038607C = (s32) D_8038607C >> 3; } - - if ((D_8038607C != 0) && (D_80386098 != 0) && (D_80386094 < (D_80386078 + D_8038607C))) { + if( D_8038607C != 0 + && D_80386098 != 0 + && (D_80386094 < (D_80386078 + D_8038607C)) + ) { D_80386074 = NULL; D_80386098 = 0; } } -#endif void func_80349AD0(void){ D_80386074 = D_80386070 = 0; D_80386098 = D_8038607C = 0; D_80386094 = D_80386078 = -1; - D_803860B0 = 0; + spriteRenderHasPalette = FALSE; } void func_80349B1C(Gfx **gfx) { @@ -298,10 +296,10 @@ void func_80349B1C(Gfx **gfx) { void *temp_v1_2; void *temp_v1_3; - if (D_803860B0) { + if (spriteRenderHasPalette) { gDPPipeSync((*gfx)++); gDPSetTextureLUT((*gfx)++, G_TT_NONE); - D_803860B0 = FALSE; + spriteRenderHasPalette = FALSE; if (D_803860B4) { gDPPipelineMode((*gfx)++, G_PM_NPRIMITIVE); D_803860B4 = FALSE;