From e3fc8e92a4e0bf4b8bf4dcc0ed11327c97a43b23 Mon Sep 17 00:00:00 2001 From: David Joslin Date: Sun, 19 Nov 2023 16:22:22 -0800 Subject: [PATCH] Fixed 100 coin star in act select It will appear in act selection again Sanity checked 'score' so that if the 100 coin star was collected, it will return at least 100 --- src/game/save_file.c | 12 +++++++++++- src/menu/star_select.c | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/game/save_file.c b/src/game/save_file.c index f1d5b48e0..c2c52ae49 100644 --- a/src/game/save_file.c +++ b/src/game/save_file.c @@ -723,7 +723,17 @@ s32 save_file_get_course_coin_score(s32 fileIndex, s32 courseIndex) { if (INVALID_FILE_INDEX(fileIndex)) { return 0; } if (INVALID_SRC_SLOT(gSaveFileUsingBackupSlot)) { return 0; } if (INVALID_COURSE_COIN_INDEX(courseIndex)) { return 0; } - return gSaveBuffer.files[fileIndex][gSaveFileUsingBackupSlot].courseCoinScores[courseIndex]; + u8 coinScore = gSaveBuffer.files[fileIndex][gSaveFileUsingBackupSlot].courseCoinScores[courseIndex]; + + // sanity check - if we've collected 100 coin star... we have to have had at least 100 + if (coinScore < 100) { + u8 stars = save_file_get_star_flags(fileIndex, courseIndex); + if ((stars & (1 << 6))) { + coinScore = 100; + } + } + + return coinScore; } void save_file_set_course_coin_score(s32 fileIndex, s32 courseIndex, u8 coinScore) { diff --git a/src/menu/star_select.c b/src/menu/star_select.c index 987ba701c..df43f7bd4 100644 --- a/src/menu/star_select.c +++ b/src/menu/star_select.c @@ -98,7 +98,7 @@ void bhv_act_selector_star_type_loop(void) { * Renders the 100 coin star with an special star selector type. */ void render_100_coin_star(u8 stars) { - if ((stars & (1 << 6)) && sStarSelectorModels[6]) { + if ((stars & (1 << 6))) { // If the 100 coin star has been collected, create a new star selector next to the coin score. sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR, bhvActSelectorStarType, 370, 24, -300, 0, 0, 0);