diff --git a/include/functions.h b/include/functions.h index 457f911b..45173b15 100644 --- a/include/functions.h +++ b/include/functions.h @@ -185,13 +185,13 @@ void func_802FE844(s32, struct8s *); void func_802FDEE0(s32, struct8s *, Gfx**, Mtx**, s32*); void func_802FDDC4(s32, struct8s *); -struct8s *func_802FF090(s32); -void func_802FFA50(s32, struct8s *); -void func_802FF3B8(s32, struct8s *, Gfx**, Mtx**, s32); -void func_802FF358(s32, struct8s *); +struct8s *func_802FF090(enum item_e); +void func_802FFA50(enum item_e, struct8s *); +void func_802FF3B8(s32, struct8s *, Gfx**, Mtx**, Vtx **); +void func_802FF358(enum item_e, struct8s *); struct8s *func_802FFE4C(s32); -void func_803005BC(s32, struct8s *); +void func_803005BC(enum item_e, struct8s *); void func_802FFF34(enum item_e, struct8s *, Gfx**, Mtx**, Vtx **); void func_802FFED4(s32, struct8s *); diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 83c73183..91f59d2f 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core2 - 76.0480% - 76.0480% + 76.4903% + 76.4903% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index a6a60f54..fdff81c5 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 81.0493% - 81.0493% + 81.3031% + 81.3031% \ No newline at end of file diff --git a/src/core2/ch/gameSelect.c b/src/core2/ch/gameSelect.c index 4cc84d6f..62f894ac 100644 --- a/src/core2/ch/gameSelect.c +++ b/src/core2/ch/gameSelect.c @@ -169,7 +169,7 @@ void func_802C4768(s32 gamenum){ func_8031FBA0(); if(func_8033D1BC(gamenum)){ func_8033D13C(gamenum); - D_8037DCCE[gamenum] = (func_8034717C(6)) ? 1 : 0; + D_8037DCCE[gamenum] = (itemscore_timeScores_get(LEVEL_6_LAIR)) ? 1 : 0; strcpy(D_8037DD48, ""); strcat(D_8037DD48, "GAME "); @@ -185,7 +185,7 @@ void func_802C4768(s32 gamenum){ break; }//L802C4858 strcat(D_8037DD48, ": TIME "); - strcat(D_8037DD48, func_80311C64(func_803470A0())); + strcat(D_8037DD48, func_80311C64(itemscore_timeScores_getTotal())); strcat(D_8037DD48, ","); strcat(D_8037DD48, ""); @@ -196,9 +196,9 @@ void func_802C4768(s32 gamenum){ strcat(D_8037DD68, "S"); } strcat(D_8037DD68, ", "); - strIToA(D_8037DD68, notescore_getTotal()); + strIToA(D_8037DD68, itemscore_noteScores_getTotal()); strcat(D_8037DD68, " NOTE"); - if(notescore_getTotal() != 1){ + if(itemscore_noteScores_getTotal() != 1){ strcat(D_8037DD68, "S"); } strcat(D_8037DD68, "."); diff --git a/src/core2/code_4C020.c b/src/core2/code_4C020.c index 111db327..0e92ea5e 100644 --- a/src/core2/code_4C020.c +++ b/src/core2/code_4C020.c @@ -635,7 +635,7 @@ void func_802D5058(enum map_e map_id, s32 arg1, bool arg2) { void func_802D5140(ActorMarker *caller, enum asset_e text_id, s32 arg2){ - notescore_getLevelScore(func_80320424(0x19, 4)); + itemscore_noteScores_get(func_80320424(0x19, 4)); } void func_802D5178(s32 arg0, enum bkprog_e arg1, s32 arg2, enum map_e arg3, s32 arg4, s32 arg5, enum actor_e arg6, s32 arg7){ diff --git a/src/core2/code_763D0.c b/src/core2/code_763D0.c index 000a6a7d..a6b9120a 100644 --- a/src/core2/code_763D0.c +++ b/src/core2/code_763D0.c @@ -278,7 +278,7 @@ void func_802FDAF4(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vt sp34 = 0.0f; if(item_id == ITEM_C_NOTE){ if(level_get() == LEVEL_6_LAIR || level_get() == LEVEL_C_BOSS){ - sp38 = notescore_getTotal(); + sp38 = itemscore_noteScores_getTotal(); } } if(item_id < 6){ diff --git a/src/core2/code_78100.c b/src/core2/code_78100.c index 9e363858..13eb8bc7 100644 --- a/src/core2/code_78100.c +++ b/src/core2/code_78100.c @@ -2,13 +2,276 @@ #include "functions.h" #include "variables.h" +extern f32 func_802FB0E4(struct8s *); +/* .data */ +extern u16 D_8036A070[0xD][0x10]; +extern enum asset_e D_8036A210[5]; +extern Gfx D_8036A228[]; + +/* .bss */ +extern u16 D_80381620[0xD][5][0x10]; +extern BKSprite *D_80381E40[5]; +extern f32 D_80381E54; +extern u8 D_80381E58[5]; +extern f32 D_80381E60[5]; +extern f32 D_80381E78[5]; +extern struct8s D_80381E90; + + +/* .code */ +#ifndef nonmatching #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_78100/func_802FF090.s") +#else +struct8s *func_802FF090(s32 arg0) { + f32 *var_s6; + f64 temp_f20; + f64 temp_f22; + f64 temp_f28; + s32 temp_t6; + s32 temp_t8; + s32 green; + s32 blue; + s32 red; + s32 alpha; + s32 tmp_blue; + s32 tmp_green; + s32 tmp_red; + s32 tmp_alpha; + s32 var_t2; + s8 *var_s5; + u16 *var_ra; + u16 *var_t3; + u16 rgba; + u32 jinjo_id; + void *var_s3; + void *var_t4; + s32 i; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_78100/func_802FF358.s") + D_80381E54 = 1.0f; + for(jinjo_id = 0; jinjo_id < 5; jinjo_id++){ + D_80381E60[jinjo_id] = 0.0f; + D_80381E58[jinjo_id] = (item_getCount(ITEM_12_JINJOS) & (1 << jinjo_id)) ? 3 : 0; + for(i = 0; i < 0xD; i++){ + for(var_t2 = 0; var_t2 < 0x10; var_t2++){ + rgba = D_8036A070[i][var_t2]; + red = tmp_red = (rgba >> 0xB) & 0x1F; + green = tmp_green = (rgba >> 6) & 0x1F; + blue = tmp_blue = (rgba >> 1) & 0x1F; + alpha = tmp_alpha = (rgba >> 0) & 0x1; + if ((red < 0x10) || (green < 0x10) || (blue < 0x10)) { + switch (jinjo_id) { + case 3: + red = tmp_red; + green = tmp_green; + blue = tmp_blue; + alpha = tmp_alpha; + break; + + case 0: + green = tmp_green * 1.5; + red = tmp_red * 0.25; + blue = tmp_blue; + alpha = tmp_alpha; + break; + case 1: + red = tmp_red * 0.2; + green = tmp_blue; + blue = tmp_blue * 0.2; + alpha = tmp_alpha; + break; + + case 2: + {s32 var_v1; + red = tmp_red; + blue = tmp_green * 0.4; + green = tmp_blue * 0.6; + alpha = tmp_alpha; + } + break; + case 4: + red = tmp_red; + green = tmp_blue; + blue = tmp_green * 0.4; + alpha = tmp_alpha; + break; + } + } + D_80381620[i][jinjo_id][var_t2] = ((red << 0xB) | (green << 6) | (blue << 1) | alpha); + } + } + } + return &D_80381E90; +} +#endif + +void func_802FF358(enum item_e item_id, struct8s * arg1){ + s32 i; + + for(i = 0; i < 5; i++){ + if(D_80381E40[i] != NULL){ + func_8033BD4C(D_80381E40[i]); + D_80381E40[i] = NULL; + } + } + +} + +#ifndef NONMATCHING #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_78100/func_802FF3B8.s") +#else +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; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_78100/func_802FFA10.s") + 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--){ + gDPPipeSync((*gfx)++); + if (spF0) { + 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 { + 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); + } + 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]; + 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); + (*vtx)++; + } + } + gSP1Quadrangle((*gfx)++, 0, 1, 3, 2, 0); + var_f28 += 2.0f; + } + } + var_f30 += 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){ + return TRUE; + } + + return (D_80381E78[arg1 - 1] < arg0); +} + +void func_802FFA50(enum item_e item_id, struct8s *arg1) { + f32 var_f24; + s32 temp_s3; + s32 jinjo_id; + s32 sp78; + + var_f24 = time_getDelta(); + temp_s3 = func_802FB0D4(arg1); + sp78 = item_getCount(item_id); + switch(temp_s3){ + case 1: + for(jinjo_id = 0; jinjo_id < 5; jinjo_id++){ + if (D_80381E40[jinjo_id] == NULL) { + D_80381E40[jinjo_id] = assetcache_get(D_8036A210[jinjo_id]); + D_80381E78[jinjo_id] = 64.0f; + } + } + break; + + case 0: + func_802FF358(item_id, arg1); + break; + + default: + break; + } + + if (temp_s3 != 0) { + for(jinjo_id = 0; jinjo_id < 5; jinjo_id++){ + switch (D_80381E58[jinjo_id]) { + case 0: + if (((1 << jinjo_id) & sp78) && (temp_s3 == 2) && (D_80381E78[jinjo_id] < 1.0f)) { + D_80381E58[jinjo_id] = 2; + func_8030E560(SFX_3EE, 26000); + } + break; + case 2: + D_80381E60[jinjo_id] += var_f24 * 15.0; + if ((s32) D_80381E60[jinjo_id] >= 9) { + D_80381E60[jinjo_id] = 9.0f; + D_80381E58[jinjo_id] = 3; + } + break; + case 1: + if (0.95 < randf2(0.0f, 1.0f)) { + D_80381E58[jinjo_id] = 4; + } + break; + case 4: + D_80381E60[jinjo_id] += var_f24 * 30.0; + if ((s32) D_80381E60[jinjo_id] >= 12) { + D_80381E58[jinjo_id] = 3; + D_80381E60[jinjo_id] = 12.0f; + } + break; + case 3: + D_80381E60[jinjo_id] -= var_f24 * 30.0; + if ((s32) D_80381E60[jinjo_id] < 10) { + D_80381E60[jinjo_id] = 9.0f; + D_80381E58[jinjo_id] = 1; + } + break; + } + + switch (temp_s3) { /* switch 1; irregular */ + case 3: /* switch 1 */ + break; + case 1: /* switch 1 */ + case 2: /* switch 1 */ + if (func_802FFA10(15.0f, jinjo_id, 5)) { + if (D_80381E78[jinjo_id] >= 1.0f) { + D_80381E78[jinjo_id] *= 0.6; + } + } + break; + } + } + } +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_78100/func_802FFA50.s") diff --git a/src/core2/code_78E50.c b/src/core2/code_78E50.c index 7931b063..d7f14318 100644 --- a/src/core2/code_78E50.c +++ b/src/core2/code_78E50.c @@ -134,9 +134,9 @@ void func_802FFED4(s32 item_id, struct8s *arg1){ // } // //var_a1_2 = n // // temp_a0->words.w0 = ((((var_a1_2 * 0x10) - 1) | (var_v0 << 0xA)) & 0xFFFF) | 0x04000000; -// var_fp = 4; // // temp_a0->words.w1 = *vtx; // gSPVertex((*gfx)++, *vtx, var_a1_2, var_v0); +// var_fp = 4; // } else { // var_s4 = temp_v0_5 * 2; // var_s6 = var_s4 + 2; @@ -167,12 +167,7 @@ void func_802FFED4(s32 item_id, struct8s *arg1){ // (*vtx)->v.tc[1] = (s16) (((spEC - 1) * var_v1) << 6); // (*vtx)++; // } -// temp_v0_6 = *gfx; -// temp_t6 = (var_s4 & 0xFF) << 0x10; -// temp_a1 = var_s7 & 0xFF; -// *gfx = temp_v0_6 + 8; -// temp_v0_6->words.w1 = temp_t6 | (temp_a1 << 8) | (var_fp & 0xFF); -// temp_v0_6->words.w0 = temp_t6 | ((var_s6 & 0xFF) << 8) | temp_a1 | 0xB1000000; + // gSP2Triangles((*gfx)++, var_s4/2, var_fp/2, var_s7/2, 0, var_s4/2, var_s7/2, var_fp/2, 0); // } while (sp10C != 0); // gDPPipeSync((*gfx)++); // gDPSetTextureLUT((*gfx)++, G_TT_NONE); @@ -181,7 +176,7 @@ void func_802FFED4(s32 item_id, struct8s *arg1){ // } // } -void func_803005BC(s32 item_id, struct8s *arg1) { +void func_803005BC(enum item_e item_id, struct8s *arg1) { s32 var_v0; s32 sp20; s32 sp1C; diff --git a/src/core2/code_B5040.c b/src/core2/code_B5040.c index b9be7d9f..fa9cc65e 100644 --- a/src/core2/code_B5040.c +++ b/src/core2/code_B5040.c @@ -72,7 +72,7 @@ void func_8033C070(void){ //savedata_init mumboscore_get_size_and_ptr(&sp4C, &sp2C); func_8032008C(&sp40, &sp28); func_80346F44(&sp48, &sp24); - func_8034722C(&sp44, &sp20); + itemscore_timeScores_getSizeAndPtr(&sp44, &sp20); func_80347630(&sp3C, &sp1C); func_8029587C(&sp38, &sp18); D_80383CF0 = 0; @@ -123,7 +123,7 @@ void __savedata_load_mumboScore(u8 *savedata){ func_80347984(); } -void func_8033C348(u8 *savedata){ +void __savedata_load_highNoteScores(u8 *savedata){ s32 sp2C; u8 *sp28; int i; @@ -132,19 +132,19 @@ void func_8033C348(u8 *savedata){ for(i = D_80383D00; i < D_80383D00 + sp2C; i++){ sp28[i - D_80383D00] = savedata[i]; } - func_803476B0(sp28); + itemscore_highNoteScores_fromSaveData(sp28); } -void func_8033C3D4(u8 *savedata){ +void __savedata_load_timeScores(u8 *savedata){ s32 sp2C; u8 *sp28; int i; - func_8034722C(&sp2C, &sp28); + itemscore_timeScores_getSizeAndPtr(&sp2C, &sp28); for(i = D_80383D04; i < D_80383D04 + sp2C; i++){ sp28[i - D_80383D04] = savedata[i]; } - func_8034774C(sp28); + itemscore_timeScores_fromSaveData(sp28); } void func_8033C460(u8 *savedata){ //global_progress @@ -218,7 +218,7 @@ void __savedata_save_mumboScore(u8 *savedata){ } } -void func_8033C798(u8 *savedata){ +void __savedata_save_highNoteScores(u8 *savedata){ s32 sp2C; u8 *sp28; int i; @@ -229,12 +229,12 @@ void func_8033C798(u8 *savedata){ } } -void func_8033C81C(u8 *savedata){ +void __savedata_save_timeScores(u8 *savedata){ s32 sp2C; u8 *sp28; int i; - func_8034722C(&sp2C, &sp28); + itemscore_timeScores_getSizeAndPtr(&sp2C, &sp28); for(i = D_80383D04; i < D_80383D04 + sp2C; i++){ savedata[i] = sp28[i - D_80383D04]; } @@ -313,8 +313,8 @@ void saveData_load(SaveData *savedata){ __savedata_load_jiggyScore(savedata); __savedata_load_honeycombScore(savedata); __savedata_load_mumboScore(savedata); - func_8033C348(savedata); - func_8033C3D4(savedata); + __savedata_load_highNoteScores(savedata); + __savedata_load_timeScores(savedata); func_8033C4E4(savedata); func_8033C570(savedata); for(i = 0; D_80370A20[i].unk0 != -1; i++){ @@ -332,8 +332,8 @@ void saveData_create(SaveData *savedata){ __savedata_save_jiggyScore(savedata); __savedata_save_honeycombScore(savedata); __savedata_save_mumboScore(savedata); - func_8033C798(savedata); - func_8033C81C(savedata); + __savedata_save_highNoteScores(savedata); + __savedata_save_timeScores(savedata); func_8033C8A0(savedata); func_8033C924(savedata); func_8033C9A8(savedata); diff --git a/src/core2/code_BEF20.c b/src/core2/code_BEF20.c index 4ea68f75..2534689c 100644 --- a/src/core2/code_BEF20.c +++ b/src/core2/code_BEF20.c @@ -2,21 +2,26 @@ #include "functions.h" #include "variables.h" + f32 time_getDelta(void); void func_80346DB4(s32); -s32 func_803463D4(enum item_e item, s32 diff); -s32 notescore_getLevelScore(enum level_e lvl_id); -void func_80347060(void); +s32 func_803463D4(enum item_e item, s32 diff); +void itemscore_noteScores_clear(void); +s32 itemscore_noteScores_get(enum level_e lvl_id); +void itemscore_timeScores_clear(void); -extern s32 D_80385F30[]; +s32 D_80385F30[0x2C]; extern s32 D_80385FE0; extern s32 D_80385FE4; extern s32 D_80385FE8; extern f32 D_80385FEC; -extern u8 D_80385FF0[]; -extern f32 D_80386000[]; +u8 D_80385FF0[0xB]; +f32 D_80386000[0xE]; //timescores extern s32 D_80386038; +extern u64 D_80386040; +extern u16 D_80386048[]; //timescores_truncated +extern u8 D_80386060[]; //saved item array extern s32 D_80386068; void func_80345EB0(enum item_e item){ @@ -46,11 +51,7 @@ s32 item_getCount(enum item_e item){ #ifdef NONMATCHING -/* &D_80385F30[item] saving to sp18 but should be sp1C, -cannot access sp1C with newVal at sp18. -may be -O3 issue given func_803465DC() is null -*/ -s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){ +s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){\ s32 oldVal; s32 sp40; s32 sp3C; @@ -72,8 +73,10 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){ || (item == ITEM_16_LIFE && func_803203FC(UNKFLAGS1_73_SANDCASTLE_INFINITE_LIVES)) || (item == ITEM_F_RED_FEATHER && func_803203FC(UNKFLAGS1_75_SANDCASTLE_INFINITE_RED_FEATHERS)) || (item == ITEM_10_GOLD_FEATHER && func_803203FC(UNKFLAGS1_76_SANDCASTLE_INFINITE_GOLD_FEATHERS)) - || (item == ITEM_17_AIR && func_803203FC(UNKFLAGS1_96_SANDCASTLE_INFINITE_AIR))) + || (item == ITEM_17_AIR && func_803203FC(UNKFLAGS1_96_SANDCASTLE_INFINITE_AIR)) + ){ diff = 0; + } } newVal = MAX(0, D_80385F30[item] + diff); D_80385F30[item] = newVal; @@ -137,7 +140,7 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){ } break; case ITEM_C_NOTE: - sp28 = notescore_getLevelScore(level_get()); + sp28 = itemscore_noteScores_get(level_get()); func_80346DB4(D_80385F30[item]); if(D_80385F30[item] == 100 && sp28 != 100){ func_8025A6EC(COMUSIC_36_100TH_NOTE_COLLECTED, 20000); @@ -145,7 +148,7 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){ } break; case ITEM_26_JIGGY_TOTAL: - D_80385F30[0x2b] += diff; + D_80385F30[ITEM_2B_UNKNOWN] += diff; break; } return D_80385F30[item]; @@ -184,8 +187,8 @@ void func_8034646C(void){ D_80385F30[ITEM_1C_MUMBO_TOKEN] = 0; D_80385F30[0x2B] = 0; D_80385F30[ITEM_26_JIGGY_TOTAL] = 0; - func_80346D78(); - func_80347060(); + itemscore_noteScores_clear(); + itemscore_timeScores_clear(); D_80385FE4 = FALSE; } @@ -341,9 +344,18 @@ void func_80346C10(enum bs_e *retVal, enum bs_e fail_state, enum bs_e success_st } } -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_80346CA8.s") +void func_80346CA8(void) { + D_80385FE0 = 0; + if (D_80385FE4) { + D_80385FE0 = TRUE; + D_80385F30[ITEM_14_HEALTH] = D_80385F30[ITEM_15_HEALTH_TOTAL]; + D_80385F30[ITEM_17_AIR] = 60*60; + } +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_80346CE8.s") +void func_80346CE8(void){ + D_80385FE4 = FALSE; +} enum item_e func_80346CF4(enum actor_e actor_id){ switch(actor_id){ @@ -358,11 +370,43 @@ enum item_e func_80346CF4(enum actor_e actor_id){ return 0; } -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_80346D78.s") +void itemscore_noteScores_clear(void) { + s32 i; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_80346DB4.s") + for(i = 0; i < 0xe; i++){ + D_80385FF0[i] = 0; + } +} -s32 notescore_getTotal(void){ +//itemscore_noteScores_update +void func_80346DB4(s32 note_count) { + s32 level_id; + + level_id = level_get(); + if (!func_802E4A08() && (level_id > 0) && (level_id < 0xE)) { + if (D_80385FF0[level_id] < note_count) { + D_80385FF0[level_id] = note_count; + if ((level_get() == LEVEL_1_MUMBOS_MOUNTAIN) && (note_count == 50)) { + func_80311480(0xF74, 4, NULL, NULL, NULL, NULL); + } + if (note_count == 100) { + func_80311480(0xF78, 4, NULL, NULL, NULL, NULL); + } + if (note_count == 1) { + levelSpecificFlags_set(0x34, TRUE); + } + if (!levelSpecificFlags_get(0x34) && (func_80311480(0xF76, 0, NULL, NULL, NULL, NULL))) { + levelSpecificFlags_set(0x34, TRUE); + } + if (func_803203FC(0x17) == 0) { + func_803204E4(0x17, 1); + func_80320524(0x19, level_id, 4); + } + } + } +} + +s32 itemscore_noteScores_getTotal(void){ int i = 1; s32 total = 0; do{ @@ -371,23 +415,68 @@ s32 notescore_getTotal(void){ return total; } -s32 notescore_getLevelScore(enum level_e lvl_id){ +s32 itemscore_noteScores_get(enum level_e lvl_id){ return D_80385FF0[lvl_id]; } +#ifndef NONMATCHING #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_80346F44.s") +#else +void func_80346F44(s32 *size, void **ptr) { + s32 var_s0; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_80347018.s") + *size = sizeof(u64); + *ptr = (void *)&D_80386040; + D_80386040 = 0; + for(var_s0 = 1; var_s0 < 0xB; var_s0++){ + if(var_s0 != 6){ + D_80386040 <<= 7; + D_80386040 |= D_80385FF0[var_s0]; + } + } +} +#endif -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_80347060.s") +void itemscore_noteScoress_maxAll(void) { + s32 i; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_803470A0.s") + for(i = 1; i < 11; i++){ + D_80385FF0[i] = 100; + } +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_8034717C.s") +void itemscore_timeScores_clear(void) { + s32 i; + for(i = 0; i < 0xE; i++){ + D_80386000[i] = 0.0f; + } +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_8034722C.s") +s32 itemscore_timeScores_getTotal(void) { + s32 total; + s32 i; -extern u8 D_80386060[]; //saved item array + total = 0; + for(i = 0; i < 0xE; i++){ + total += D_80386000[i]; + } + return total; +} + +u16 itemscore_timeScores_get(enum level_e level_id) { + return (u16) D_80386000[level_id]; +} + +void itemscore_timeScores_getSizeAndPtr(s32 *size, void **ptr) { + s32 i; + + *size = 0xB*sizeof(s16); + for(i = 0; i < 0xB; i++){ + D_80386048[i] = (u16) D_80386000[i + 1]; + + } + *ptr = (void *)&D_80386048; +} //itemscore_getSavedItemArray void func_80347630(s32 *size, u8 **buffer){ @@ -400,11 +489,56 @@ void func_80347630(s32 *size, u8 **buffer){ *buffer = D_80386060; } -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_803476B0.s") +void itemscore_highNoteScores_fromSaveData(u8 *savedata) { + u64 sp28; + s32 temp_ret; + s32 i; + enum level_e level_id; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_8034774C.s") + sp28 = *(u64*)savedata; + level_id = 10; + for( i = 0; i != 9; i++){ + D_80385FF0[level_id] = sp28 & 0x7F; + level_id--; + sp28 >>= 7; + + if (level_id == LEVEL_6_LAIR) { + level_id--; + } + + } +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_8034789C.s") +void itemscore_timeScores_fromSaveData(u16 *savedata) { + s32 i; + + itemscore_timeScores_clear(); + for(i = 0; i < 0xB; i++){ + D_80386000[i + 1] = savedata[i]; + } +} + +void func_8034789C(void) { + s32 sp1C; + s32 temp_v0; + + sp1C = honeycombscore_get_total(); + D_80385F30[ITEM_13_EMPTY_HONEYCOMB] = sp1C % 6; + if (func_8031FF1C(BKPROG_B9_DOUBLE_HEALTH)) { + D_80385F30[ITEM_15_HEALTH_TOTAL] = 16; + } else { + D_80385F30[ITEM_15_HEALTH_TOTAL] = 5 + MIN(3, (sp1C / 6)); + } + if (func_803203FC(0x94)) { + temp_v0 = D_80385F30[ITEM_15_HEALTH_TOTAL]; + if (temp_v0 >= 9) { + D_80385F30[ITEM_15_HEALTH_TOTAL] = temp_v0; + } + else{ + D_80385F30[ITEM_15_HEALTH_TOTAL] = 8; + } + } +} void func_80347958(void){ func_8034789C(); diff --git a/src/core2/code_D2180.c b/src/core2/code_D2180.c index c58e414f..5c7c52a9 100644 --- a/src/core2/code_D2180.c +++ b/src/core2/code_D2180.c @@ -102,14 +102,11 @@ void func_803591E8(Actor *this, s32 next_state){ this->state = next_state; } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_D2180/func_8035933C.s") -#else void func_8035933C(Actor *this){ ActorLocal_core2_D2180 * local = (ActorLocal_core2_D2180 *) &this->local; if(!this->unk16C_4){ this->unk16C_4 = TRUE; - local->unk0 = &D_80372940[(this->modelCacheIndex - 0x2AE)]; + local->unk0 = D_80372940 + (this->modelCacheIndex - 0x2AE); func_803591E8(this, 1); } if(this->state == 1){ @@ -123,7 +120,6 @@ void func_8035933C(Actor *this){ } } } -#endif void func_80359424(Actor *this){ if(func_803292E0(this)) diff --git a/src/core2/gc/pauseMenu.c b/src/core2/gc/pauseMenu.c index 9de05e22..3fdf229f 100644 --- a/src/core2/gc/pauseMenu.c +++ b/src/core2/gc/pauseMenu.c @@ -216,7 +216,7 @@ void func_80311B44(void){ } void func_80311B9C(s32 level, s32 *valPtr, s32 *maxPtr){ - *valPtr = notescore_getLevelScore(level); //get note highscore + *valPtr = itemscore_noteScores_get(level); //get note highscore *maxPtr = 100; } @@ -286,14 +286,14 @@ void func_80311D74(s32 level){ //gametime_2_sting strcpy(D_8036C520[3].str, empty); - strcat(D_8036C520[3].str, func_80311C64(func_8034717C(level))); + strcat(D_8036C520[3].str, func_80311C64(itemscore_timeScores_get(level))); } #else #pragma GLOBAL_ASM("asm/nonmatchings/core2/gc/pauseMenu/func_80311D74.s") #endif void func_80311ED0(s32 *dst){ - *dst = notescore_getTotal(); //note_total + *dst = itemscore_noteScores_getTotal(); //note_total } void func_80311EF8(s32 *dst){ @@ -330,7 +330,7 @@ void func_80311F48(void){ //gametime_2_sting strcpy(D_8036C520[3].str, empty); - strcat(D_8036C520[3].str, func_80311C64(func_803470A0())); + strcat(D_8036C520[3].str, func_80311C64(itemscore_timeScores_getTotal())); } #else #pragma GLOBAL_ASM("asm/nonmatchings/core2/gc/pauseMenu/func_80311F48.s") diff --git a/src/lair/code_0.c b/src/lair/code_0.c index 01aaf481..9ad02f5e 100644 --- a/src/lair/code_0.c +++ b/src/lair/code_0.c @@ -654,7 +654,7 @@ void func_80387730(Actor *this) { if ((ml_vec3f_distance(spAC, this->position) < 500.0f) && (func_803114C4() != 0xF64)) { func_802FACA4(0xC); } - if (notescore_getTotal() >= D_8039347A[this->unkF4_8]) { + if (itemscore_noteScores_getTotal() >= D_8039347A[this->unkF4_8]) { if (this->marker->unk14_21) { func_8032BC60(this, 5, sp90); func_8032BC60(this, 6, sp84); diff --git a/subyaml/core2.us.v10.yaml b/subyaml/core2.us.v10.yaml index e61c864a..a73f5117 100644 --- a/subyaml/core2.us.v10.yaml +++ b/subyaml/core2.us.v10.yaml @@ -384,7 +384,7 @@ segments: - [0xCFA60, c, ch/code_CFA60] #DONE - [0xD01C0, c, ch/clucker] #DONE - [0xD0CA0, c, code_D0CA0] - - [0xD2180, c, code_D2180] + - [0xD2180, c, code_D2180] #DONE - [0xD2500, c, ch/firefx] #DONE - [0xD2AB0, c, ch/drips] #DONE - [0xD2E10, c, ch/icecube] #DONE @@ -729,7 +729,8 @@ segments: - [0xF0410, bin, data_F0410] - [0xF0420, bin, data_F0420] #this is first part of [.rodata, code_76D90], COMBINE WITH FOLLOWING SECTION ONCE CODE DONE - [0xF0440, .rodata, code_76D90] - - [0xF0470, bin, data_F0470] + - [0xF0470, bin, data_F0470] #.rodata, code_78100] + - [0xF04A0, .rodata, code_78100] - [0xF04D0, .rodata, fxcommon3score] - [0xF04F0, bin, data_F04F0] - [0xF0520, .rodata, code_7AF80] diff --git a/symbol_addrs.core2.us.v10.txt b/symbol_addrs.core2.us.v10.txt index 9a91a6d4..f9d66a52 100644 --- a/symbol_addrs.core2.us.v10.txt +++ b/symbol_addrs.core2.us.v10.txt @@ -383,8 +383,8 @@ item_dec = 0x80345F44; item_empty = 0x80345F74; item_getCount = 0x80345FA0; item_set = 0x80346414; -notescore_getTotal = 0x80346EEC; -notescore_getLevelScore = 0x80346F34; +itemscore_noteScores_getTotal = 0x80346EEC; +itemscore_noteScores_get = 0x80346F34; demo_readInput = 0x80349EE4; demo_load = 0x8034A06C; demo_free = 0x8034A0EC; @@ -410,6 +410,7 @@ D_80367DC4 = 0x80367DC4; D_803682D0 = 0x803682D0; D_803688E0 = 0x803688E0; D_803688E8 = 0x803688E8; +D_8036A070 = 0x8036A070; sSpawnableActorSize = 0x8036A9B0; sSpawnableActorList = 0x8036A9B4; D_8036B810 = 0x8036B810; @@ -516,6 +517,7 @@ print_sFonts = 0x80380AD0; print_sPrintBuffer = 0x80380AE0; print_sCurrentPtr = 0x80380AE4; print_sInFontFormatMode = 0x80380B08; +D_80381E90 = 0x80381E90; jiggyscore = 0x803832C0; sHoneycombScore = 0x803832E0; sMumboTokenScore = 0x803832F0;