From 9c35716fe2c0ff6447525c23a1364694e6ade01f Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Mon, 21 Nov 2022 22:01:44 -0500 Subject: [PATCH] Document Hud Mode (#1323) * begin interface alpha docs * more progress/docs * First draft of docs done * cleanup * Consistency * Display -> Mode * Remaining display -> mode * Better docs * Small touchups * Small Update * Apply discord discussion * small fix * More discussions * PR Suggestions * Roman PR Suggestions * better comments * PR Suggestions * another suggestion * discord discussions * cleanup comments * more discord/pr suggestions --- include/functions.h | 2 +- include/z64save.h | 32 +- src/code/db_camera.c | 6 +- src/code/z_camera.c | 4 +- src/code/z_common_data.c | 2 +- src/code/z_construct.c | 2 +- src/code/z_demo.c | 10 +- src/code/z_game_over.c | 3 +- src/code/z_kaleido_setup.c | 2 +- src/code/z_message_PAL.c | 38 +- src/code/z_onepointdemo.c | 2 +- src/code/z_parameter.c | 507 ++++++++++-------- src/code/z_play.c | 2 +- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c | 10 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.c | 4 +- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 2 +- src/overlays/actors/ovl_En_In/z_en_in.c | 8 +- src/overlays/actors/ovl_En_Mag/z_en_mag.c | 4 +- src/overlays/actors/ovl_En_Ossan/z_en_ossan.c | 4 +- src/overlays/actors/ovl_En_Zl1/z_en_zl1.c | 4 +- src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 6 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c | 6 +- src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c | 2 +- .../actors/ovl_player_actor/z_player.c | 2 +- .../ovl_file_choose/z_file_choose.c | 6 +- src/overlays/gamestates/ovl_select/z_select.c | 3 +- .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 36 +- 28 files changed, 387 insertions(+), 324 deletions(-) diff --git a/include/functions.h b/include/functions.h index 8c60f88b49..5d072fda42 100644 --- a/include/functions.h +++ b/include/functions.h @@ -957,7 +957,7 @@ void Map_Destroy(PlayState* play); void Map_Init(PlayState* play); void Minimap_Draw(PlayState* play); void Map_Update(PlayState* play); -void Interface_ChangeAlpha(u16 alphaType); +void Interface_ChangeHudVisibilityMode(u16 hudVisibilityMode); void Interface_SetSceneRestrictions(PlayState* play); void Inventory_SwapAgeEquipment(void); void Interface_InitHorsebackArchery(PlayState* play); diff --git a/include/z64save.h b/include/z64save.h index 8a3cdde584..1f45aaddb3 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -4,6 +4,28 @@ #include "ultra64.h" #include "z64math.h" +// `_FORCE` means that this request will respond to `forceRisingButtonAlphas`. +// If set, the buttons will also raise alphas but will also account for disabled buttons + +typedef enum { + /* 0 */ HUD_VISIBILITY_NO_CHANGE, + /* 1 */ HUD_VISIBILITY_NOTHING, + /* 2 */ HUD_VISIBILITY_NOTHING_ALT, // Identical to HUD_VISIBILITY_NOTHING + /* 3 */ HUD_VISIBILITY_HEARTS_FORCE, // See above + /* 4 */ HUD_VISIBILITY_A, + /* 5 */ HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE, // See above + /* 6 */ HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_FORCE, // See above + /* 7 */ HUD_VISIBILITY_ALL_NO_MINIMAP_BY_BTN_STATUS, // Only raises button alphas if not disabled + /* 8 */ HUD_VISIBILITY_B, + /* 9 */ HUD_VISIBILITY_HEARTS_MAGIC, + /* 10 */ HUD_VISIBILITY_B_ALT, // Identical to HUD_VISIBILITY_B + /* 11 */ HUD_VISIBILITY_HEARTS, + /* 12 */ HUD_VISIBILITY_A_B_MINIMAP, + /* 13 */ HUD_VISIBILITY_HEARTS_MAGIC_FORCE, // See above + /* 50 */ HUD_VISIBILITY_ALL = 50, // Only raises button alphas if not disabled + /* 52 */ HUD_VISIBILITY_NOTHING_INSTANT = 52 +} HudVisibilityMode; + typedef enum { /* 0x0 */ MAGIC_STATE_IDLE, // Regular gameplay /* 0x1 */ MAGIC_STATE_CONSUME_SETUP, // Sets the speed at which magic border flashes @@ -220,11 +242,11 @@ typedef struct { /* 0x13E0 */ u8 seqId; /* 0x13E1 */ u8 natureAmbienceId; /* 0x13E2 */ u8 buttonStatus[5]; - /* 0x13E7 */ u8 unk_13E7; // alpha related - /* 0x13E8 */ u16 unk_13E8; // alpha type? - /* 0x13EA */ u16 unk_13EA; // also alpha type? - /* 0x13EC */ u16 unk_13EC; // alpha type counter? - /* 0x13EE */ u16 unk_13EE; // previous alpha type? + /* 0x13E7 */ u8 forceRisingButtonAlphas; // if btn alphas are updated through Interface_DimButtonAlphas, instead update them through Interface_RaiseButtonAlphas + /* 0x13E8 */ u16 nextHudVisibilityMode; // triggers the hud to change visibility mode to the requested value. Reset to HUD_VISIBILITY_NO_CHANGE when target is reached + /* 0x13EA */ u16 hudVisibilityMode; // current hud visibility mode + /* 0x13EC */ u16 hudVisibilityModeTimer; // number of frames in the transition to a new hud visibility mode. Used to step alpha + /* 0x13EE */ u16 prevHudVisibilityMode; // used to store and recover hud visibility mode for pause menu and text boxes /* 0x13F0 */ s16 magicState; // determines magic meter behavior on each frame /* 0x13F2 */ s16 prevMagicState; // used to resume the previous state after adding or filling magic /* 0x13F4 */ s16 magicCapacity; // maximum magic available diff --git a/src/code/db_camera.c b/src/code/db_camera.c index 72ea7fd82a..0c50abbc05 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -2136,14 +2136,14 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sDbCamAnim.unk_04 = 0; } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_CLEFT)) { sDbCamAnim.unk_0A = 0; - Interface_ChangeAlpha(2); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT); Letterbox_SetSizeTarget(0); D_8016110C = 0; return 2; } if (func_800B91B0(cam, dbCamera) == 0) { - Interface_ChangeAlpha(2); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT); Letterbox_SetSizeTarget(0); Audio_PlaySfxGeneral(NA_SE_SY_GET_RUPY, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -2302,7 +2302,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sDbCamAnim.unk_04 = 0.0f; sDbCamAnim.unk_0A = 1; sDbCamAnim.unk_0C = 0; - Interface_ChangeAlpha(50); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); Letterbox_SetSizeTarget(32); D_8016110C = 0; Audio_PlaySfxGeneral(NA_SE_SY_HP_RECOVER, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 4c69f5889b..a395d1ca8a 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -791,11 +791,11 @@ void Camera_UpdateInterface(s16 flags) { if ((flags & IFACE_ALPHA_MASK) != IFACE_ALPHA_MASK) { interfaceAlpha = (flags & IFACE_ALPHA_MASK) >> 8; if (interfaceAlpha == 0) { - interfaceAlpha = 0x32; + interfaceAlpha = HUD_VISIBILITY_ALL; } if (interfaceAlpha != sCameraInterfaceAlpha) { sCameraInterfaceAlpha = interfaceAlpha; - Interface_ChangeAlpha(sCameraInterfaceAlpha); + Interface_ChangeHudVisibilityMode(sCameraInterfaceAlpha); } } } diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index d1db8b5080..dd039f8a28 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -19,5 +19,5 @@ void SaveContext_Init(void) { gSaveContext.skyboxTime = 0; gSaveContext.dogIsLost = true; gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT; - gSaveContext.unk_13EE = 50; + gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL; } diff --git a/src/code/z_construct.c b/src/code/z_construct.c index 414d38aeeb..0868c13d43 100644 --- a/src/code/z_construct.c +++ b/src/code/z_construct.c @@ -11,7 +11,7 @@ void Interface_Init(PlayState* play) { u8 timerId; gSaveContext.sunsSongState = SUNSSONG_INACTIVE; - gSaveContext.unk_13E8 = gSaveContext.unk_13EA = 0; + gSaveContext.nextHudVisibilityMode = gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; View_Init(&interfaceCtx->view, play->state.gfxCtx); diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 4a7f344ab6..ea95cad20e 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -188,7 +188,7 @@ u32 func_8006472C(PlayState* play, CutsceneContext* csCtx, f32 target) { } void func_80064760(PlayState* play, CutsceneContext* csCtx) { - Interface_ChangeAlpha(1); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); Letterbox_SetSizeTarget(32); if (func_8006472C(play, csCtx, 1.0f)) { @@ -199,7 +199,7 @@ void func_80064760(PlayState* play, CutsceneContext* csCtx) { void func_800647C0(PlayState* play, CutsceneContext* csCtx) { func_80068C3C(play, csCtx); - Interface_ChangeAlpha(1); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); Letterbox_SetSizeTarget(32); if (func_8006472C(play, csCtx, 1.0f)) { @@ -510,7 +510,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB osSyncPrintf("\n分岐先指定!!=[%d]番", cmd->base); // "Future fork designation=No. [%d]" if ((gSaveContext.gameMode != GAMEMODE_NORMAL) && (csCtx->frames != cmd->startFrame)) { - gSaveContext.unk_13E7 = 1; + gSaveContext.forceRisingButtonAlphas = true; } gSaveContext.cutsceneIndex = 0; @@ -1554,7 +1554,7 @@ void Cutscene_Command_Textbox(PlayState* play, CutsceneContext* csCtx, CsCmdText } if (csCtx->frames == originalCsFrames) { - Interface_ChangeAlpha(1); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); D_8011E1C0 = 0; D_8011E1C4 = 0; } @@ -2018,7 +2018,7 @@ void func_80068ECC(PlayState* play, CutsceneContext* csCtx) { } if (gSaveContext.cutsceneTrigger == 0) { - Interface_ChangeAlpha(1); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); Letterbox_SetSizeTarget(32); Letterbox_SetSize(32); csCtx->state++; diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index e4731ed348..91730c4af1 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -70,7 +70,8 @@ void GameOver_Update(PlayState* play) { gSaveContext.eventInf[3] = 0; gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[4] = BTN_ENABLED; - gSaveContext.unk_13E7 = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = 0; + gSaveContext.forceRisingButtonAlphas = gSaveContext.nextHudVisibilityMode = gSaveContext.hudVisibilityMode = + gSaveContext.hudVisibilityModeTimer = 0; // false, HUD_VISIBILITY_NO_CHANGE Environment_InitGameOverLights(play); gGameOverTimer = 20; diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 242106db12..3aff8ebe52 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -24,7 +24,7 @@ void KaleidoSetup_Update(PlayState* play) { pauseCtx->debugState = 3; } } else if (CHECK_BTN_ALL(input->press.button, BTN_START)) { - gSaveContext.unk_13EE = gSaveContext.unk_13EA; + gSaveContext.prevHudVisibilityMode = gSaveContext.hudVisibilityMode; WREG(16) = -175; WREG(17) = 155; diff --git a/src/code/z_message_PAL.c b/src/code/z_message_PAL.c index 7dce3ecb61..e5b0ba115a 100644 --- a/src/code/z_message_PAL.c +++ b/src/code/z_message_PAL.c @@ -1589,10 +1589,10 @@ void Message_OpenText(PlayState* play, u16 textId) { s16 textBoxType; if (msgCtx->msgMode == MSGMODE_NONE) { - gSaveContext.unk_13EE = gSaveContext.unk_13EA; + gSaveContext.prevHudVisibilityMode = gSaveContext.hudVisibilityMode; } if (R_SCENE_CAM_TYPE == SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT) { - Interface_ChangeAlpha(5); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE); } sMessageHasSetSfx = D_8014B2F4 = sTextboxSkipped = sTextIsCredits = 0; @@ -1623,7 +1623,7 @@ void Message_OpenText(PlayState* play, u16 textId) { textId == 0x2061 || // Learning Epona's Song textId == 0x5035 || // Guru-Guru in Windmill textId == 0x40AC) { // Ocarina Frog Minigame - Interface_ChangeAlpha(1); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); } msgCtx->textId = textId; @@ -1840,9 +1840,9 @@ void Message_StartOcarina(PlayState* play, u16 ocarinaActionId) { msgCtx->textboxColorAlphaCurrent = msgCtx->textboxColorAlphaTarget; if (noStop == false) { Interface_LoadActionLabelB(play, DO_ACTION_STOP); - noStop = gSaveContext.unk_13EA; - Interface_ChangeAlpha(0xA); - gSaveContext.unk_13EA = noStop; + noStop = gSaveContext.hudVisibilityMode; + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_B_ALT); + gSaveContext.hudVisibilityMode = noStop; } // "Music Performance Start" osSyncPrintf("演奏開始\n"); @@ -1853,7 +1853,7 @@ void Message_StartOcarina(PlayState* play, u16 ocarinaActionId) { msgCtx->msgMode = MSGMODE_FROGS_START; msgCtx->textBoxType = TEXTBOX_TYPE_BLUE; } else if (ocarinaActionId == OCARINA_ACTION_MEMORY_GAME) { - Interface_ChangeAlpha(1); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); Message_Decode(play); msgCtx->msgMode = MSGMODE_MEMORY_GAME_START; } else if (ocarinaActionId == OCARINA_ACTION_SCARECROW_LONG_PLAYBACK) { @@ -1868,8 +1868,8 @@ void Message_StartOcarina(PlayState* play, u16 ocarinaActionId) { msgCtx->stateTimer = 3; msgCtx->msgMode = MSGMODE_SCARECROW_LONG_PLAYBACK; AudioOcarina_SetPlaybackSong(OCARINA_SONG_SCARECROW_LONG + 1, 1); - gSaveContext.unk_13EA = 0; - Interface_ChangeAlpha(1); + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); } for (k = 0, j = 0; j < 48; j++, k += 0x80) { func_8006EE50(&play->msgCtx.font, 0x8140, k); @@ -2139,7 +2139,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { Audio_PlaySfxGeneral(NA_SE_SY_TRE_BOX_APPEAR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - Interface_ChangeAlpha(1); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); } } else if (msgCtx->ocarinaAction == OCARINA_ACTION_CHECK_SCARECROW_SPAWN) { if (msgCtx->ocarinaStaff->state < OCARINA_SONG_SCARECROW_SPAWN) { @@ -2159,7 +2159,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { Audio_PlaySfxGeneral(NA_SE_SY_TRE_BOX_APPEAR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - Interface_ChangeAlpha(1); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); } } else if (msgCtx->ocarinaAction == OCARINA_ACTION_FREE_PLAY) { // "Ocarina_Free Correct Example Performance" @@ -2176,7 +2176,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - Interface_ChangeAlpha(1); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); } else { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); Audio_PlaySfxGeneral(NA_SE_SY_OCARINA_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -3189,7 +3189,7 @@ void Message_Update(PlayState* play) { case MSGMODE_TEXT_NEXT_MSG: Message_Decode(play); if (sTextFade) { - Interface_ChangeAlpha(1); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); } if (D_80153D74 != 0) { msgCtx->textDrawPos = msgCtx->decodedTextLen; @@ -3271,7 +3271,7 @@ void Message_Update(PlayState* play) { if (msgCtx->textId == 0x301F || msgCtx->textId == 0xA || msgCtx->textId == 0xC || msgCtx->textId == 0xCF || msgCtx->textId == 0x21C || msgCtx->textId == 9 || msgCtx->textId == 0x4078 || msgCtx->textId == 0x2015 || msgCtx->textId == 0x3040) { - gSaveContext.unk_13EE = 0x32; + gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL; } if (play->csCtx.state == 0) { osSyncPrintf(VT_FGCOL(GREEN)); @@ -3282,11 +3282,13 @@ void Message_Update(PlayState* play) { (msgCtx->textId != 0x3055 && gSaveContext.cutsceneIndex < 0xFFF0)) { osSyncPrintf("=== day_time=%x ", ((void)0, gSaveContext.cutsceneIndex)); if (play->activeCamId == CAM_ID_MAIN) { - if (gSaveContext.unk_13EE == 0 || gSaveContext.unk_13EE == 1 || gSaveContext.unk_13EE == 2) { - gSaveContext.unk_13EE = 0x32; + if (gSaveContext.prevHudVisibilityMode == HUD_VISIBILITY_NO_CHANGE || + gSaveContext.prevHudVisibilityMode == HUD_VISIBILITY_NOTHING || + gSaveContext.prevHudVisibilityMode == HUD_VISIBILITY_NOTHING_ALT) { + gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL; } - gSaveContext.unk_13EA = 0; - Interface_ChangeAlpha(gSaveContext.unk_13EE); + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; + Interface_ChangeHudVisibilityMode(gSaveContext.prevHudVisibilityMode); } } } diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c index 55176b06e4..01bf406571 100644 --- a/src/code/z_onepointdemo.c +++ b/src/code/z_onepointdemo.c @@ -1176,7 +1176,7 @@ s16 OnePointCutscene_Init(PlayState* play, s16 csId, s16 timer, Actor* actor, s1 OnePointCutscene_SetAsChild(play, vChildCamId, subCamId); vSubCamStatus = CAM_STAT_WAIT; } else { - Interface_ChangeAlpha(2); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT); } OnePointCutscene_SetAsChild(play, subCamId, parentCamId); diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 90996bc9f7..c143b15e56 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -164,15 +164,20 @@ static Gfx sSetupDL_80125A60[] = { }; // original name: "alpha_change" -void Interface_ChangeAlpha(u16 alphaType) { - if (alphaType != gSaveContext.unk_13EA) { - osSyncPrintf("ALPHAーTYPE=%d LAST_TIME_TYPE=%d\n", alphaType, gSaveContext.unk_13EE); - gSaveContext.unk_13EA = gSaveContext.unk_13E8 = alphaType; - gSaveContext.unk_13EC = 1; +void Interface_ChangeHudVisibilityMode(u16 hudVisibilityMode) { + if (hudVisibilityMode != gSaveContext.hudVisibilityMode) { + osSyncPrintf("ALPHAーTYPE=%d LAST_TIME_TYPE=%d\n", hudVisibilityMode, + gSaveContext.prevHudVisibilityMode); + gSaveContext.hudVisibilityMode = gSaveContext.nextHudVisibilityMode = hudVisibilityMode; + gSaveContext.hudVisibilityModeTimer = 1; } } -void func_80082644(PlayState* play, s16 alpha) { +/** + * Raise button alphas on the HUD to the requested value + * Apply a set value of 70 to disabled buttons + */ +void Interface_RaiseButtonAlphas(PlayState* play, s16 risingAlpha) { InterfaceContext* interfaceCtx = &play->interfaceCtx; if (gSaveContext.buttonStatus[0] == BTN_DISABLED) { @@ -181,7 +186,7 @@ void func_80082644(PlayState* play, s16 alpha) { } } else { if (interfaceCtx->bAlpha != 255) { - interfaceCtx->bAlpha = alpha; + interfaceCtx->bAlpha = risingAlpha; } } @@ -191,7 +196,7 @@ void func_80082644(PlayState* play, s16 alpha) { } } else { if (interfaceCtx->cLeftAlpha != 255) { - interfaceCtx->cLeftAlpha = alpha; + interfaceCtx->cLeftAlpha = risingAlpha; } } @@ -201,7 +206,7 @@ void func_80082644(PlayState* play, s16 alpha) { } } else { if (interfaceCtx->cDownAlpha != 255) { - interfaceCtx->cDownAlpha = alpha; + interfaceCtx->cDownAlpha = risingAlpha; } } @@ -211,7 +216,7 @@ void func_80082644(PlayState* play, s16 alpha) { } } else { if (interfaceCtx->cRightAlpha != 255) { - interfaceCtx->cRightAlpha = alpha; + interfaceCtx->cRightAlpha = risingAlpha; } } @@ -221,182 +226,194 @@ void func_80082644(PlayState* play, s16 alpha) { } } else { if (interfaceCtx->aAlpha != 255) { - interfaceCtx->aAlpha = alpha; + interfaceCtx->aAlpha = risingAlpha; } } } -void func_8008277C(PlayState* play, s16 maxAlpha, s16 alpha) { +/** + * Lower button alphas on the HUD to the requested value + * if forceRisingButtonAlphas is set, then instead raise button alphas + */ +void Interface_DimButtonAlphas(PlayState* play, s16 dimmingAlpha, s16 risingAlpha) { InterfaceContext* interfaceCtx = &play->interfaceCtx; - if (gSaveContext.unk_13E7 != 0) { - func_80082644(play, alpha); + if (gSaveContext.forceRisingButtonAlphas) { + Interface_RaiseButtonAlphas(play, risingAlpha); return; } - if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) { - interfaceCtx->bAlpha = maxAlpha; + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; } - if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) { - interfaceCtx->aAlpha = maxAlpha; + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; } - if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) { - interfaceCtx->cLeftAlpha = maxAlpha; + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; } - if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) { - interfaceCtx->cDownAlpha = maxAlpha; + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; } - if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) { - interfaceCtx->cRightAlpha = maxAlpha; + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; } } -void func_80082850(PlayState* play, s16 maxAlpha) { +void Interface_UpdateHudAlphas(PlayState* play, s16 dimmingAlpha) { InterfaceContext* interfaceCtx = &play->interfaceCtx; - s16 alpha = 255 - maxAlpha; + s16 risingAlpha = 255 - dimmingAlpha; - switch (gSaveContext.unk_13E8) { - case 1: - case 2: - case 8: + switch (gSaveContext.nextHudVisibilityMode) { + case HUD_VISIBILITY_NOTHING: + case HUD_VISIBILITY_NOTHING_ALT: + case HUD_VISIBILITY_B: osSyncPrintf("a_alpha=%d, c_alpha=%d → ", interfaceCtx->aAlpha, interfaceCtx->cLeftAlpha); - if (gSaveContext.unk_13E8 == 8) { + if (gSaveContext.nextHudVisibilityMode == HUD_VISIBILITY_B) { if (interfaceCtx->bAlpha != 255) { - interfaceCtx->bAlpha = alpha; + interfaceCtx->bAlpha = risingAlpha; } } else { - if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) { - interfaceCtx->bAlpha = maxAlpha; + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; } } - if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) { - interfaceCtx->aAlpha = maxAlpha; + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; } - if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) { - interfaceCtx->cLeftAlpha = maxAlpha; + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; } - if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) { - interfaceCtx->cDownAlpha = maxAlpha; + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; } - if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) { - interfaceCtx->cRightAlpha = maxAlpha; + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; } - if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) { - interfaceCtx->healthAlpha = maxAlpha; + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; } - if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) { - interfaceCtx->magicAlpha = maxAlpha; + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; } - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { - interfaceCtx->minimapAlpha = maxAlpha; + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; } osSyncPrintf("a_alpha=%d, c_alpha=%d\n", interfaceCtx->aAlpha, interfaceCtx->cLeftAlpha); break; - case 3: - if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) { - interfaceCtx->aAlpha = maxAlpha; + + case HUD_VISIBILITY_HEARTS_FORCE: + // aAlpha is immediately overwritten in Interface_DimButtonAlphas + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; } - func_8008277C(play, maxAlpha, alpha); + Interface_DimButtonAlphas(play, dimmingAlpha, risingAlpha); - if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) { - interfaceCtx->magicAlpha = maxAlpha; + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; } - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { - interfaceCtx->minimapAlpha = maxAlpha; + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; } if (interfaceCtx->healthAlpha != 255) { - interfaceCtx->healthAlpha = alpha; + interfaceCtx->healthAlpha = risingAlpha; } break; - case 4: - if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) { - interfaceCtx->bAlpha = maxAlpha; + + case HUD_VISIBILITY_A: + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; } - if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) { - interfaceCtx->aAlpha = maxAlpha; + // aAlpha is immediately overwritten below + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; } - if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) { - interfaceCtx->cLeftAlpha = maxAlpha; + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; } - if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) { - interfaceCtx->cDownAlpha = maxAlpha; + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; } - if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) { - interfaceCtx->cRightAlpha = maxAlpha; + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; } - if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) { - interfaceCtx->healthAlpha = maxAlpha; + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; } - if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) { - interfaceCtx->magicAlpha = maxAlpha; + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; } - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { - interfaceCtx->minimapAlpha = maxAlpha; + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; } if (interfaceCtx->aAlpha != 255) { - interfaceCtx->aAlpha = alpha; + interfaceCtx->aAlpha = risingAlpha; } break; - case 5: - func_8008277C(play, maxAlpha, alpha); - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { - interfaceCtx->minimapAlpha = maxAlpha; + case HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE: + Interface_DimButtonAlphas(play, dimmingAlpha, risingAlpha); + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; } + // aAlpha overwrites the value set in Interface_DimButtonAlphas if (interfaceCtx->aAlpha != 255) { - interfaceCtx->aAlpha = alpha; + interfaceCtx->aAlpha = risingAlpha; } if (interfaceCtx->healthAlpha != 255) { - interfaceCtx->healthAlpha = alpha; + interfaceCtx->healthAlpha = risingAlpha; } if (interfaceCtx->magicAlpha != 255) { - interfaceCtx->magicAlpha = alpha; + interfaceCtx->magicAlpha = risingAlpha; } break; - case 6: - func_8008277C(play, maxAlpha, alpha); + case HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_FORCE: + Interface_DimButtonAlphas(play, dimmingAlpha, risingAlpha); + + // aAlpha overwrites the value set in Interface_DimButtonAlphas if (interfaceCtx->aAlpha != 255) { - interfaceCtx->aAlpha = alpha; + interfaceCtx->aAlpha = risingAlpha; } if (interfaceCtx->healthAlpha != 255) { - interfaceCtx->healthAlpha = alpha; + interfaceCtx->healthAlpha = risingAlpha; } if (interfaceCtx->magicAlpha != 255) { - interfaceCtx->magicAlpha = alpha; + interfaceCtx->magicAlpha = risingAlpha; } switch (play->sceneId) { @@ -421,187 +438,195 @@ void func_80082850(PlayState* play, s16 maxAlpha) { case SCENE_SPOT20: case SCENE_GANON_TOU: if (interfaceCtx->minimapAlpha < 170) { - interfaceCtx->minimapAlpha = alpha; + interfaceCtx->minimapAlpha = risingAlpha; } else { interfaceCtx->minimapAlpha = 170; } break; + default: if (interfaceCtx->minimapAlpha != 255) { - interfaceCtx->minimapAlpha = alpha; + interfaceCtx->minimapAlpha = risingAlpha; } break; } break; - case 7: - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { - interfaceCtx->minimapAlpha = maxAlpha; + + case HUD_VISIBILITY_ALL_NO_MINIMAP_BY_BTN_STATUS: + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; } - func_80082644(play, alpha); + Interface_RaiseButtonAlphas(play, risingAlpha); if (interfaceCtx->healthAlpha != 255) { - interfaceCtx->healthAlpha = alpha; + interfaceCtx->healthAlpha = risingAlpha; } if (interfaceCtx->magicAlpha != 255) { - interfaceCtx->magicAlpha = alpha; + interfaceCtx->magicAlpha = risingAlpha; } break; - case 9: - if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) { - interfaceCtx->bAlpha = maxAlpha; + + case HUD_VISIBILITY_HEARTS_MAGIC: + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; } - if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) { - interfaceCtx->aAlpha = maxAlpha; + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; } - if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) { - interfaceCtx->cLeftAlpha = maxAlpha; + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; } - if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) { - interfaceCtx->cDownAlpha = maxAlpha; + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; } - if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) { - interfaceCtx->cRightAlpha = maxAlpha; + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; } - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { - interfaceCtx->minimapAlpha = maxAlpha; + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; } if (interfaceCtx->healthAlpha != 255) { - interfaceCtx->healthAlpha = alpha; + interfaceCtx->healthAlpha = risingAlpha; } if (interfaceCtx->magicAlpha != 255) { - interfaceCtx->magicAlpha = alpha; + interfaceCtx->magicAlpha = risingAlpha; } break; - case 10: - if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) { - interfaceCtx->aAlpha = maxAlpha; + + case HUD_VISIBILITY_B_ALT: + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; } - if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) { - interfaceCtx->cLeftAlpha = maxAlpha; + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; } - if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) { - interfaceCtx->cDownAlpha = maxAlpha; + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; } - if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) { - interfaceCtx->cRightAlpha = maxAlpha; + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; } - if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) { - interfaceCtx->healthAlpha = maxAlpha; + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; } - if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) { - interfaceCtx->magicAlpha = maxAlpha; + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; } - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { - interfaceCtx->minimapAlpha = maxAlpha; + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; } if (interfaceCtx->bAlpha != 255) { - interfaceCtx->bAlpha = alpha; + interfaceCtx->bAlpha = risingAlpha; } break; - case 11: - if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) { - interfaceCtx->bAlpha = maxAlpha; + + case HUD_VISIBILITY_HEARTS: + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; } - if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) { - interfaceCtx->aAlpha = maxAlpha; + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; } - if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) { - interfaceCtx->cLeftAlpha = maxAlpha; + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; } - if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) { - interfaceCtx->cDownAlpha = maxAlpha; + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; } - if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) { - interfaceCtx->cRightAlpha = maxAlpha; + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; } - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { - interfaceCtx->minimapAlpha = maxAlpha; + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; } - if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) { - interfaceCtx->magicAlpha = maxAlpha; + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; } if (interfaceCtx->healthAlpha != 255) { - interfaceCtx->healthAlpha = alpha; + interfaceCtx->healthAlpha = risingAlpha; } break; - case 12: + + case HUD_VISIBILITY_A_B_MINIMAP: if (interfaceCtx->aAlpha != 255) { - interfaceCtx->aAlpha = alpha; + interfaceCtx->aAlpha = risingAlpha; } if (interfaceCtx->bAlpha != 255) { - interfaceCtx->bAlpha = alpha; + interfaceCtx->bAlpha = risingAlpha; } if (interfaceCtx->minimapAlpha != 255) { - interfaceCtx->minimapAlpha = alpha; + interfaceCtx->minimapAlpha = risingAlpha; } - if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) { - interfaceCtx->cLeftAlpha = maxAlpha; + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; } - if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) { - interfaceCtx->cDownAlpha = maxAlpha; + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; } - if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) { - interfaceCtx->cRightAlpha = maxAlpha; + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; } - if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) { - interfaceCtx->magicAlpha = maxAlpha; + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; } - if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) { - interfaceCtx->healthAlpha = maxAlpha; + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; } break; - case 13: - func_8008277C(play, maxAlpha, alpha); - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { - interfaceCtx->minimapAlpha = maxAlpha; + case HUD_VISIBILITY_HEARTS_MAGIC_FORCE: + Interface_DimButtonAlphas(play, dimmingAlpha, risingAlpha); + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; } - if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) { - interfaceCtx->aAlpha = maxAlpha; + // aAlpha overwrites the value set in Interface_DimButtonAlphas + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; } if (interfaceCtx->healthAlpha != 255) { - interfaceCtx->healthAlpha = alpha; + interfaceCtx->healthAlpha = risingAlpha; } if (interfaceCtx->magicAlpha != 255) { - interfaceCtx->magicAlpha = alpha; + interfaceCtx->magicAlpha = risingAlpha; } break; @@ -621,12 +646,12 @@ void func_80083108(PlayState* play) { if ((gSaveContext.cutsceneIndex < 0xFFF0) || ((play->sceneId == SCENE_SPOT20) && (gSaveContext.cutsceneIndex == 0xFFF0))) { - gSaveContext.unk_13E7 = 0; + gSaveContext.forceRisingButtonAlphas = false; if ((player->stateFlags1 & PLAYER_STATE1_23) || (play->shootingGalleryStatus > 1) || ((play->sceneId == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38))) { if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) { - gSaveContext.unk_13E7 = 1; + gSaveContext.forceRisingButtonAlphas = true; if (gSaveContext.buttonStatus[0] == BTN_DISABLED) { gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = @@ -661,44 +686,45 @@ void func_80083108(PlayState* play) { gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = BTN_DISABLED; - Interface_ChangeAlpha(6); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_FORCE); } if (play->transitionMode != TRANS_MODE_OFF) { - Interface_ChangeAlpha(1); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); } else if (gSaveContext.minigameState == 1) { - Interface_ChangeAlpha(8); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_B); } else if (play->shootingGalleryStatus > 1) { - Interface_ChangeAlpha(8); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_B); } else if ((play->sceneId == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38)) { - Interface_ChangeAlpha(8); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_B); } else if (player->stateFlags1 & PLAYER_STATE1_23) { - Interface_ChangeAlpha(12); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_B_MINIMAP); } } else { if (player->stateFlags1 & PLAYER_STATE1_23) { - Interface_ChangeAlpha(12); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_B_MINIMAP); } } } else if (play->sceneId == SCENE_KENJYANOMA) { - Interface_ChangeAlpha(1); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); } else if (play->sceneId == SCENE_TURIBORI) { - gSaveContext.unk_13E7 = 2; + // should likely be set to true + gSaveContext.forceRisingButtonAlphas = 2; if (play->interfaceCtx.unk_260 != 0) { if (gSaveContext.equips.buttonItems[0] != ITEM_FISHING_POLE) { gSaveContext.buttonStatus[0] = gSaveContext.equips.buttonItems[0]; gSaveContext.equips.buttonItems[0] = ITEM_FISHING_POLE; - gSaveContext.unk_13EA = 0; + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; Interface_LoadItemIcon1(play, 0); - Interface_ChangeAlpha(12); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_B_MINIMAP); } - if (gSaveContext.unk_13EA != 12) { - Interface_ChangeAlpha(12); + if (gSaveContext.hudVisibilityMode != HUD_VISIBILITY_A_B_MINIMAP) { + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_B_MINIMAP); } } else if (gSaveContext.equips.buttonItems[0] == ITEM_FISHING_POLE) { gSaveContext.equips.buttonItems[0] = gSaveContext.buttonStatus[0]; - gSaveContext.unk_13EA = 0; + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) { Interface_LoadItemIcon1(play, 0); @@ -706,15 +732,15 @@ void func_80083108(PlayState* play) { gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = BTN_DISABLED; - Interface_ChangeAlpha(50); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); } else { if (gSaveContext.buttonStatus[0] == BTN_ENABLED) { - gSaveContext.unk_13EA = 0; + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; } gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = BTN_DISABLED; - Interface_ChangeAlpha(50); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); } } else if (msgCtx->msgMode == MSGMODE_NONE) { if ((Player_GetEnvironmentalHazard(play) >= PLAYER_ENV_HAZARD_UNDERWATER_FLOOR) && @@ -751,18 +777,18 @@ void func_80083108(PlayState* play) { } if (sp28) { - gSaveContext.unk_13EA = 0; + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; } - Interface_ChangeAlpha(50); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); } else if ((player->stateFlags1 & PLAYER_STATE1_21) || (player->stateFlags2 & PLAYER_STATE2_CRAWLING)) { if (gSaveContext.buttonStatus[0] != BTN_DISABLED) { gSaveContext.buttonStatus[0] = BTN_DISABLED; gSaveContext.buttonStatus[1] = BTN_DISABLED; gSaveContext.buttonStatus[2] = BTN_DISABLED; gSaveContext.buttonStatus[3] = BTN_DISABLED; - gSaveContext.unk_13EA = 0; - Interface_ChangeAlpha(50); + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); } } else if (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_1) { if (player->stateFlags1 & PLAYER_STATE1_23) { @@ -814,10 +840,10 @@ void func_80083108(PlayState* play) { } if (sp28) { - gSaveContext.unk_13EA = 0; + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; } - Interface_ChangeAlpha(50); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); } else { if (interfaceCtx->restrictions.bButton == 0) { if ((gSaveContext.equips.buttonItems[0] == ITEM_SLINGSHOT) || @@ -1059,9 +1085,9 @@ void func_80083108(PlayState* play) { } if (sp28) { - gSaveContext.unk_13EA = 0; + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { - Interface_ChangeAlpha(50); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); osSyncPrintf("???????? alpha_change( 50 ); ?????\n"); } else { osSyncPrintf("game_play->fade_direction || game_play->fbdemo_wipe_modem"); @@ -1312,7 +1338,7 @@ void func_80084BF4(PlayState* play, u16 flag) { gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = BTN_ENABLED; - Interface_ChangeAlpha(7); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL_NO_MINIMAP_BY_BTN_STATUS); } else { gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = BTN_ENABLED; @@ -2806,7 +2832,9 @@ void Interface_DrawItemButtons(PlayState* play) { // C-Up Button Texture, Color & Label (Navi Text) gDPPipeSync(OVERLAY_DISP++); - if ((gSaveContext.unk_13EA == 1) || (gSaveContext.unk_13EA == 2) || (gSaveContext.unk_13EA == 5)) { + if ((gSaveContext.hudVisibilityMode == HUD_VISIBILITY_NOTHING) || + (gSaveContext.hudVisibilityMode == HUD_VISIBILITY_NOTHING_ALT) || + (gSaveContext.hudVisibilityMode == HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE)) { temp = 0; } else if ((player->stateFlags1 & PLAYER_STATE1_21) || (Player_GetEnvironmentalHazard(play) == PLAYER_ENV_HAZARD_UNDERWATER_FREE) || @@ -3915,8 +3943,8 @@ void Interface_Update(PlayState* play) { MessageContext* msgCtx = &play->msgCtx; InterfaceContext* interfaceCtx = &play->interfaceCtx; Player* player = GET_PLAYER(play); - s16 alpha; - s16 alpha1; + s16 dimmingAlpha; + s16 risingAlpha; u16 action; Input* debugInput = &play->state.input[2]; @@ -3943,52 +3971,55 @@ void Interface_Update(PlayState* play) { } } - switch (gSaveContext.unk_13E8) { - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - alpha = 255 - (gSaveContext.unk_13EC << 5); - if (alpha < 0) { - alpha = 0; + // Update hud visibility mode + switch (gSaveContext.nextHudVisibilityMode) { + case HUD_VISIBILITY_NOTHING: + case HUD_VISIBILITY_NOTHING_ALT: + case HUD_VISIBILITY_HEARTS_FORCE: + case HUD_VISIBILITY_A: + case HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE: + case HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_FORCE: + case HUD_VISIBILITY_ALL_NO_MINIMAP_BY_BTN_STATUS: + case HUD_VISIBILITY_B: + case HUD_VISIBILITY_HEARTS_MAGIC: + case HUD_VISIBILITY_B_ALT: + case HUD_VISIBILITY_HEARTS: + case HUD_VISIBILITY_A_B_MINIMAP: + case HUD_VISIBILITY_HEARTS_MAGIC_FORCE: + dimmingAlpha = 255 - (32 * gSaveContext.hudVisibilityModeTimer); + if (dimmingAlpha < 0) { + dimmingAlpha = 0; } - func_80082850(play, alpha); - gSaveContext.unk_13EC++; + Interface_UpdateHudAlphas(play, dimmingAlpha); + gSaveContext.hudVisibilityModeTimer++; - if (alpha == 0) { - gSaveContext.unk_13E8 = 0; + if (dimmingAlpha == 0) { + gSaveContext.nextHudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; } break; - case 50: - alpha = 255 - (gSaveContext.unk_13EC << 5); - if (alpha < 0) { - alpha = 0; + + case HUD_VISIBILITY_ALL: + dimmingAlpha = 255 - (32 * gSaveContext.hudVisibilityModeTimer); + if (dimmingAlpha < 0) { + dimmingAlpha = 0; } - alpha1 = 255 - alpha; - if (alpha1 >= 255) { - alpha1 = 255; + risingAlpha = 255 - dimmingAlpha; + if (risingAlpha >= 255) { + risingAlpha = 255; } - osSyncPrintf("case 50 : alpha=%d alpha1=%d\n", alpha, alpha1); - func_80082644(play, alpha1); + osSyncPrintf("case 50 : alpha=%d alpha1=%d\n", dimmingAlpha, risingAlpha); + + Interface_RaiseButtonAlphas(play, risingAlpha); if (interfaceCtx->healthAlpha != 255) { - interfaceCtx->healthAlpha = alpha1; + interfaceCtx->healthAlpha = risingAlpha; } if (interfaceCtx->magicAlpha != 255) { - interfaceCtx->magicAlpha = alpha1; + interfaceCtx->magicAlpha = risingAlpha; } switch (play->sceneId) { @@ -4013,28 +4044,32 @@ void Interface_Update(PlayState* play) { case SCENE_SPOT20: case SCENE_GANON_TOU: if (interfaceCtx->minimapAlpha < 170) { - interfaceCtx->minimapAlpha = alpha1; + interfaceCtx->minimapAlpha = risingAlpha; } else { interfaceCtx->minimapAlpha = 170; } break; + default: if (interfaceCtx->minimapAlpha != 255) { - interfaceCtx->minimapAlpha = alpha1; + interfaceCtx->minimapAlpha = risingAlpha; } break; } - gSaveContext.unk_13EC++; - if (alpha1 == 255) { - gSaveContext.unk_13E8 = 0; + gSaveContext.hudVisibilityModeTimer++; + if (risingAlpha == 255) { + gSaveContext.nextHudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; } break; - case 52: - gSaveContext.unk_13E8 = 1; - func_80082850(play, 0); - gSaveContext.unk_13E8 = 0; + + case HUD_VISIBILITY_NOTHING_INSTANT: + // Hide the HUD immediately + gSaveContext.nextHudVisibilityMode = HUD_VISIBILITY_NOTHING; + Interface_UpdateHudAlphas(play, 0); + gSaveContext.nextHudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; + FALLTHROUGH; default: break; } diff --git a/src/code/z_play.c b/src/code/z_play.c index b08f4c61cc..c308bd0c83 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -509,7 +509,7 @@ void Play_Update(PlayState* this) { if (this->transitionTrigger != TRANS_TRIGGER_END) { s16 sceneLayer = SCENE_LAYER_CHILD_DAY; - Interface_ChangeAlpha(1); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); if (gSaveContext.cutsceneIndex >= 0xFFF0) { sceneLayer = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.cutsceneIndex & 0xF); diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c index 8ede2882f4..f2e0021396 100644 --- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c +++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c @@ -391,7 +391,7 @@ void BgDyYoseizo_GreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play) { if ((this->dialogState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - Interface_ChangeAlpha(5); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE); this->actionFunc = BgDyYoseizo_SetupHealPlayer_NoReward; } @@ -712,7 +712,7 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, PlayState* play) { gSaveContext.isMagicAcquired = true; gSaveContext.magicFillTarget = MAGIC_NORMAL_METER; // magicLevel is already 0, setting isMagicAcquired to true triggers magicCapacity to grow - Interface_ChangeAlpha(9); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC); break; case FAIRY_UPGRADE_DOUBLE_MAGIC: if (!gSaveContext.isMagicAcquired) { @@ -722,11 +722,11 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, PlayState* play) { gSaveContext.magicFillTarget = MAGIC_DOUBLE_METER; // Setting magicLevel to 0 triggers magicCapacity to grow gSaveContext.magicLevel = 0; - Interface_ChangeAlpha(9); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC); break; case FAIRY_UPGRADE_DOUBLE_DEFENSE: gSaveContext.isDoubleDefenseAcquired = true; - Interface_ChangeAlpha(9); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC); break; } @@ -760,7 +760,7 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, PlayState* play) { this->itemSpawned = true; gSaveContext.healthAccumulator = 0x140; - Interface_ChangeAlpha(9); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC); gSaveContext.itemGetInf[ITEMGETINF_18_19_1A_INDEX] |= sItemGetFlags[actionIndex]; Item_Give(play, sItemIds[actionIndex]); } diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 2866d3b295..95b85c97a9 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -785,7 +785,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { if (this->csTimer == 20) { func_8002DF54(play, &this->actor, 0x17); - Interface_ChangeAlpha(11); // show hearts only + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS); } if (this->csTimer == 25) { @@ -793,7 +793,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { } if (this->csTimer == 100) { - Interface_ChangeAlpha(1); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); } if (this->csTimer == 120) { diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 8b1e929f95..70a29beffa 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -791,7 +791,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { case MO_TENT_SHAKE: if (this->timers[0] == 138) { Letterbox_SetSizeTarget(0); - Interface_ChangeAlpha(0xB); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS); } if ((this->timers[0] % 8) == 0) { play->damagePlayer(play, -1); diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index d2d01f9cb8..3916fd0c83 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -433,7 +433,7 @@ void func_80A79BAC(EnIn* this, PlayState* play, s32 index, u32 transitionType) { play->transitionType = transitionType; play->transitionTrigger = TRANS_TRIGGER_START; func_8002DF54(play, &this->actor, 8); - Interface_ChangeAlpha(1); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); if (index == 0) { AREG(6) = 0; } @@ -471,7 +471,7 @@ void func_80A79C78(EnIn* this, PlayState* play) { player->actor.freezeTimer = 10; this->actor.flags &= ~ACTOR_FLAG_0; Letterbox_SetSizeTarget(32); - Interface_ChangeAlpha(2); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT); } static s32 D_80A7B998 = 0; @@ -792,7 +792,7 @@ void func_80A7AA40(EnIn* this, PlayState* play) { this->unk_1FC = 0; play->csCtx.frames = 0; Letterbox_SetSizeTarget(32); - Interface_ChangeAlpha(2); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT); this->actionFunc = func_80A7ABD4; } @@ -857,7 +857,7 @@ void func_80A7AE84(EnIn* this, PlayState* play) { Play_ChangeCameraStatus(play, this->returnToCamId, CAM_STAT_ACTIVE); Play_ClearCamera(play, this->subCamId); func_8002DF54(play, &this->actor, 7); - Interface_ChangeAlpha(0x32); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); this->actionFunc = func_80A7AEF0; } diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index 43493a3712..bcc39ce9f3 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -68,7 +68,7 @@ void EnMag_Init(Actor* thisx, PlayState* play) { this->effectFadeInState = this->effectPrimLodFrac = this->globalState = this->effectAlpha = this->mainAlpha = this->subAlpha = this->copyrightAlpha = 0.0f; - if (gSaveContext.unk_13E7 != 0) { + if (gSaveContext.forceRisingButtonAlphas) { this->mainAlpha = 210; this->subAlpha = 255; this->copyrightAlpha = 255; @@ -83,7 +83,7 @@ void EnMag_Init(Actor* thisx, PlayState* play) { this->effectEnvColor[1] = 255.0f; this->effectEnvColor[2] = 0; - gSaveContext.unk_13E7 = 0; + gSaveContext.forceRisingButtonAlphas = false; this->globalState = MAG_STATE_DISPLAY; sDelayTimer = 20; gSaveContext.transFadeDuration = 1; diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index 74f18b4710..c587270062 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -654,7 +654,7 @@ void EnOssan_EndInteraction(PlayState* play, EnOssan* this) { play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~PLAYER_STATE2_29; Play_SetViewpoint(play, VIEWPOINT_LOCKED); - Interface_ChangeAlpha(50); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -1323,7 +1323,7 @@ void EnOssan_GiveItemWithFanfare(PlayState* play, EnOssan* this) { play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~PLAYER_STATE2_29; Play_SetViewpoint(play, VIEWPOINT_LOCKED); - Interface_ChangeAlpha(50); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); this->drawCursor = 0; EnOssan_UpdateCameraDirection(this, play, 0.0f); this->stateFlag = OSSAN_STATE_GIVE_ITEM_FANFARE; diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index d1bca099a1..f4d3b90467 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -181,7 +181,7 @@ void func_80B4B010(EnZl1* this, PlayState* play) { Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); Play_CameraSetFov(play, this->subCamId, 30.0f); Letterbox_SetSizeTarget(32); - Interface_ChangeAlpha(2); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT); player->actor.world.pos = playerPos; player->actor.speedXZ = 0.0f; this->unk_1E2 = 0; @@ -556,7 +556,7 @@ void func_80B4BF2C(EnZl1* this, PlayState* play) { case 6: if (Actor_TextboxIsClosing(&this->actor, play)) { func_8002DF54(play, &this->actor, 7); - Interface_ChangeAlpha(50); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); this->actor.flags &= ~ACTOR_FLAG_8; this->unk_1E2 = 4; } diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index 0867ff0ed5..39a55c8265 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -330,7 +330,7 @@ s32 EnZl4_SetupFromLegendCs(EnZl4* this, PlayState* play) { EnZl4_SetActiveCamMove(play, 5); Letterbox_SetSizeTarget(32); - Interface_ChangeAlpha(2); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT); this->talkTimer2 = 0; return true; } @@ -1150,7 +1150,7 @@ void EnZl4_Cutscene(EnZl4* this, PlayState* play) { this->mouthExpression = ZL4_MOUTH_SURPRISED; Audio_PlayFanfare(NA_BGM_APPEAR); EnZl4_SetActiveCamDir(play, 0); - Interface_ChangeAlpha(2); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT); Letterbox_SetSizeTarget(32); this->talkState = 0; this->csState++; @@ -1194,7 +1194,7 @@ void EnZl4_Cutscene(EnZl4* this, PlayState* play) { case ZL4_CS_PLAN: if (EnZl4_CsMakePlan(this, play)) { func_8002DF54(play, &this->actor, 7); - gSaveContext.unk_13EE = 0x32; + gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL; SET_EVENTCHKINF(EVENTCHKINF_40); this->actionFunc = EnZl4_Idle; } diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 89270ab8fd..b8846fde1e 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -5238,7 +5238,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { sSubCamAt.y = mainCam->at.y; sSubCamAt.z = mainCam->at.z; D_80B7A6CC = 2; - Interface_ChangeAlpha(12); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_B_MINIMAP); sSubCamVelFactor = 0.0f; FALLTHROUGH; } diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index 31e25425c6..6198ce9729 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -165,8 +165,10 @@ void ObjLift_Shake(ObjLift* this, PlayState* play) { ObjLift_SetupFall(this); } else { this->shakeOrientation.x += 10000; - this->dyna.actor.world.rot.x = (s16)(Math_SinS(this->shakeOrientation.x) * 300.0f) + this->dyna.actor.home.rot.x; - this->dyna.actor.world.rot.z = (s16)(Math_CosS(this->shakeOrientation.x) * 300.0f) + this->dyna.actor.home.rot.z; + this->dyna.actor.world.rot.x = + (s16)(Math_SinS(this->shakeOrientation.x) * 300.0f) + this->dyna.actor.home.rot.x; + this->dyna.actor.world.rot.z = + (s16)(Math_CosS(this->shakeOrientation.x) * 300.0f) + this->dyna.actor.home.rot.z; this->dyna.actor.shape.rot.x = this->dyna.actor.world.rot.x; this->dyna.actor.shape.rot.z = this->dyna.actor.world.rot.z; this->shakeOrientation.y += 18000; diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 29761f631a..fb7cbe0174 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -34,7 +34,7 @@ ActorInit Shot_Sun_InitVars = { }; typedef enum { - /* 0 */ SPAWNER_OUT_OF_RANGE , + /* 0 */ SPAWNER_OUT_OF_RANGE, /* 1 */ SPAWNER_OCARINA_START, /* 2 */ SPAWNER_OCARINA_PLAYING } FairySpawnerState; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index a3f22be60f..e5f239227c 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -3106,7 +3106,7 @@ void func_80835DE4(PlayState* play, Player* this, PlayerFunc674 func, s32 flags) void func_80835E44(PlayState* play, s16 camSetting) { if (!Play_CamIsNotFixed(play)) { if (camSetting == CAM_SET_SCENE_TRANSITION) { - Interface_ChangeAlpha(2); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT); } } else { Camera_ChangeSetting(Play_GetCamera(play, CAM_ID_MAIN), camSetting); diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index fd638a0054..d47c458db8 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1469,7 +1469,7 @@ void FileSelect_LoadGame(GameState* thisx) { gSaveContext.eventInf[1] = 0; gSaveContext.eventInf[2] = 0; gSaveContext.eventInf[3] = 0; - gSaveContext.unk_13EE = 0x32; + gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL; gSaveContext.nayrusLoveTimer = 0; gSaveContext.healthAccumulator = 0; gSaveContext.magicState = MAGIC_STATE_IDLE; @@ -1486,8 +1486,8 @@ void FileSelect_LoadGame(GameState* thisx) { gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[4] = BTN_ENABLED; - gSaveContext.unk_13E7 = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = - gSaveContext.magicCapacity = 0; + gSaveContext.forceRisingButtonAlphas = gSaveContext.nextHudVisibilityMode = gSaveContext.hudVisibilityMode = + gSaveContext.hudVisibilityModeTimer = gSaveContext.magicCapacity = 0; // false, HUD_VISIBILITY_NO_CHANGE // Set the fill target to be the saved magic amount gSaveContext.magicFillTarget = gSaveContext.magic; diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 48b712d5f8..650de1304f 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -29,7 +29,8 @@ void MapSelect_LoadGame(MapSelectState* this, s32 entranceIndex) { } gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[4] = BTN_ENABLED; - gSaveContext.unk_13E7 = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = 0; + gSaveContext.forceRisingButtonAlphas = gSaveContext.nextHudVisibilityMode = gSaveContext.hudVisibilityMode = + gSaveContext.hudVisibilityModeTimer = 0; // false, HUD_VISIBILITY_NO_CHANGE SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0); gSaveContext.entranceIndex = entranceIndex; gSaveContext.respawnFlag = 0; diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 8185fb2640..9863c68052 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -387,8 +387,8 @@ void KaleidoScope_SwitchPage(PauseContext* pauseCtx, u8 pt) { osSyncPrintf("kscope->kscp_pos+pt = %d\n", pauseCtx->pageIndex + pt); - gSaveContext.unk_13EA = 0; - Interface_ChangeAlpha(50); + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); } void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) { @@ -2935,8 +2935,8 @@ void KaleidoScope_Update(PlayState* play) { gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = BTN_DISABLED; gSaveContext.buttonStatus[4] = BTN_ENABLED; - gSaveContext.unk_13EA = 0; - Interface_ChangeAlpha(50); + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); pauseCtx->unk_1EC = 0; pauseCtx->state = 7; } @@ -2982,8 +2982,8 @@ void KaleidoScope_Update(PlayState* play) { gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = BTN_DISABLED; gSaveContext.buttonStatus[4] = BTN_ENABLED; - gSaveContext.unk_13EA = 0; - Interface_ChangeAlpha(50); + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); pauseCtx->unk_1EC = 0; pauseCtx->state = 7; } else if (pauseCtx->ocarinaStaff->state == pauseCtx->ocarinaSongIdx) { @@ -3032,8 +3032,8 @@ void KaleidoScope_Update(PlayState* play) { gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = BTN_DISABLED; gSaveContext.buttonStatus[4] = BTN_ENABLED; - gSaveContext.unk_13EA = 0; - Interface_ChangeAlpha(50); + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); pauseCtx->unk_1EC = 0; pauseCtx->state = 7; } @@ -3066,8 +3066,8 @@ void KaleidoScope_Update(PlayState* play) { Interface_SetDoAction(play, DO_ACTION_NONE); gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = BTN_ENABLED; - gSaveContext.unk_13EA = 0; - Interface_ChangeAlpha(50); + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); pauseCtx->unk_1EC = 2; WREG(2) = -6240; YREG(8) = pauseCtx->unk_204; @@ -3091,8 +3091,8 @@ void KaleidoScope_Update(PlayState* play) { func_800F64E0(0); gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = BTN_ENABLED; - gSaveContext.unk_13EA = 0; - Interface_ChangeAlpha(50); + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); } break; @@ -3102,8 +3102,8 @@ void KaleidoScope_Update(PlayState* play) { Interface_SetDoAction(play, DO_ACTION_NONE); gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = BTN_ENABLED; - gSaveContext.unk_13EA = 0; - Interface_ChangeAlpha(50); + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); pauseCtx->unk_1EC = 5; WREG(2) = -6240; YREG(8) = pauseCtx->unk_204; @@ -3156,7 +3156,7 @@ void KaleidoScope_Update(PlayState* play) { WREG(16) = -175; WREG(17) = 155; pauseCtx->unk_204 = -434.0f; - Interface_ChangeAlpha(1); + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); //! @bug messed up alignment, should match `ALIGN64` pauseCtx->iconItemSegment = (void*)(((uintptr_t)play->objectCtx.spaceStart + 0x30) & ~0x3F); @@ -3507,9 +3507,9 @@ void KaleidoScope_Update(PlayState* play) { gSaveContext.buttonStatus[4] = D_808321A8[4]; interfaceCtx->unk_1FA = interfaceCtx->unk_1FC = 0; osSyncPrintf(VT_FGCOL(YELLOW)); - osSyncPrintf("i=%d LAST_TIME_TYPE=%d\n", i, gSaveContext.unk_13EE); - gSaveContext.unk_13EA = 0; - Interface_ChangeAlpha(gSaveContext.unk_13EE); + osSyncPrintf("i=%d LAST_TIME_TYPE=%d\n", i, gSaveContext.prevHudVisibilityMode); + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; + Interface_ChangeHudVisibilityMode(gSaveContext.prevHudVisibilityMode); player->targetActor = NULL; Player_SetEquipmentData(play, player); osSyncPrintf(VT_RST);