diff --git a/include/functions.h b/include/functions.h index c1d997fd..31eae9d5 100644 --- a/include/functions.h +++ b/include/functions.h @@ -402,7 +402,7 @@ s32 HUD_8008CB8C(void); void HUD_VS_ShieldGaugeTex_Draw(f32, f32, f32, f32, f32); void HUD_DrawBossHealth(void); void HUD_DrawCountdown(s32* , f32); -void HUD_Shield_GoldRings_HitPoints(f32, f32); +void HUD_Shield_GoldRings_Score(f32, f32); void HUD_BombCounter_Draw(f32, f32); void HUD_Draw(void); void FoBase_Draw(Boss*); @@ -423,7 +423,7 @@ void Aquas_AqRock_Setup(Actor*, s32); void Aquas_CsLevelComplete(Player*); void Aquas_Effect363_Update(Effect*); void Aquas_Effect363_Draw(Effect*); -void HUD_Hitpoints_Draw(f32, f32); +void HUD_Score_Draw(f32, f32); void Venom1_LevelStart2(Player* player); // fox_col1 diff --git a/include/sf64save.h b/include/sf64save.h index 2427e88f..ee5ef045 100644 --- a/include/sf64save.h +++ b/include/sf64save.h @@ -24,7 +24,7 @@ typedef struct { typedef struct PlanetStats { /* bit 0 */ u16 hitCount : 8; /* bit 8 */ u16 planetId : 4; - /* bit C */ u16 unk_C : 1; // hitCount related + /* bit C */ u16 hitCountOver256 : 1; /* bit D */ u16 peppyAlive : 1; /* bit E */ u16 falcoAlive : 1; /* bit F */ u16 slippyAlive : 1; diff --git a/src/audio/audio_synthesis.c b/src/audio/audio_synthesis.c index de98438f..609fdfc2 100644 --- a/src/audio/audio_synthesis.c +++ b/src/audio/audio_synthesis.c @@ -367,13 +367,14 @@ void func_80008780(f32* arg0, s32 arg1, f32* arg2) { #pragma GLOBAL_ASM("asm/us/rev1/nonmatchings/audio/audio_synthesis/func_80008780.s") #endif -// https://decomp.me/scratch/mYlns +// https://decomp.me/scratch/TZQNS #ifdef NON_MATCHING void func_80009124(s16** arg0) { s16* var_a1; s32 temp_a0; u8 temp_s0; u8 temp_s1; + u8 temp_u1; s32 temp_t5_4; s32 temp_v0; u8 temp_v1; @@ -384,35 +385,38 @@ void func_80009124(s16** arg0) { u32 var_t3; s32 i; s32 j; + s16 new_var2; var_a1 = *arg0; for (i = 255; i >= 0; i--) { D_80145D48[i] = 0.0f; } - var_t3 = *var_a1++ << 0x10; - var_t3 |= *var_a1++; + temp_v0 = *var_a1++; + var_t3 = temp_v0 << 0x10; + temp_v0 = *var_a1++; + var_t3 |= temp_v0; - for (var_t2 = 0; var_t2 != 0x100; var_t2 += 0x40) { + for (var_t2 = 0; var_t2 < 4; var_t2++) { + var_v1 = var_t2 * 0x40; temp_s0 = var_t3 >> 0x18; - var_v1 = var_t2; + var_t3 <<= 8; - temp_v0 = ((temp_s0 >> 4) & 0xF); + temp_v1 = ((temp_s0 >> 4) & 0xF); temp_a0 = temp_s0 & 0xF; - if (((temp_s0 >> 4) & 0xF) == 0) { + if (temp_v1 == 0) { continue; } - switch (temp_v0) { + switch (temp_v1) { case 1: while (true) { var_s0 = *var_a1++; for (var_s1 = 0; var_s1 < 4; var_s1++) { - temp_s1 = (var_s0 >> 0xC) & 0xF; + temp_u1 = (var_s0 >> 0xC) & 0xF; var_s0 <<= 4; - D_80145D48[var_v1++] = ((temp_s1 & 7) - 4) << temp_a0; - - if (temp_s1 >= 8) { + D_80145D48[var_v1++] = ((temp_u1 & 7) - 4) << temp_a0; + if (temp_u1 >= 8) { goto case_1_break; } } @@ -420,49 +424,47 @@ void func_80009124(s16** arg0) { case_1_break: break; case 2: - var_s1 = -1; - while (++var_s1 < 16) { + for (var_s1 = 0; var_s1 < 16; var_s1++) { var_s0 = *var_a1++; for (i = 0; i < 4; i++) { - temp_s1 = (var_s0 >> 0xC) & 0xF; + temp_u1 = (var_s0 >> 0xC) & 0xF; var_s0 <<= 4; - D_80145D48[var_v1++] = (temp_s1 - 8) << temp_a0; + D_80145D48[var_v1++] = (temp_u1 - 8) << temp_a0; } } break; case 6: while (true) { var_s0 = *var_a1++; - temp_s1 = (var_s0 >> 8) & 0xFF; - - D_80145D48[var_v1] = ((temp_s1 & 0x3F) - 0x20) << temp_a0; - if (temp_s1 >> 6 == 0) { - + temp_u1 = (var_s0 >> 8) & 0xFF; + temp_t5_4 = temp_u1 >> 6; + D_80145D48[var_v1] = ((temp_u1 & 0x3F) - 0x20) << temp_a0; + if (temp_t5_4 == 0) { break; } - var_v1 += temp_s1 >> 6; - temp_s1 = var_s0 & 0xFF; - D_80145D48[var_v1] = ((temp_s1 & 0x3F) - 0x20) << temp_a0; - if (temp_s1 >> 6 == 0) { - + var_v1 += temp_t5_4; + temp_u1 = var_s0 & 0xFF; + temp_t5_4 = temp_u1 >> 6; + D_80145D48[var_v1] = ((temp_u1 & 0x3F) - 0x20) << temp_a0; + if (temp_t5_4 == 0) { break; } - var_v1 += temp_s1 >> 6; + var_v1 += temp_t5_4; } break; case 3: while (true) { var_s0 = *var_a1++; + temp_u1 = (var_s0 >> 8) & 0xFF; - temp_s1 = (var_s0 >> 8) & 0xFF; + D_80145D48[var_v1++] = ((temp_u1 & 0x7F) - 0x40) << temp_a0; - D_80145D48[var_v1++] = ((temp_s1 & 0x7F) - 0x40) << temp_a0; - if (temp_s1 >= 0x80) { + if (temp_u1 >= 0x80) { break; } - temp_s1 = var_s0 & 0xFF; - D_80145D48[var_v1++] = ((temp_s1 & 0x7F) - 0x40) << temp_a0; - if (temp_s1 >= 0x80) { + temp_u1 = var_s0 & 0xFF; + D_80145D48[var_v1++] = ((temp_u1 & 0x7F) - 0x40) << temp_a0; + if (temp_u1 >= 0x80) { break; } } @@ -481,8 +483,9 @@ void func_80009124(s16** arg0) { case 5: while (true) { var_s0 = *var_a1++; + temp_t5_4 = var_s0 >> 0xF; D_80145D48[var_v1] = ((var_s0 & 0x7FFF) - 0x4000) << temp_a0; - if ((var_s0 >> 0xF) == 1) { + if (temp_t5_4 == 1) { break; } var_v1++; diff --git a/src/engine/fox_hud.c b/src/engine/fox_hud.c index d44d6cf1..727e43d2 100644 --- a/src/engine/fox_hud.c +++ b/src/engine/fox_hud.c @@ -3223,7 +3223,7 @@ void HUD_Radar(void) { HUD_RadarMarks_Update(); } -void HUD_Hitpoints_Update(f32 xPos, f32 yPos) { +void HUD_Score_Update(f32 xPos, f32 yPos) { f32 r; f32 g; f32 b; @@ -3309,25 +3309,23 @@ void HUD_Hitpoints_Update(f32 xPos, f32 yPos) { r = 255; g = 255; b = 255; + } else if (medalStatus) { + r = 200; + g = 100; + b = 50; } else { - if (medalStatus) { - r = 200; - g = 100; - b = 50; - } else { - r = 90; - g = 160; - b = 200; - } + r = 90; + g = 160; + b = 200; } RCP_SetupDL(&gMasterDisp, SETUPDL_76); gDPSetPrimColor(gMasterDisp++, 0, 0, r, g, b, 255); - HUD_Hitpoints_Draw(xPos, yPos); + HUD_Score_Draw(xPos, yPos); } -void HUD_Shield_GoldRings_HitPoints(f32 xPos, f32 yPos) { - HUD_Hitpoints_Update(xPos, yPos); +void HUD_Shield_GoldRings_Score(f32 xPos, f32 yPos) { + HUD_Score_Update(xPos, yPos); HUD_PlayerShield_GoldRings(); } @@ -3553,7 +3551,7 @@ void HUD_SinglePlayer(void) { HUD_IncomingMsg(); if (D_hud_80161708 != 0) { - HUD_Shield_GoldRings_HitPoints(24.0f, 30.0f); + HUD_Shield_GoldRings_Score(24.0f, 30.0f); if (gCurrentLevel != LEVEL_TRAINING) { HUD_LivesCount2_Draw(248.0f, 11.0f, gLifeCount[gPlayerNum]); } @@ -5417,7 +5415,7 @@ void stub_80094D10(void) { void stub_80094D18(void) { } -void HUD_Hitpoints_Draw(f32 x, f32 y) { +void HUD_Score_Draw(f32 x, f32 y) { u8* D_800D24DC[] = { aLargeText_0, aLargeText_1, aLargeText_2, aLargeText_3, aLargeText_4, aLargeText_5, aLargeText_6, aLargeText_7, aLargeText_8, aLargeText_9 }; s32 D_800D2504[] = { 100, 10, 1 }; diff --git a/src/overlays/ovl_ending/fox_end2.c b/src/overlays/ovl_ending/fox_end2.c index e066c3f6..95f7d8e5 100644 --- a/src/overlays/ovl_ending/fox_end2.c +++ b/src/overlays/ovl_ending/fox_end2.c @@ -254,7 +254,8 @@ bool Ending_8018DCB4(void) { unk40[i] = gSaveFile.save.data.rankingLives[i]; for (j = 0; j < 7; j++) { - temp4[i] += gSaveFile.save.data.stats[i][j].hitCount + (gSaveFile.save.data.stats[i][j].unk_C * 0x100); + temp4[i] += + gSaveFile.save.data.stats[i][j].hitCount + (gSaveFile.save.data.stats[i][j].hitCountOver256 * 256); stats[i][0] += gSaveFile.save.data.stats[i][j].peppyAlive & 1; stats[i][1] += gSaveFile.save.data.stats[i][j].slippyAlive & 1; stats[i][2] += gSaveFile.save.data.stats[i][j].falcoAlive & 1; diff --git a/src/overlays/ovl_i5/fox_ti.c b/src/overlays/ovl_i5/fox_ti.c index 3fc15072..d7f12ade 100644 --- a/src/overlays/ovl_i5/fox_ti.c +++ b/src/overlays/ovl_i5/fox_ti.c @@ -22,9 +22,7 @@ typedef struct { typedef struct { /* 0x00 */ PosRot unk_00; - /* 0x18 */ f32 unk_18; - /* 0x1C */ f32 unk_1C; - /* 0x20 */ f32 unk_20; + /* 0x18 */ Vec3f unk_18; /* 0x24 */ s16 unk_24; /* 0x26 */ u16 unk_26; } UnkStruct_i5_801BBF00; // size = 0x28 @@ -2250,7 +2248,7 @@ void Titania_TiGoras_Init(TiGoras* this) { for (var_v1 = D_i5_801BBF00, i = 0; i < ARRAY_COUNTU(D_i5_801BBF00); i++, var_v1++) { var_v1->unk_26 = 0; var_v1->unk_00.pos.x = var_v1->unk_00.pos.y = var_v1->unk_00.pos.z = var_v1->unk_00.rot.x = - var_v1->unk_00.rot.y = var_v1->unk_00.rot.z = var_v1->unk_18 = var_v1->unk_1C = var_v1->unk_20 = 0.0f; + var_v1->unk_00.rot.y = var_v1->unk_00.rot.z = var_v1->unk_18.x = var_v1->unk_18.y = var_v1->unk_18.z = 0.0f; } for (i = 0; i < ARRAY_COUNT(D_i5_801BD218); i++) { @@ -2826,13 +2824,13 @@ bool Titania_80190A08(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* Matrix_Translate(gCalcMatrix, pos->x, pos->y, pos->z, MTXF_APPLY); if (sp88 != 0) { - Matrix_RotateZ(gCalcMatrix, D_i5_801BBF00[i].unk_20 * M_DTOR, MTXF_APPLY); - Matrix_RotateY(gCalcMatrix, D_i5_801BBF00[i].unk_1C * M_DTOR, MTXF_APPLY); - Matrix_RotateX(gCalcMatrix, D_i5_801BBF00[i].unk_18 * M_DTOR, MTXF_APPLY); + Matrix_RotateZ(gCalcMatrix, D_i5_801BBF00[i].unk_18.z * M_DTOR, MTXF_APPLY); + Matrix_RotateY(gCalcMatrix, D_i5_801BBF00[i].unk_18.y * M_DTOR, MTXF_APPLY); + Matrix_RotateX(gCalcMatrix, D_i5_801BBF00[i].unk_18.x * M_DTOR, MTXF_APPLY); } else { - rot->z += D_i5_801BBF00[i].unk_20; - rot->y += D_i5_801BBF00[i].unk_1C; - rot->x += D_i5_801BBF00[i].unk_18; + rot->z += D_i5_801BBF00[i].unk_18.z; + rot->y += D_i5_801BBF00[i].unk_18.y; + rot->x += D_i5_801BBF00[i].unk_18.x; } if (sp88 != 0) { @@ -3910,7 +3908,7 @@ void Titania_80193DF0(TiGoras* this) { D_i5_801BBEF0[6]--; if (D_i5_801BBEF0[6] == 0) { for (i = 0; i < ARRAY_COUNTU(D_i5_801BBF00); i++) { - D_i5_801BBF00[i].unk_18 = D_i5_801BBF00[i].unk_1C = D_i5_801BBF00[i].unk_20 = 0.0f; + D_i5_801BBF00[i].unk_18.x = D_i5_801BBF00[i].unk_18.y = D_i5_801BBF00[i].unk_18.z = 0.0f; } } } @@ -3975,7 +3973,7 @@ void Titania_80193DF0(TiGoras* this) { if (this->animFrame) {} if (j == ARRAY_COUNT(D_i5_801B8160)) { - D_i5_801BBF00[i].unk_20 = RAND_FLOAT(5.0f) - 2.5f; + D_i5_801BBF00[i].unk_18.z = RAND_FLOAT(5.0f) - 2.5f; } } } diff --git a/src/overlays/ovl_menu/fox_map.c b/src/overlays/ovl_menu/fox_map.c index f44d5bce..cb800545 100644 --- a/src/overlays/ovl_menu/fox_map.c +++ b/src/overlays/ovl_menu/fox_map.c @@ -2007,7 +2007,7 @@ s32 Map_801A05B4(void) { temp_a0 = gSaveFile.save.data.rankingRoute[i]; for (j = 0; j < temp_a0; j++) { var_a3 = gSaveFile.save.data.stats[i][j].hitCount; - if (gSaveFile.save.data.stats[i][j].unk_C != 0) { + if (gSaveFile.save.data.stats[i][j].hitCountOver256 != 0) { var_a3 += 256; } sp30[i] += var_a3; diff --git a/src/overlays/ovl_menu/fox_option.c b/src/overlays/ovl_menu/fox_option.c index edd2016f..20917eac 100644 --- a/src/overlays/ovl_menu/fox_option.c +++ b/src/overlays/ovl_menu/fox_option.c @@ -2413,7 +2413,7 @@ void Option_RankingHitCount_Draw(s32 rankIdx, s32 routeIdx, f32 xPos, f32 yPos) if ((yPos > 22.0f) && (yPos < 162.0f)) { RCP_SetupDL(&gMasterDisp, SETUPDL_83); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255); - hitCount = (gSaveFile.save.data.stats[rankIdx][routeIdx].unk_C & 1) << 8; + hitCount = (gSaveFile.save.data.stats[rankIdx][routeIdx].hitCountOver256 & 1) << 8; hitCount |= gSaveFile.save.data.stats[rankIdx][routeIdx].hitCount; Graphics_DisplaySmallNumber(xPos + 15.0f - (HUD_CountDigits(hitCount) - 1) * 8, yPos + 24.0f + 1.0f, hitCount); } @@ -4186,13 +4186,13 @@ void Option_Ranking_SaveData(void) { } for (j = 0; j < ROUTE_MAX; j++) { - planetStats[10][j].unk_C = 0; + planetStats[10][j].hitCountOver256 = 0; missionHitCount = gMissionHitCount[j]; if (missionHitCount > 255) { missionHitCount -= 256; - planetStats[10][j].unk_C = 1; + planetStats[10][j].hitCountOver256 = 1; } planetStats[10][j].hitCount = missionHitCount; @@ -4225,7 +4225,7 @@ void Option_Ranking_SaveData(void) { for (j = 0; j < ROUTE_MAX; j++) { planetStats[i][j].hitCount = gSaveFile.save.data.stats[i][j].hitCount; planetStats[i][j].planetId = gSaveFile.save.data.stats[i][j].planetId; - planetStats[i][j].unk_C = gSaveFile.save.data.stats[i][j].unk_C; + planetStats[i][j].hitCountOver256 = gSaveFile.save.data.stats[i][j].hitCountOver256; planetStats[i][j].peppyAlive = gSaveFile.save.data.stats[i][j].peppyAlive; planetStats[i][j].falcoAlive = gSaveFile.save.data.stats[i][j].falcoAlive; planetStats[i][j].slippyAlive = gSaveFile.save.data.stats[i][j].slippyAlive; @@ -4248,7 +4248,7 @@ void Option_Ranking_SaveData(void) { for (j = 0; j < ROUTE_MAX; j++) { gSaveFile.save.data.stats[i][j].hitCount = planetStats[currentRankIdx][j].hitCount; gSaveFile.save.data.stats[i][j].planetId = planetStats[currentRankIdx][j].planetId; - gSaveFile.save.data.stats[i][j].unk_C = planetStats[currentRankIdx][j].unk_C; + gSaveFile.save.data.stats[i][j].hitCountOver256 = planetStats[currentRankIdx][j].hitCountOver256; gSaveFile.save.data.stats[i][j].peppyAlive = planetStats[currentRankIdx][j].peppyAlive; gSaveFile.save.data.stats[i][j].falcoAlive = planetStats[currentRankIdx][j].falcoAlive; gSaveFile.save.data.stats[i][j].slippyAlive = planetStats[currentRankIdx][j].slippyAlive; diff --git a/src/overlays/ovl_menu/fox_title.c b/src/overlays/ovl_menu/fox_title.c index 7cf21285..caa4e85f 100644 --- a/src/overlays/ovl_menu/fox_title.c +++ b/src/overlays/ovl_menu/fox_title.c @@ -479,7 +479,7 @@ s32 Title_GetRankTotalHits(void) { for (j = 0; j < rankingRoute; j++) { hitCount = gSaveFile.save.data.stats[i][j].hitCount; - hitCount |= (gSaveFile.save.data.stats[i][j].unk_C & 1) << 8; + hitCount |= (gSaveFile.save.data.stats[i][j].hitCountOver256 & 1) << 8; gTotalHitsRanking[i] += hitCount; diff --git a/tools/Torch b/tools/Torch index 710497aa..ff8c2d13 160000 --- a/tools/Torch +++ b/tools/Torch @@ -1 +1 @@ -Subproject commit 710497aadc7cce37b28930bf65f52d1d480678be +Subproject commit ff8c2d13c71069f3117faf42ed25f0816229a872