From 5e860dd3e7989e6ea1712e9b250a1e47fbcfe692 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Wed, 28 Sep 2022 18:47:46 -0400 Subject: [PATCH] `z_parameter`: Hud Visibility (#942) * Begin interface alpha docs * More Interface Alpha * cleanup docs * Minor fixes * Apply Discord Discussions * More discussions * More suggestions from OoT * fix merge --- include/functions.h | 5 +- include/z64save.h | 38 +- include/z64scene.h | 8 +- src/code/z_actor.c | 28 +- src/code/z_bgcheck.c | 6 +- src/code/z_common_data.c | 2 +- src/code/z_demo.c | 12 +- src/code/z_game_over.c | 8 +- src/code/z_kaleido_setup.c | 2 +- src/code/z_map_exp.c | 4 +- src/code/z_message.c | 2 +- src/code/z_parameter.c | 765 +++++++++++++++++- src/code/z_play.c | 4 +- src/code/z_player_lib.c | 19 +- src/code/z_room.c | 22 +- src/code/z_scene.c | 12 +- .../ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c | 18 +- src/overlays/actors/ovl_Boss_04/z_boss_04.c | 2 +- .../actors/ovl_Dm_Char00/z_dm_char00.c | 2 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 4 +- .../actors/ovl_Door_Spiral/z_door_spiral.c | 2 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 4 +- .../actors/ovl_En_Bigslime/z_en_bigslime.c | 4 +- src/overlays/actors/ovl_En_Bom/z_en_bom.c | 2 +- .../actors/ovl_En_Fishing/z_en_fishing.c | 2 +- src/overlays/actors/ovl_En_Fsn/z_en_fsn.c | 4 +- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 2 +- src/overlays/actors/ovl_En_Gb2/z_en_gb2.c | 6 +- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 4 +- src/overlays/actors/ovl_En_Holl/z_en_holl.c | 12 +- src/overlays/actors/ovl_En_Ishi/z_en_ishi.c | 2 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 8 +- src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c | 6 +- src/overlays/actors/ovl_En_Mag/z_en_mag.c | 4 +- src/overlays/actors/ovl_En_Mm/z_en_mm.c | 2 +- src/overlays/actors/ovl_En_Ossan/z_en_ossan.c | 4 +- .../actors/ovl_En_Pametfrog/z_en_pametfrog.c | 4 +- src/overlays/actors/ovl_En_Sob1/z_en_sob1.c | 4 +- src/overlays/actors/ovl_En_Test2/z_en_test2.c | 2 +- src/overlays/actors/ovl_En_Test4/z_en_test4.c | 4 +- src/overlays/actors/ovl_En_Test7/z_en_test7.c | 2 +- src/overlays/actors/ovl_En_Trt/z_en_trt.c | 4 +- .../actors/ovl_En_Viewer/z_en_viewer.c | 6 +- .../ovl_Obj_Flowerpot/z_obj_flowerpot.c | 8 +- .../actors/ovl_Obj_Hunsui/z_obj_hunsui.c | 14 +- .../actors/ovl_Obj_Kibako/z_obj_kibako.c | 4 +- .../ovl_Obj_Snowball2/z_obj_snowball2.c | 4 +- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.c | 4 +- src/overlays/gamestates/ovl_select/z_select.c | 8 +- .../ovl_kaleido_scope/z_kaleido_item.c | 8 +- tools/disasm/functions.txt | 8 +- tools/namefixer.py | 6 + tools/sizes/code_functions.csv | 8 +- 53 files changed, 960 insertions(+), 169 deletions(-) diff --git a/include/functions.h b/include/functions.h index 05db21f4f8..f04ab19816 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1823,10 +1823,7 @@ void func_8010EA9C(s32 arg0, s32 arg1); // void func_8010EBA0(void); // void func_8010EC54(void); void func_8010EE74(PlayState* play, s32 day); -void Interface_ChangeAlpha(u16 param_1); -// void func_8010EF9C(void); -// void func_8010F0D4(void); -// void func_8010F1A8(void); +void Interface_SetHudVisibility(u16 hudVisibility); // void func_80110038(void); // void func_80111CB4(void); // void func_801129E4(void); diff --git a/include/z64save.h b/include/z64save.h index 12b525f4df..57801684f3 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -54,6 +54,34 @@ typedef enum { #define MAGIC_NORMAL_METER 0x30 #define MAGIC_DOUBLE_METER (2 * MAGIC_NORMAL_METER) +typedef enum { + /* 0 */ HUD_VISIBILITY_IDLE, + /* 1 */ HUD_VISIBILITY_NONE, + /* 2 */ HUD_VISIBILITY_NONE_ALT, // Identical to HUD_VISIBILITY_NONE + /* 3 */ HUD_VISIBILITY_HEARTS_WITH_OVERWRITE, // Uses Interface_UpdateButtonAlphas so gives the opportunity to dim only disabled buttons + /* 4 */ HUD_VISIBILITY_A, + /* 5 */ HUD_VISIBILITY_A_HEARTS_MAGIC_WITH_OVERWRITE, // Uses Interface_UpdateButtonAlphas so gives the opportunity to dim only disabled buttons + /* 6 */ HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_WITH_OVERWRITE, // Uses Interface_UpdateButtonAlphas so gives the opportunity to dim only disabled buttons + /* 7 */ HUD_VISIBILITY_ALL_NO_MINIMAP_W_DISABLED, // Only raises button alphas if not disabled + /* 8 */ HUD_VISIBILITY_B, + /* 9 */ HUD_VISIBILITY_HEARTS_MAGIC, + /* 10 */ HUD_VISIBILITY_B_ALT, + /* 11 */ HUD_VISIBILITY_HEARTS, + /* 12 */ HUD_VISIBILITY_A_B_MINIMAP, + /* 13 */ HUD_VISIBILITY_HEARTS_MAGIC_WITH_OVERWRITE, // Uses Interface_UpdateButtonAlphas so gives the opportunity to dim only disabled buttons + /* 14 */ HUD_VISIBILITY_HEARTS_MAGIC_C, + /* 15 */ HUD_VISIBILITY_ALL_NO_MINIMAP, + /* 16 */ HUD_VISIBILITY_A_B_C, + /* 17 */ HUD_VISIBILITY_B_MINIMAP, + /* 18 */ HUD_VISIBILITY_HEARTS_MAGIC_MINIMAP, + /* 19 */ HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP, + /* 20 */ HUD_VISIBILITY_B_MAGIC, + /* 21 */ HUD_VISIBILITY_A_B, + /* 22 */ HUD_VISIBILITY_A_B_HEARTS_MAGIC_MINIMAP, + /* 50 */ HUD_VISIBILITY_ALL = 50, + /* 52 */ HUD_VISIBILITY_NONE_INSTANT = 52 +} HudVisibility; + typedef struct SramContext { /* 0x00 */ u8* readBuff; /* 0x04 */ u8 *saveBuf; @@ -251,11 +279,11 @@ typedef struct SaveContext { /* 0x3F16 */ u8 seqIndex; // "old_bgm" /* 0x3F17 */ u8 nightSeqIndex; // "old_env" /* 0x3F18 */ u8 buttonStatus[6]; // "button_item" - /* 0x3F1E */ u8 unk_3F1E; // "ck_fg" - /* 0x3F20 */ u16 unk_3F20; // "alpha_type" - /* 0x3F22 */ u16 unk_3F22; // "prev_alpha_type" - /* 0x3F24 */ u16 unk_3F24; // "alpha_count" - /* 0x3F26 */ u16 unk_3F26; // "last_time_type" + /* 0x3F1E */ u8 hudVisibilityForceButtonAlphasByStatus; // if btn alphas are updated through Interface_UpdateButtonAlphas, instead update them through Interface_UpdateButtonAlphasByStatus "ck_fg" + /* 0x3F20 */ u16 nextHudVisibility; // triggers the hud to change visibility to the requested value. Reset to HUD_VISIBILITY_IDLE when target is reached "alpha_type" + /* 0x3F22 */ u16 hudVisibility; // current hud visibility "prev_alpha_type" + /* 0x3F24 */ u16 hudVisibilityTimer; // number of frames in the transition to a new hud visibility. Used to step alpha "alpha_count" + /* 0x3F26 */ u16 prevHudVisibility; // used to store and recover hud visibility for pause menu and text boxes "last_time_type" /* 0x3F28 */ s16 magicState; // determines magic meter behavior on each frame "magic_flag" /* 0x3F2A */ s16 isMagicRequested; // a request to add magic has been given "recovery_magic_flag" /* 0x3F2C */ s16 magicFlag; // Set to 0 in func_80812D94(), otherwise unused "keep_magic_flag" diff --git a/include/z64scene.h b/include/z64scene.h index 649a4e0110..180405f30b 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -271,7 +271,7 @@ typedef struct { } Room; // size = 0x14 typedef struct { - /* 0x00 */ Room currRoom; + /* 0x00 */ Room curRoom; /* 0x14 */ Room prevRoom; /* 0x28 */ void* roomMemPages[2]; // In a scene with transitions, roomMemory is split between two pages that toggle each transition. This is one continuous range, as the second page allocates from the end /* 0x30 */ u8 activeMemPage; // 0 - First page in memory, 1 - Second page @@ -843,11 +843,11 @@ typedef enum { #define SCENE_CMD_SPECIAL_FILES(elfMessageFile, keepObjectId) \ { SCENE_CMD_ID_SPECIAL_FILES, elfMessageFile, CMD_W(keepObjectId) } -#define SCENE_CMD_ROOM_BEHAVIOR(currRoomUnk3, currRoomUnk2, currRoomUnk5, msgCtxunk12044, enablePosLights, \ +#define SCENE_CMD_ROOM_BEHAVIOR(curRoomUnk3, curRoomUnk2, curRoomUnk5, msgCtxunk12044, enablePosLights, \ kankyoContextUnkE2) \ { \ - SCENE_CMD_ID_ROOM_BEHAVIOR, currRoomUnk3, \ - currRoomUnk2 | _SHIFTL(currRoomUnk5, 8, 1) | _SHIFTL(msgCtxunk12044, 10, 1) | \ + SCENE_CMD_ID_ROOM_BEHAVIOR, curRoomUnk3, \ + curRoomUnk2 | _SHIFTL(curRoomUnk5, 8, 1) | _SHIFTL(msgCtxunk12044, 10, 1) | \ _SHIFTL(enablePosLights, 11, 1) | _SHIFTL(kankyoContextUnkE2, 12, 1) \ } diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 61e4dc807b..0195ac6508 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1336,7 +1336,7 @@ s32 func_800B715C(PlayState* play) { } void Actor_SetCameraHorseSetting(PlayState* play, Player* player) { - if ((play->roomCtx.currRoom.unk3 != 4) && (player->actor.id == ACTOR_PLAYER)) { + if ((play->roomCtx.curRoom.unk3 != 4) && (player->actor.id == ACTOR_PLAYER)) { EnHorse* rideActor = (EnHorse*)player->rideActor; if ((rideActor != NULL) && !(rideActor->unk_1EC & 0x10)) { @@ -2499,7 +2499,7 @@ void Actor_Draw(PlayState* play, Actor* actor) { OPEN_DISPS(play->state.gfxCtx); light = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx); - if ((actor->flags & ACTOR_FLAG_10000000) && (play->roomCtx.currRoom.enablePosLights || (MREG(93) != 0))) { + if ((actor->flags & ACTOR_FLAG_10000000) && (play->roomCtx.curRoom.enablePosLights || (MREG(93) != 0))) { light->enablePosLights = true; } @@ -2669,7 +2669,7 @@ void Actor_DrawLensActors(PlayState* play, s32 numActors, Actor** actors) { gDPSetPrimColor(spAC++, 0, 0, 0, 0, 0, 255); // temp_s1_5 = spAC; - if (play->roomCtx.currRoom.unk5 == 0) { + if (play->roomCtx.curRoom.unk5 == 0) { // temp_s1_5->words.w0 = 0xFC61E6C3; // temp_s1_5->words.w1 = 0x11CF9FCF; // phi_s1 = temp_s1_5 + 8; @@ -2719,7 +2719,7 @@ void Actor_DrawLensActors(PlayState* play, s32 numActors, Actor** actors) { // temp_a0_2 = &spAC; // if (sp34->unk_6E5 == 0) { - if (play->roomCtx.currRoom.unk5 == 0) { + if (play->roomCtx.curRoom.unk5 == 0) { // temp_s1_10->unk_0 = 0xFC119623; // temp_s1_10->unk_4 = 0xFF2FFFFF; // phi_s1_4 = temp_s1_10 + 8; @@ -2882,8 +2882,8 @@ void Actor_DrawAll(PlayState* play, ActorContext* actorCtx) { actor->isDrawn = false; if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & actorFlags)) { if ((actor->flags & ACTOR_FLAG_80) && - ((play->roomCtx.currRoom.unk5 == 0) || (play->actorCtx.lensMaskSize == LENS_MASK_ACTIVE_SIZE) || - (actor->room != play->roomCtx.currRoom.num))) { + ((play->roomCtx.curRoom.unk5 == 0) || (play->actorCtx.lensMaskSize == LENS_MASK_ACTIVE_SIZE) || + (actor->room != play->roomCtx.curRoom.num))) { if (Actor_RecordUndrawnActor(play, actor)) {} } else { Actor_Draw(play, actor); @@ -2960,7 +2960,7 @@ void func_800BA798(PlayState* play, ActorContext* actorCtx) { actor = actorCtx->actorLists[i].first; while (actor != NULL) { - if ((actor->room >= 0) && (actor->room != play->roomCtx.currRoom.num) && + if ((actor->room >= 0) && (actor->room != play->roomCtx.curRoom.num) && (actor->room != play->roomCtx.prevRoom.num)) { if (!actor->isDrawn) { actor = Actor_Delete(actorCtx, actor, play); @@ -3091,9 +3091,9 @@ Actor* Actor_RemoveFromCategory(PlayState* play, ActorContext* actorCtx, Actor* actorToRemove->next = NULL; actorToRemove->prev = NULL; - if ((actorToRemove->room == play->roomCtx.currRoom.num) && (actorToRemove->category == ACTORCAT_ENEMY) && + if ((actorToRemove->room == play->roomCtx.curRoom.num) && (actorToRemove->category == ACTORCAT_ENEMY) && (actorCtx->actorLists[ACTORCAT_ENEMY].length == 0)) { - Flags_SetClearTemp(play, play->roomCtx.currRoom.num); + Flags_SetClearTemp(play, play->roomCtx.curRoom.num); } return newHead; @@ -3180,8 +3180,8 @@ Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s1 } objBankIndex = Object_GetIndex(&play->objectCtx, actorInit->objectId); - if ((objBankIndex < 0) || ((actorInit->type == ACTORCAT_ENEMY) && - Flags_GetClear(play, play->roomCtx.currRoom.num) && (actorInit->id != ACTOR_BOSS_05))) { + if ((objBankIndex < 0) || ((actorInit->type == ACTORCAT_ENEMY) && Flags_GetClear(play, play->roomCtx.curRoom.num) && + (actorInit->id != ACTOR_BOSS_05))) { Actor_FreeOverlay(&gActorOverlayTable[index]); return NULL; } @@ -3219,7 +3219,7 @@ Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s1 actor->parent = parent; parent->child = actor; } else { - actor->room = play->roomCtx.currRoom.num; + actor->room = play->roomCtx.curRoom.num; } actor->home.pos.x = x; @@ -3267,10 +3267,10 @@ void Actor_SpawnTransitionActors(PlayState* play, ActorContext* actorCtx) { for (i = 0; i < numTransitionActors; transitionActorList++, i++) { if (transitionActorList->id >= 0) { if ((transitionActorList->sides[0].room >= 0 && - (play->roomCtx.currRoom.num == transitionActorList->sides[0].room || + (play->roomCtx.curRoom.num == transitionActorList->sides[0].room || play->roomCtx.prevRoom.num == transitionActorList->sides[0].room)) || (transitionActorList->sides[1].room >= 0 && - (play->roomCtx.currRoom.num == transitionActorList->sides[1].room || + (play->roomCtx.curRoom.num == transitionActorList->sides[1].room || play->roomCtx.prevRoom.num == transitionActorList->sides[1].room))) { s16 rotY = ((transitionActorList->rotY >> 7) & 0x1FF) * (0x10000 / 360.0f); diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index e73dd7f6e5..1b8dbfb2ec 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -4404,7 +4404,7 @@ s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f3 for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; curWaterBox++) { room = 0x3F & (curWaterBox->properties >> 13); - if (room == (u32)play->roomCtx.currRoom.num || room == 0x3F) { + if (room == (u32)play->roomCtx.curRoom.num || room == 0x3F) { if (curWaterBox->properties & 0x80000) { continue; } @@ -4489,7 +4489,7 @@ s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, waterBox = &colHeader->waterBoxes[i]; room = WATERBOX_ROOM(waterBox->properties); - if (!(room == play->roomCtx.currRoom.num || room == 0x3F)) { + if (!(room == play->roomCtx.curRoom.num || room == 0x3F)) { continue; } if ((waterBox->properties & 0x80000)) { @@ -4631,7 +4631,7 @@ s32 func_800CA6F0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; curWaterBox++) { room = WATERBOX_ROOM(curWaterBox->properties); - if (room == (u32)play->roomCtx.currRoom.num || room == 0x3F) { + if (room == (u32)play->roomCtx.curRoom.num || room == 0x3F) { if ((curWaterBox->properties & 0x80000) != 0) { if (curWaterBox->minPos.x < x && x < curWaterBox->minPos.x + curWaterBox->xLength) { if (curWaterBox->minPos.z < z && z < curWaterBox->minPos.z + curWaterBox->zLength) { diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index 955f548701..c970282a89 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -16,7 +16,7 @@ void SaveContext_Init(void) { gSaveContext.skyboxTime = 0; gSaveContext.dogIsLost = true; gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT; - gSaveContext.unk_3F26 = 50; + gSaveContext.prevHudVisibility = HUD_VISIBILITY_ALL; gSaveContext.options.language = 1; gSaveContext.options.audioSetting = 0; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 4b571cadde..4453bd6748 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -105,7 +105,7 @@ s32 func_800EA220(PlayState* play, CutsceneContext* csCtx, f32 target) { } void func_800EA258(PlayState* play, CutsceneContext* csCtx) { - Interface_ChangeAlpha(1); + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); ShrinkWindow_SetLetterboxTarget(32); if (func_800EA220(play, csCtx, 1.0f)) { Audio_SetCutsceneFlag(true); @@ -115,7 +115,7 @@ void func_800EA258(PlayState* play, CutsceneContext* csCtx) { void func_800EA2B8(PlayState* play, CutsceneContext* csCtx) { func_800ED980(play, csCtx); - Interface_ChangeAlpha(1); + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); ShrinkWindow_SetLetterboxTarget(32); if (func_800EA220(play, csCtx, 1.0f)) { Audio_SetCutsceneFlag(true); @@ -215,7 +215,7 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c D_801F6D30.a = 255 * progress; break; case 0xC: - play->roomCtx.currRoom.segment = NULL; + play->roomCtx.curRoom.segment = NULL; break; case 0xD: if (play->state.frames & 8) { @@ -561,7 +561,7 @@ void Cutscene_TerminatorImpl(PlayState* play, CutsceneContext* csCtx, CsCmdBase* gSaveContext.cutsceneTransitionControl = 1; if ((gSaveContext.gameMode != 0) && (csCtx->frames != cmd->startFrame)) { - gSaveContext.unk_3F1E = 1; + gSaveContext.hudVisibilityForceButtonAlphasByStatus = true; } gSaveContext.save.cutscene = 0; @@ -1078,7 +1078,7 @@ void Cutscene_Command_Textbox(PlayState* play, CutsceneContext* csCtx, CsCmdText } if (originalCsFrames == csCtx->frames) { - Interface_ChangeAlpha(1); + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); D_801BB124 = 0; D_801BB128 = 0; func_80161C0C(); @@ -1451,7 +1451,7 @@ void func_800EDA84(PlayState* play, CutsceneContext* csCtx) { csCtx->unk_18 = 0xFFFF; if (gSaveContext.cutsceneTrigger == 0) { - Interface_ChangeAlpha(1); + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); ShrinkWindow_SetLetterboxTarget(32); ShrinkWindow_SetLetterboxMagnitude(0x20); csCtx->state++; diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index dcbe71a1c2..394a106006 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -57,10 +57,10 @@ void GameOver_Update(PlayState* play) { gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_ENABLED; gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_ENABLED; gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED; - gSaveContext.unk_3F1E = 0; - gSaveContext.unk_3F20 = 0; - gSaveContext.unk_3F22 = 0; - gSaveContext.unk_3F24 = 0; + gSaveContext.hudVisibilityForceButtonAlphasByStatus = false; + gSaveContext.nextHudVisibility = HUD_VISIBILITY_IDLE; + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + gSaveContext.hudVisibilityTimer = 0; Kankyo_InitGameOverLights(play); sGameOverTimer = 20; Rumble_Request(0.0f, 126, 124, 63); diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 50022849e3..1135f2de97 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -81,7 +81,7 @@ void KaleidoSetup_Update(PlayState* play) { if (!(play->actorCtx.flags & ACTORCTX_FLAG_1) && !(play->actorCtx.flags & ACTORCTX_FLAG_2)) { if ((play->actorCtx.unk268 == 0) && CHECK_BTN_ALL(input->press.button, BTN_START)) { - gSaveContext.unk_3F26 = gSaveContext.unk_3F22; + gSaveContext.prevHudVisibility = gSaveContext.hudVisibility; pauseCtx->itemDescriptionOn = false; pauseCtx->state = 1; func_800F4A10(play); diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index 5135a3c410..40ffb42132 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -177,7 +177,7 @@ void Map_Init(PlayState* play) { InterfaceContext* interfaceCtx = &play->interfaceCtx; s32 dungeonIndex; - func_80105C40(play->roomCtx.currRoom.num); + func_80105C40(play->roomCtx.curRoom.num); interfaceCtx->unk_278 = -1; interfaceCtx->dungeonOrBossAreaMapIndex = -1; interfaceCtx->mapSegment = THA_AllocEndAlign16(&play->state.heap, 0x1000); @@ -208,7 +208,7 @@ void Map_Init(PlayState* play) { } gSaveContext.dungeonIndex = dungeonIndex; - Map_InitRoomData(play, play->roomCtx.currRoom.num); + Map_InitRoomData(play, play->roomCtx.curRoom.num); } } diff --git a/src/code/z_message.c b/src/code/z_message.c index f98d3cf3a4..4b4ac82a51 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -360,7 +360,7 @@ void func_80151A68(PlayState* play, u16 textId) { XREG(77) = 0x3C; XREG(76) = 0x1C; msgCtx->unk11F1A[0] = msgCtx->unk11F1A[1] = msgCtx->unk11F1A[2] = 0; - Interface_ChangeAlpha(1); + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); } } diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 403a69c517..679b8abf48 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -281,13 +281,770 @@ void func_8010EBA0(s16 timer, s16 timerId); #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010EE74.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_ChangeAlpha.s") +void Interface_SetHudVisibility(u16 hudVisibility) { + if (gSaveContext.hudVisibility != hudVisibility) { + gSaveContext.hudVisibility = hudVisibility; + gSaveContext.nextHudVisibility = hudVisibility; + gSaveContext.hudVisibilityTimer = 1; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010EF9C.s") +/** + * Sets the button alphas to be dimmed for disabled buttons, or to the requested alpha for non-disabled buttons + */ +void Interface_UpdateButtonAlphasByStatus(PlayState* play, s16 risingAlpha) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010F0D4.s") + if ((gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) || (gSaveContext.unk_1015 == ITEM_NONE)) { + if (interfaceCtx->bAlpha != 70) { + interfaceCtx->bAlpha = 70; + } + } else { + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010F1A8.s") + if (gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] == BTN_DISABLED) { + if (interfaceCtx->cLeftAlpha != 70) { + interfaceCtx->cLeftAlpha = 70; + } + } else { + if (interfaceCtx->cLeftAlpha != 255) { + interfaceCtx->cLeftAlpha = risingAlpha; + } + } + + if (gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] == BTN_DISABLED) { + if (interfaceCtx->cDownAlpha != 70) { + interfaceCtx->cDownAlpha = 70; + } + } else { + if (interfaceCtx->cDownAlpha != 255) { + interfaceCtx->cDownAlpha = risingAlpha; + } + } + + if (gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] == BTN_DISABLED) { + if (interfaceCtx->cRightAlpha != 70) { + interfaceCtx->cRightAlpha = 70; + } + } else { + if (interfaceCtx->cRightAlpha != 255) { + interfaceCtx->cRightAlpha = risingAlpha; + } + } + + if (gSaveContext.buttonStatus[EQUIP_SLOT_A] == BTN_DISABLED) { + if (interfaceCtx->aAlpha != 70) { + interfaceCtx->aAlpha = 70; + } + } else { + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + } +} + +/** + * Lower button alphas on the HUD to the requested value + * If (gSaveContext.hudVisibilityForceButtonAlphasByStatus), then instead update button alphas + * depending on button status + */ +void Interface_UpdateButtonAlphas(PlayState* play, s16 dimmingAlpha, s16 risingAlpha) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + + if (gSaveContext.hudVisibilityForceButtonAlphasByStatus) { + Interface_UpdateButtonAlphasByStatus(play, risingAlpha); + return; + } + + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; + } + + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } +} + +void Interface_UpdateHudAlphas(PlayState* play, s16 dimmingAlpha) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + s16 risingAlpha = 255 - dimmingAlpha; + + switch (gSaveContext.nextHudVisibility) { + case HUD_VISIBILITY_NONE: + case HUD_VISIBILITY_NONE_ALT: + case HUD_VISIBILITY_B: + if (gSaveContext.nextHudVisibility == HUD_VISIBILITY_B) { + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + } else { + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; + } + } + + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; + } + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + break; + + case HUD_VISIBILITY_HEARTS_WITH_OVERWRITE: + // aAlpha is immediately overwritten in Interface_UpdateButtonAlphas + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + Interface_UpdateButtonAlphas(play, dimmingAlpha, risingAlpha + 0); + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_A: + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; + } + + // aAlpha is immediately overwritten below + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; + } + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_A_HEARTS_MAGIC_WITH_OVERWRITE: + Interface_UpdateButtonAlphas(play, dimmingAlpha, risingAlpha); + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + // aAlpha overwrites the value set in Interface_UpdateButtonAlphas + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_WITH_OVERWRITE: + Interface_UpdateButtonAlphas(play, dimmingAlpha, risingAlpha); + + // aAlpha overwrites the value set in Interface_UpdateButtonAlphas + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + if (play->sceneNum == SCENE_SPOT00) { + if (interfaceCtx->minimapAlpha < 170) { + interfaceCtx->minimapAlpha = risingAlpha; + } else { + interfaceCtx->minimapAlpha = 170; + } + } else if (interfaceCtx->minimapAlpha != 255) { + interfaceCtx->minimapAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_ALL_NO_MINIMAP_W_DISABLED: + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + Interface_UpdateButtonAlphasByStatus(play, risingAlpha); + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_HEARTS_MAGIC: + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; + } + + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_B_ALT: + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; + } + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_HEARTS: + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; + } + + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_A_B_MINIMAP: + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + if ((gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) || (gSaveContext.unk_1015 == ITEM_NONE)) { + if (interfaceCtx->bAlpha != 70) { + interfaceCtx->bAlpha = 70; + } + } else { + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + } + + if (interfaceCtx->minimapAlpha != 255) { + interfaceCtx->minimapAlpha = risingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; + } + + break; + + case HUD_VISIBILITY_HEARTS_MAGIC_WITH_OVERWRITE: + Interface_UpdateButtonAlphas(play, dimmingAlpha, risingAlpha); + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + // aAlpha overwrites the value set in Interface_UpdateButtonAlphas + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_HEARTS_MAGIC_C: + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; + } + + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if (interfaceCtx->cLeftAlpha != 255) { + interfaceCtx->cLeftAlpha = risingAlpha; + } + + if (interfaceCtx->cDownAlpha != 255) { + interfaceCtx->cDownAlpha = risingAlpha; + } + + if (interfaceCtx->cRightAlpha != 255) { + interfaceCtx->cRightAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_ALL_NO_MINIMAP: + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + if (interfaceCtx->cLeftAlpha != 255) { + interfaceCtx->cLeftAlpha = risingAlpha; + } + + if (interfaceCtx->cDownAlpha != 255) { + interfaceCtx->cDownAlpha = risingAlpha; + } + + if (interfaceCtx->cRightAlpha != 255) { + interfaceCtx->cRightAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_A_B_C: + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; + } + + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + if (interfaceCtx->cLeftAlpha != 255) { + interfaceCtx->cLeftAlpha = risingAlpha; + } + + if (interfaceCtx->cDownAlpha != 255) { + interfaceCtx->cDownAlpha = risingAlpha; + } + + if (interfaceCtx->cRightAlpha != 255) { + interfaceCtx->cRightAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_B_MINIMAP: + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; + } + + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + + if (interfaceCtx->minimapAlpha != 255) { + interfaceCtx->minimapAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_HEARTS_MAGIC_MINIMAP: + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; + } + + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + if (interfaceCtx->minimapAlpha != 255) { + interfaceCtx->minimapAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP: + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + if (interfaceCtx->minimapAlpha != 255) { + interfaceCtx->minimapAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_B_MAGIC: + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; + } + + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_A_B: + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; + } + + break; + + case HUD_VISIBILITY_A_B_HEARTS_MAGIC_MINIMAP: + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + if (interfaceCtx->minimapAlpha != 255) { + interfaceCtx->minimapAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + break; + } + + if ((play->roomCtx.curRoom.unk3 == 1) && (interfaceCtx->minimapAlpha >= 255)) { + interfaceCtx->minimapAlpha = 255; + } +} #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80110038.s") diff --git a/src/code/z_play.c b/src/code/z_play.c index 346f346922..5a60a615e2 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -377,7 +377,7 @@ void Play_SetupRespawnPoint(GameState* thisx, s32 respawnMode, s32 playerParams) if (this->sceneNum != SCENE_KAKUSIANA) { // Grottos Play_SetRespawnData(&this->state, respawnMode, (u16)((void)0, gSaveContext.save.entrance), - this->roomCtx.currRoom.num, playerParams, &player->actor.world.pos, + this->roomCtx.curRoom.num, playerParams, &player->actor.world.pos, player->actor.shape.rot.y); } } @@ -427,7 +427,7 @@ void func_80169FDC(GameState* thisx) { s32 func_80169FFC(GameState* thisx) { PlayState* this = (PlayState*)thisx; - return this->roomCtx.currRoom.mesh->type0.type != 1; + return this->roomCtx.curRoom.mesh->type0.type != 1; } s32 FrameAdvance_IsEnabled(GameState* thisx) { diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 8ced31cb77..c8d1c802f3 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -389,7 +389,7 @@ void func_80123140(PlayState* play, Player* player) { IREG(69) = bootRegs[16]; MREG(95) = bootRegs[17]; - if (play->roomCtx.currRoom.unk3 == 2) { + if (play->roomCtx.curRoom.unk3 == 2) { R_RUN_SPEED_LIMIT = 500; } @@ -508,20 +508,23 @@ s32 func_8012364C(PlayState* play, Player* player, s32 arg2) { if (arg2 == 1) { return (gSaveContext.buttonStatus[1] != BTN_DISABLED) ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_LEFT] - : (gSaveContext.unk_3F22 == 0x10) ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_LEFT] - : ITEM_NONE; + : (gSaveContext.hudVisibility == HUD_VISIBILITY_A_B_C) + ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_LEFT] + : ITEM_NONE; } if (arg2 == 2) { return (gSaveContext.buttonStatus[2] != BTN_DISABLED) ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_DOWN] - : (gSaveContext.unk_3F22 == 0x10) ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_DOWN] - : ITEM_NONE; + : (gSaveContext.hudVisibility == HUD_VISIBILITY_A_B_C) + ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_DOWN] + : ITEM_NONE; } return (gSaveContext.buttonStatus[3] != BTN_DISABLED) ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_RIGHT] - : (gSaveContext.unk_3F22 == 0x10) ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_RIGHT] - : ITEM_NONE; + : (gSaveContext.hudVisibility == HUD_VISIBILITY_A_B_C) + ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_RIGHT] + : ITEM_NONE; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80123810.s") @@ -865,7 +868,7 @@ s32 func_801242DC(PlayState* play) { TextTriggerEntry* triggerEntry; s32 envIndex; - if (play->roomCtx.currRoom.unk2 == 3) { // Room is hot + if (play->roomCtx.curRoom.unk2 == 3) { // Room is hot envIndex = 0; } else if ((player->transformation != PLAYER_FORM_ZORA) && (player->unk_AD8 > 80)) { envIndex = 3; diff --git a/src/code/z_room.c b/src/code/z_room.c index 169d6d5b5a..e0c2a035d9 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -64,8 +64,8 @@ void Room_DrawType1Mesh(PlayState* play, Room* room, u32 flags) { void Room_Init(PlayState* play, RoomContext* roomCtx) { s32 i; - roomCtx->currRoom.num = -1; - roomCtx->currRoom.segment = NULL; + roomCtx->curRoom.num = -1; + roomCtx->curRoom.segment = NULL; roomCtx->unk78 = 1; roomCtx->unk79 = 0; for (i = 0; i < 3; i++) { @@ -79,9 +79,9 @@ s32 Room_StartRoomTransition(PlayState* play, RoomContext* roomCtx, s32 index) { if (roomCtx->unk31 == 0) { s32 size; - roomCtx->prevRoom = roomCtx->currRoom; - roomCtx->currRoom.num = index; - roomCtx->currRoom.segment = NULL; + roomCtx->prevRoom = roomCtx->curRoom; + roomCtx->curRoom.num = index; + roomCtx->curRoom.segment = NULL; roomCtx->unk31 = 1; size = play->roomList[index].vromEnd - play->roomList[index].vromStart; @@ -103,15 +103,15 @@ s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) { if (roomCtx->unk31 == 1) { if (!osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK)) { roomCtx->unk31 = 0; - roomCtx->currRoom.segment = roomCtx->activeRoomVram; + roomCtx->curRoom.segment = roomCtx->activeRoomVram; // TODO: Segment number enum gSegments[0x03] = PHYSICAL_TO_VIRTUAL(roomCtx->activeRoomVram); - Scene_ProcessHeader(play, (SceneCmd*)roomCtx->currRoom.segment); + Scene_ProcessHeader(play, (SceneCmd*)roomCtx->curRoom.segment); func_80123140(play, GET_PLAYER(play)); Actor_SpawnTransitionActors(play, &play->actorCtx); - if (((play->sceneNum != SCENE_IKANA) || (roomCtx->currRoom.num != 1)) && + if (((play->sceneNum != SCENE_IKANA) || (roomCtx->curRoom.num != 1)) && (play->sceneNum != SCENE_IKNINSIDE)) { play->envCtx.lightSettingOverride = 0xFF; play->envCtx.unk_E0 = 0; @@ -142,9 +142,9 @@ void func_8012EBF8(PlayState* play, RoomContext* roomCtx) { roomCtx->prevRoom.segment = NULL; func_800BA798(play, &play->actorCtx); Actor_SpawnTransitionActors(play, &play->actorCtx); - if (roomCtx->currRoom.num > -1) { - Map_InitRoomData(play, roomCtx->currRoom.num); + if (roomCtx->curRoom.num > -1) { + Map_InitRoomData(play, roomCtx->curRoom.num); Minimap_SavePlayerRoomInitInfo(play); } - func_801A3CD8(play->roomCtx.currRoom.echo); + func_801A3CD8(play->roomCtx.curRoom.echo); } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index da05eac2b8..75616e8a50 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -234,17 +234,17 @@ void Scene_HeaderCmdSpecialFiles(PlayState* play, SceneCmd* cmd) { // SceneTableEntry Header Command 0x08: Room Behavior void Scene_HeaderCmdRoomBehavior(PlayState* play, SceneCmd* cmd) { - play->roomCtx.currRoom.unk3 = cmd->roomBehavior.gpFlag1; - play->roomCtx.currRoom.unk2 = cmd->roomBehavior.gpFlag2 & 0xFF; - play->roomCtx.currRoom.unk5 = (cmd->roomBehavior.gpFlag2 >> 8) & 1; + play->roomCtx.curRoom.unk3 = cmd->roomBehavior.gpFlag1; + play->roomCtx.curRoom.unk2 = cmd->roomBehavior.gpFlag2 & 0xFF; + play->roomCtx.curRoom.unk5 = (cmd->roomBehavior.gpFlag2 >> 8) & 1; play->msgCtx.unk12044 = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1; - play->roomCtx.currRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xB) & 1; + play->roomCtx.curRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xB) & 1; play->envCtx.unk_E2 = (cmd->roomBehavior.gpFlag2 >> 0xC) & 1; } // SceneTableEntry Header Command 0x0A: Mesh Header void Scene_HeaderCmdMesh(PlayState* play, SceneCmd* cmd) { - play->roomCtx.currRoom.mesh = Lib_SegmentedToVirtual(cmd->mesh.segment); + play->roomCtx.curRoom.mesh = Lib_SegmentedToVirtual(cmd->mesh.segment); } // SceneTableEntry Header Command 0x0B: Object List @@ -446,7 +446,7 @@ void Scene_HeaderCmdSoundSettings(PlayState* play, SceneCmd* cmd) { // SceneTableEntry Header Command 0x16: Echo Setting void Scene_HeaderCmdEchoSetting(PlayState* play, SceneCmd* cmd) { - play->roomCtx.currRoom.echo = cmd->echoSettings.echo; + play->roomCtx.curRoom.echo = cmd->echoSettings.echo; } // SceneTableEntry Header Command 0x18: Alternate Header List= diff --git a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c index 53a3300d4e..8e0c025e28 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c @@ -340,14 +340,14 @@ void func_80A2A1E0(BgDblueMovebg* this, PlayState* play) { Math_StepToS(&this->unk_1CC, this->unk_1CE, 12); this->dyna.actor.shape.rot.y += this->unk_1CC; - if (play->roomCtx.currRoom.num == 0) { + if (play->roomCtx.curRoom.num == 0) { this->opaDList = gGreatBayTempleObjectGearShaftWithPlatformsDL; - } else if (play->roomCtx.currRoom.num == 8) { + } else if (play->roomCtx.curRoom.num == 8) { this->opaDList = NULL; } - if (play->roomCtx.currRoom.num != this->unk_170) { - if (play->roomCtx.currRoom.num != this->unk_171) { + if (play->roomCtx.curRoom.num != this->unk_170) { + if (play->roomCtx.curRoom.num != this->unk_171) { if ((play->roomCtx.prevRoom.num != this->unk_170) && (play->roomCtx.prevRoom.num != this->unk_171)) { D_80A2BBF4.unk_01 = 0; Actor_MarkForDeath(&this->dyna.actor); @@ -628,8 +628,8 @@ void func_80A2AED0(BgDblueMovebg* this, PlayState* play) { s32 pad; s32 temp_v0_3; - if (play->roomCtx.currRoom.num != this->unk_170) { - if (play->roomCtx.currRoom.num != this->unk_171) { + if (play->roomCtx.curRoom.num != this->unk_170) { + if (play->roomCtx.curRoom.num != this->unk_171) { if ((play->roomCtx.prevRoom.num != this->unk_170) && (play->roomCtx.prevRoom.num != this->unk_171)) { D_80A2BBF4.unk_00 = 0; Actor_MarkForDeath(&this->dyna.actor); @@ -669,7 +669,7 @@ void func_80A2AED0(BgDblueMovebg* this, PlayState* play) { this->dyna.actor.shape.rot.x += this->unk_1CC; if (this->unk_160 == 8) { - if (play->roomCtx.currRoom.num == 8) { + if (play->roomCtx.curRoom.num == 8) { func_80A2ABD0(this, play); this->unk_172 |= 0x20; } else { @@ -677,9 +677,9 @@ void func_80A2AED0(BgDblueMovebg* this, PlayState* play) { } } - if (play->roomCtx.currRoom.num == 0) { + if (play->roomCtx.curRoom.num == 0) { this->opaDList = gGreatBayTempleObjectWaterwheelDL; - } else if (play->roomCtx.currRoom.num == 8) { + } else if (play->roomCtx.curRoom.num == 8) { this->opaDList = gGreatBayTempleObjectWaterwheelWithFakeGearDL; } diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index e7d96d205e..ca8ad214f5 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -155,7 +155,7 @@ void Boss04_Init(Actor* thisx, PlayState* play2) { s16 phi_s0_2; s32 pad; - if (Flags_GetClear(play, play->roomCtx.currRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_MarkForDeath(&this->actor); return; } diff --git a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c index 177c5784dc..87b1e52b90 100644 --- a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c +++ b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c @@ -915,7 +915,7 @@ void DmChar00_Draw(Actor* thisx, PlayState* play2) { Gfx* gfx = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Gfx) * 4); if ((play->csCtx.state == 0) && ((play->sceneNum != SCENE_OPENINGDAN) || (gSaveContext.sceneSetupIndex != 0) || - (play->roomCtx.currRoom.num != 0) || (play->csCtx.currentCsIndex != 1) || + (play->roomCtx.curRoom.num != 0) || (play->csCtx.currentCsIndex != 1) || (DMCHAR00_GET(&this->actor) != DMCHAR00_0))) { return; } diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index b5f75efaac..4aa36cfdda 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -553,9 +553,9 @@ void func_808A1884(DoorShutter* this, PlayState* play) { play->doorCtx.transitionActorList[DOORSHUTTER_GET_FC00(&this->actor)].sides[(sp44.z < 0.0f) ? 0 : 1].room; if (room != this->actor.room) { - Room temp = play->roomCtx.currRoom; + Room temp = play->roomCtx.curRoom; - play->roomCtx.currRoom = play->roomCtx.prevRoom; + play->roomCtx.curRoom = play->roomCtx.prevRoom; play->roomCtx.prevRoom = temp; play->roomCtx.activeMemPage ^= 1; } diff --git a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c index f43f7c58cd..93cd492e6e 100644 --- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c +++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c @@ -116,7 +116,7 @@ s32 DoorSpiral_SetSpiralType(DoorSpiral* this, PlayState* play) { this->spiralType = doorObjectInfo->spiralType; if ((this->spiralType == SPIRAL_DAMPES_HOUSE) || - ((this->spiralType == SPIRAL_WOODFALL_TEMPLE) && play->roomCtx.currRoom.enablePosLights)) { + ((this->spiralType == SPIRAL_WOODFALL_TEMPLE) && play->roomCtx.curRoom.enablePosLights)) { if (this->spiralType == SPIRAL_WOODFALL_TEMPLE) { this->spiralType = SPIRAL_WOODFALL_TEMPLE_ALT; } diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index ca3e1a9fd9..ba1c846b9a 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -598,7 +598,7 @@ void func_808B9F10(DoorWarp1* this, PlayState* play) { if ((this->unk_203 == 0) && func_808B866C(this, play) && !Play_InCsMode(play) && (this->unk_203 == 0)) { Player* player = GET_PLAYER(play); - Interface_ChangeAlpha(1); + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); func_800B7298(play, &this->dyna.actor, 9); player->unk_3A0.x = this->dyna.actor.world.pos.x; player->unk_3A0.z = this->dyna.actor.world.pos.z; @@ -871,7 +871,7 @@ void func_808BA550(DoorWarp1* this, PlayState* play) { play->envCtx.lightSettings.fogNear = -500.0f * temp_f0; if (play->envCtx.lightSettings.fogNear < -300) { - play->roomCtx.currRoom.segment = NULL; + play->roomCtx.curRoom.segment = NULL; } } } diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index 392f9a441f..6cc0b2e72b 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -339,7 +339,7 @@ void EnBigslime_Init(Actor* thisx, PlayState* play2) { this->gekkoCollider.base.ocFlags1 &= ~OC1_NO_PUSH; this->actor.params = CLAMP(this->actor.params, 1, 4); - if (Flags_GetClear(play, play->roomCtx.currRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_MarkForDeath(&this->actor); if (!(gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->actor.params - 1] >> 8] & (u8)isFrogReturnedFlags[this->actor.params - 1])) { @@ -2497,7 +2497,7 @@ void EnBigslime_Despawn(EnBigslime* this, PlayState* play) { } if (!this->isDespawned) { - Flags_SetClearTemp(play, play->roomCtx.currRoom.num); + Flags_SetClearTemp(play, play->roomCtx.curRoom.num); this->isDespawned = true; } diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 5d5b01ee8b..d4fe409cd7 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -301,7 +301,7 @@ void func_80871058(EnBom* this, PlayState* play) { void func_808714D4(EnBom* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { this->actionFunc = func_80871058; - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; this->actor.flags &= ~ACTOR_FLAG_100000; this->actor.bgCheckFlags &= ~1; Math_Vec3s_ToVec3f(&this->actor.prevPos, &this->actor.home.rot); diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index 2aabec27f2..8bd1b7e0ec 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -5166,7 +5166,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { sSubCamAt.y = mainCam->at.y; sSubCamAt.z = mainCam->at.z; D_8090CD4C = 2; - Interface_ChangeAlpha(12); + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); sSubCamVelFactor = 0.0f; // fallthrough case 2: diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c index 07de01c120..45206159e2 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -393,7 +393,7 @@ void EnFsn_EndInteraction(EnFsn* this, PlayState* play) { Actor_ProcessTalkRequest(&this->actor, &play->state); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -1157,7 +1157,7 @@ void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, PlayState* play) { Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; item = this->items[this->cursorIndex]; diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 6b0a7e3b96..66f57f323a 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -820,7 +820,7 @@ void func_8096326C(EnFu* this, PlayState* play) { void func_809632D0(EnFu* this) { if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); } gSaveContext.save.weekEventReg[8] &= (u8)~1; diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c index 17bec0df61..a82434c21d 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c @@ -806,11 +806,11 @@ void func_80B110F8(EnGb2* this, PlayState* play) { void func_80B111AC(EnGb2* this, PlayState* play) { s32 index; - if (play->roomCtx.currRoom.num == 1) { + if (play->roomCtx.curRoom.num == 1) { return; } - switch (play->roomCtx.currRoom.num) { + switch (play->roomCtx.curRoom.num) { case 2: index = 1; break; @@ -837,7 +837,7 @@ void func_80B111AC(EnGb2* this, PlayState* play) { } void func_80B11268(EnGb2* this, PlayState* play) { - if (play->roomCtx.currRoom.num == 1) { + if (play->roomCtx.curRoom.num == 1) { this->unk_290 = 0; this->unk_282[0] = this->actor.cutscene; if (Flags_GetClear(play, 2) && Flags_GetClear(play, 3) && Flags_GetClear(play, 4) && Flags_GetClear(play, 5)) { diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index 3faf24a1c2..6e36d11306 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -328,8 +328,8 @@ s32 func_8094E054(EnGm* this, PlayState* play, s32 arg2) { s32 func_8094E0F8(EnGm* this, PlayState* play) { s32 ret = false; - if ((this->unk_260 != play->roomCtx.currRoom.num) && (play->roomCtx.unk31 == 0)) { - this->unk_260 = play->roomCtx.currRoom.num; + if ((this->unk_260 != play->roomCtx.curRoom.num) && (play->roomCtx.unk31 == 0)) { + this->unk_260 = play->roomCtx.curRoom.num; this->unk_262 = SubS_GetObjectIndex(OBJECT_IN2, play); this->actor.draw = NULL; this->unk_3FC = 1; diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index 3579f23cc7..7aa060a961 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -138,9 +138,9 @@ void EnHoll_Destroy(Actor* thisx, PlayState* play) { } void EnHoll_ChangeRooms(PlayState* play) { - Room tempRoom = play->roomCtx.currRoom; + Room tempRoom = play->roomCtx.curRoom; - play->roomCtx.currRoom = play->roomCtx.prevRoom; + play->roomCtx.curRoom = play->roomCtx.prevRoom; play->roomCtx.prevRoom = tempRoom; play->roomCtx.activeMemPage ^= 1; } @@ -204,7 +204,7 @@ void EnHoll_VisibleIdle(EnHoll* this, PlayState* play) { s32 unclampedAlpha = EN_HOLL_SCALE_ALPHA(playerDistFromCentralPlane); this->alpha = CLAMP(unclampedAlpha, 0, 255); - if (play->roomCtx.currRoom.num != this->actor.room) { + if (play->roomCtx.curRoom.num != this->actor.room) { EnHoll_ChangeRooms(play); } } @@ -239,7 +239,7 @@ void EnHoll_TransparentIdle(EnHoll* this, PlayState* play) { this->actor.room = room; - if ((this->actor.room != play->roomCtx.currRoom.num) && + if ((this->actor.room != play->roomCtx.curRoom.num) && Room_StartRoomTransition(play, &play->roomCtx, this->actor.room)) { this->actionFunc = EnHoll_RoomTransitionIdle; } @@ -264,7 +264,7 @@ void EnHoll_VerticalBgCoverIdle(EnHoll* this, PlayState* play) { this->actor.room = play->doorCtx.transitionActorList[enHollId].sides[playerSide].room; - if ((this->actor.room != play->roomCtx.currRoom.num) && + if ((this->actor.room != play->roomCtx.curRoom.num) && Room_StartRoomTransition(play, &play->roomCtx, this->actor.room)) { this->actionFunc = EnHoll_RoomTransitionIdle; this->bgCoverAlphaActive = true; @@ -287,7 +287,7 @@ void EnHoll_VerticalIdle(EnHoll* this, PlayState* play) { s32 playerSide = (this->actor.playerHeightRel > 0.0f) ? EN_HOLL_ABOVE : EN_HOLL_BELOW; this->actor.room = play->doorCtx.transitionActorList[enHollId].sides[playerSide].room; - if ((this->actor.room != play->roomCtx.currRoom.num) && + if ((this->actor.room != play->roomCtx.curRoom.num) && Room_StartRoomTransition(play, &play->roomCtx, this->actor.room)) { this->actionFunc = EnHoll_RoomTransitionIdle; } diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index b44d1bb29d..26c5bbbbc5 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -532,7 +532,7 @@ void func_8095E95C(EnIshi* this, PlayState* play) { s32 sp2C; if (Actor_HasNoParent(&this->actor, play)) { - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; if (ENISHI_GET_1(&this->actor) == 1) { Flags_SetSwitch(play, ENISHI_GET_FE00(&this->actor)); } diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index dc3ecc56ce..a737c5008c 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -510,7 +510,7 @@ void EnKusa_LiftedUp(EnKusa* this, PlayState* play) { s32 bgId; if (Actor_HasNoParent(&this->actor, play)) { - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; EnKusa_SetupFall(this); this->actor.velocity.x = this->actor.speedXZ * Math_SinS(this->actor.world.rot.y); this->actor.velocity.z = this->actor.speedXZ * Math_CosS(this->actor.world.rot.y); @@ -683,7 +683,7 @@ void EnKusa_Update(Actor* thisx, PlayState* play2) { } else { this->actor.shape.yOffset = 0.0f; } - if ((kusaGameplayFrames != play->gameplayFrames) && (play->roomCtx.currRoom.unk3 == 0)) { + if ((kusaGameplayFrames != play->gameplayFrames) && (play->roomCtx.curRoom.unk3 == 0)) { EnKusa_Sway(); kusaGameplayFrames = play->gameplayFrames; } @@ -695,7 +695,7 @@ void EnKusa_DrawBush(Actor* thisx, PlayState* play2) { if ((this->actor.projectedPos.z <= 1200.0f) || ((this->isInWater & 1) && (this->actor.projectedPos.z < 1300.0f))) { - if ((play->roomCtx.currRoom.unk3 == 0) && (this->actionFunc == EnKusa_WaitForInteract) && + if ((play->roomCtx.curRoom.unk3 == 0) && (this->actionFunc == EnKusa_WaitForInteract) && (this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { EnKusa_ApplySway(&D_80936AD8[this->kusaMtxIdx]); } @@ -724,7 +724,7 @@ void EnKusa_DrawGrass(Actor* thisx, PlayState* play) { if (this->isCut) { Gfx_DrawDListOpa(play, gKusaStump); } else { - if ((play->roomCtx.currRoom.unk3 == 0) && (this->actionFunc == EnKusa_WaitForInteract)) { + if ((play->roomCtx.curRoom.unk3 == 0) && (this->actionFunc == EnKusa_WaitForInteract)) { if ((this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { EnKusa_ApplySway(&D_80936AD8[this->kusaMtxIdx]); } diff --git a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c index 435d319727..4ed5b82a04 100644 --- a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c +++ b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c @@ -1033,7 +1033,7 @@ void func_80A5D9C8(EnKusa2* this, PlayState* play) { D_80A5EAFC.z = Math_SinS(D_80A5EB04.z) * 1000.0f; if (Actor_HasNoParent(&this->actor, play)) { - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; this->actor.colChkInfo.mass = 80; this->actor.home.rot.y = this->actor.world.rot.y; this->actor.velocity.y = 12.5f; @@ -1289,7 +1289,7 @@ void func_80A5E604(Actor* thisx, PlayState* play) { } else { this->actor.draw = func_80A5E6F0; - if (play->roomCtx.currRoom.unk3 == 0) { + if (play->roomCtx.curRoom.unk3 == 0) { func_80A5B508(); } func_80A5CAF4(&D_80A5F1C0); @@ -1352,7 +1352,7 @@ void EnKusa2_Draw(Actor* thisx, PlayState* play) { EnKusa2* this = THIS; if (this->actor.projectedPos.z <= 1200.0f) { - if ((play->roomCtx.currRoom.unk3 == 0) && (this->actor.projectedPos.z > -150.0f) && + if ((play->roomCtx.curRoom.unk3 == 0) && (this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { func_80A5B954(&D_80A60908[this->unk_1CE], 0.0015f); } 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 f71a256219..da72fc3088 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -135,7 +135,7 @@ void EnMag_Init(Actor* thisx, PlayState* play) { this->unk11F02 = 30; this->unk11F00 = this->state = MAG_STATE_INITIAL; - if (gSaveContext.unk_3F1E != 0) { + if (gSaveContext.hudVisibilityForceButtonAlphasByStatus) { this->mainTitleAlpha = 210; this->unk11F32 = 255; this->copyrightAlpha = 255; @@ -158,7 +158,7 @@ void EnMag_Init(Actor* thisx, PlayState* play) { this->displayEffectEnvColor[1] = 255; this->displayEffectEnvColor[2] = 155; - gSaveContext.unk_3F1E = 0; + gSaveContext.hudVisibilityForceButtonAlphasByStatus = false; this->state = MAG_STATE_FADE_IN_MASK; sInputDelayTimer = 20; gSaveContext.transFadeDuration = 1; diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index c24bf76010..8e2c5260bb 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -185,7 +185,7 @@ void func_80965DB4(EnMm* this, PlayState* play) { void func_8096611C(EnMm* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { EnMm_SetupAction(this, func_80965DB4); - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; this->actor.bgCheckFlags &= ~1; Math_Vec3s_ToVec3f(&this->actor.prevPos, &this->actor.home.rot); gSaveContext.unk_1014 = 0; 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 ef46c5e816..618a30986c 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -302,7 +302,7 @@ void EnOssan_EndInteraction(PlayState* play, EnOssan* this) { Actor_ProcessTalkRequest(&this->actor, &play->state); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -985,7 +985,7 @@ void EnOssan_SetupBuyItemWithFanfare(PlayState* play, EnOssan* this) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~0x20000000; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; EnOssan_SetupAction(this, EnOssan_BuyItemWithFanfare); } diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index 2ff9d814e0..b1b3d9cbc9 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -190,7 +190,7 @@ void EnPametfrog_Init(Actor* thisx, PlayState* play) { GEKKO_LIMB_MAX); Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colElement); this->params = CLAMP(this->actor.params, 1, 4); - if (Flags_GetClear(play, play->roomCtx.currRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_MarkForDeath(&this->actor); if (!(gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->actor.params - 1] >> 8] & (u8)isFrogReturnedFlags[this->actor.params - 1])) { @@ -963,7 +963,7 @@ void EnPametfrog_SetupSpawnFrog(EnPametfrog* this, PlayState* play) { this->collider.base.ocFlags1 &= ~OC1_ON; func_800B0DE0(play, &vec1, &gZeroVec3f, &gZeroVec3f, &primColor, &envColor, 800, 50); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_NPC_APPEAR); - Flags_SetClearTemp(play, play->roomCtx.currRoom.num); + Flags_SetClearTemp(play, play->roomCtx.curRoom.num); for (i = 0; i < 25; i++) { vel.x = randPlusMinusPoint5Scaled(5.0f); diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index 4f17b98806..b698777588 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -442,7 +442,7 @@ void EnSob1_EndInteraction(PlayState* play, EnSob1* this) { Actor_ProcessTalkRequest(&this->actor, &play->state); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -933,7 +933,7 @@ void EnSob1_SetupBuyItemWithFanfare(PlayState* play, EnSob1* this) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~0x20000000; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; EnSob1_SetupAction(this, EnSob1_BuyItemWithFanfare); } diff --git a/src/overlays/actors/ovl_En_Test2/z_en_test2.c b/src/overlays/actors/ovl_En_Test2/z_en_test2.c index 54c3f0609c..c9151d6216 100644 --- a/src/overlays/actors/ovl_En_Test2/z_en_test2.c +++ b/src/overlays/actors/ovl_En_Test2/z_en_test2.c @@ -96,7 +96,7 @@ void EnTest2_Update(Actor* thisx, PlayState* play) { Actor_SetObjectDependency(play, &this->actor); this->animMat = Lib_SegmentedToVirtual(modelInfo->animMat); } - if (play->roomCtx.currRoom.unk5) { + if (play->roomCtx.curRoom.unk5) { this->actor.update = EnTest2_UpdateForLens; } else { this->actor.update = Actor_Noop; diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.c b/src/overlays/actors/ovl_En_Test4/z_en_test4.c index f0f94a4948..88547581f3 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -507,9 +507,9 @@ void func_80A42F20(EnTest4* this, PlayState* play) { if (sCurrentCs >= 0) { ActorCutscene_Stop(sCurrentCs); } - gSaveContext.unk_3F22 = 0; + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; gSaveContext.eventInf[1] &= (u8)~0x80; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); } } diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/src/overlays/actors/ovl_En_Test7/z_en_test7.c index ed9d2870c3..03b10590ca 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -762,7 +762,7 @@ void func_80AF2938(EnTest7* this, PlayState* play) { player->stateFlags2 |= 0x20000000; this->unk_144 |= 2; this->unk_148.unk_04 = 30.0f; - if (play->roomCtx.currRoom.unk3 != 1) { + if (play->roomCtx.curRoom.unk3 != 1) { func_80AF082C(this, func_80AF2AE8); } else { func_80AF082C(this, func_80AF2EC8); diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.c b/src/overlays/actors/ovl_En_Trt/z_en_trt.c index 39a16dea9e..71abb140ac 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -219,7 +219,7 @@ void EnTrt_EndInteraction(PlayState* play, EnTrt* this) { Actor_ProcessTalkRequest(&this->actor, &play->state); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -653,7 +653,7 @@ void EnTrt_SetupBuyItemWithFanfare(PlayState* play, EnTrt* this) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~0x20000000; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; this->actionFunc = EnTrt_BuyItemWithFanfare; } diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index 43c2dc1e5d..926f88f700 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -102,7 +102,7 @@ void func_8089F17C(EnViewer* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 xzDist = fabsf(this->actor.xzDistToPlayer); - if ((((play->roomCtx.currRoom.num == this->actor.room) && (xzDist <= this->unk_148)) && + if ((((play->roomCtx.curRoom.num == this->actor.room) && (xzDist <= this->unk_148)) && (this->actor.playerHeightRel <= this->unk_150)) && (this->actor.world.pos.y <= player->actor.world.pos.y)) { xzDist = this->actor.playerHeightRel / this->unk_150; @@ -117,7 +117,7 @@ void func_8089F218(EnViewer* this, PlayState* play) { f32 xzDist = fabsf(this->actor.xzDistToPlayer); f32 temp; - if ((play->roomCtx.currRoom.num == this->actor.room) && (xzDist <= this->unk_148) && + if ((play->roomCtx.curRoom.num == this->actor.room) && (xzDist <= this->unk_148) && (this->actor.playerHeightRel <= this->unk_150) && (this->actor.world.pos.y <= player->actor.world.pos.y)) { temp = (xzDist - this->unk_14C) / (this->unk_148 - this->unk_14C); func_8089F014(this, play, temp); @@ -135,7 +135,7 @@ void func_8089F2C4(EnViewer* this, PlayState* play) { if (this->unk_14C == 0.0f) { this->unk_14C = 0.1f; } - if ((play->roomCtx.currRoom.num == this->actor.room) && (sp20.x < fabsf(this->unk_148))) { + if ((play->roomCtx.curRoom.num == this->actor.room) && (sp20.x < fabsf(this->unk_148))) { temp = sp20.z / this->unk_14C; func_8089F014(this, play, temp); } else { diff --git a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c index b699cd9afd..79961ad82b 100644 --- a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c +++ b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c @@ -387,7 +387,7 @@ void func_80A1C5E8(ObjFlowerpot* this, PlayState* play) { } void func_80A1C62C(ObjFlowerpot* this, PlayState* play) { - if (!(this->unk_1EA & 4) && (play->roomCtx.currRoom.num != this->unk_1EC)) { + if (!(this->unk_1EA & 4) && (play->roomCtx.curRoom.num != this->unk_1EC)) { this->unk_1EA |= 4; } } @@ -536,7 +536,7 @@ void func_80A1CC0C(ObjFlowerpot* this, PlayState* play) { func_80A1C62C(this, play); if (Actor_HasNoParent(&this->actor, play)) { - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; if (fabsf(this->actor.speedXZ) < 0.1f) { func_80A1C818(this); func_800B8E58(GET_PLAYER(play), NA_SE_PL_PUT_DOWN_POT); @@ -653,7 +653,7 @@ void ObjFlowerpot_Update(Actor* thisx, PlayState* play2) { func_80A1C554(this); - if ((D_80A1D830 != play->gameplayFrames) && (play->roomCtx.currRoom.unk3 == 0)) { + if ((D_80A1D830 != play->gameplayFrames) && (play->roomCtx.curRoom.unk3 == 0)) { func_80A1B3D0(); D_80A1D830 = play->gameplayFrames; } @@ -678,7 +678,7 @@ void ObjFlowerpot_Draw(Actor* thisx, PlayState* play) { } if (!(this->unk_1EA & 2)) { - if ((play->roomCtx.currRoom.unk3 == 0) && (this->actionFunc == func_80A1C838)) { + if ((play->roomCtx.curRoom.unk3 == 0) && (this->actionFunc == func_80A1C838)) { if ((this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { func_80A1B840(&D_80A1D838[this->unk_1EB]); diff --git a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c index 3289699b0c..384d1cbad2 100644 --- a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c +++ b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c @@ -420,8 +420,8 @@ void func_80B9D0FC(ObjHunsui* this, PlayState* play) { void func_80B9D120(ObjHunsui* this, PlayState* play) { if (((this->unk_160 == OBJHUNSUI_F000_5) || (this->unk_160 == OBJHUNSUI_F000_6)) && - (this->unk_16C != play->roomCtx.currRoom.num) && (this->unk_16C != play->roomCtx.prevRoom.num) && - ((this->unk_16D != play->roomCtx.currRoom.num) && (this->unk_16D != play->roomCtx.prevRoom.num))) { + (this->unk_16C != play->roomCtx.curRoom.num) && (this->unk_16C != play->roomCtx.prevRoom.num) && + ((this->unk_16D != play->roomCtx.curRoom.num) && (this->unk_16D != play->roomCtx.prevRoom.num))) { switch (this->unk_160) { case OBJHUNSUI_F000_5: D_80B9DED8.unk_01 = 0; @@ -525,8 +525,8 @@ void func_80B9D4D0(ObjHunsui* this, PlayState* play) { void func_80B9D508(ObjHunsui* this, PlayState* play) { if (((this->unk_160 == OBJHUNSUI_F000_5) || (this->unk_160 == OBJHUNSUI_F000_6)) && - (this->unk_16C != play->roomCtx.currRoom.num) && (this->unk_16C != play->roomCtx.prevRoom.num) && - (this->unk_16D != play->roomCtx.currRoom.num) && (this->unk_16D != play->roomCtx.prevRoom.num)) { + (this->unk_16C != play->roomCtx.curRoom.num) && (this->unk_16C != play->roomCtx.prevRoom.num) && + (this->unk_16D != play->roomCtx.curRoom.num) && (this->unk_16D != play->roomCtx.prevRoom.num)) { switch (this->unk_160) { case OBJHUNSUI_F000_5: D_80B9DED8.unk_01 = 0; @@ -544,7 +544,7 @@ void func_80B9D508(ObjHunsui* this, PlayState* play) { func_80B9D094(this, play); if (((this->unk_160 == OBJHUNSUI_F000_5) || (this->unk_160 == OBJHUNSUI_F000_6)) && - (play->roomCtx.currRoom.num == 8)) { + (play->roomCtx.curRoom.num == 8)) { func_80B9D334(this, play); } @@ -572,8 +572,8 @@ void func_80B9D714(ObjHunsui* this, PlayState* play) { s16 cs; f32 sp28; - if ((this->unk_16C != play->roomCtx.currRoom.num) && (this->unk_16C != play->roomCtx.prevRoom.num) && - (this->unk_16D != play->roomCtx.currRoom.num) && (this->unk_16D != play->roomCtx.prevRoom.num)) { + if ((this->unk_16C != play->roomCtx.curRoom.num) && (this->unk_16C != play->roomCtx.prevRoom.num) && + (this->unk_16D != play->roomCtx.curRoom.num) && (this->unk_16D != play->roomCtx.prevRoom.num)) { Actor_MarkForDeath(&this->dyna.actor); } else { if (Flags_GetSwitch(play, this->unk_168)) { diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index 6f98958b1e..e2a71db925 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -127,7 +127,7 @@ void func_80926318(ObjKibako* this, PlayState* play) { } void func_80926394(ObjKibako* this, PlayState* play) { - if ((this->isDropCollected == 0) && (play->roomCtx.currRoom.num != this->unk199)) { + if ((this->isDropCollected == 0) && (play->roomCtx.curRoom.num != this->unk199)) { this->isDropCollected = 1; } } @@ -339,7 +339,7 @@ void ObjKibako_Held(ObjKibako* this, PlayState* play) { func_80926394(this, play); if (Actor_HasNoParent(&this->actor, play)) { - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; if (fabsf(this->actor.speedXZ) < 0.1f) { ObjKibako_SetupIdle(this); this->collider.base.ocFlags1 &= ~OC1_TYPE_PLAYER; diff --git a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c index 937a61d79f..74fa8fd578 100644 --- a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c +++ b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c @@ -296,7 +296,7 @@ void func_80B39908(ObjSnowball2* this, PlayState* play) { } void func_80B39B28(ObjSnowball2* this, PlayState* play) { - if ((this->unk_1AE == 0) && (play->roomCtx.currRoom.num != this->unk_1AF)) { + if ((this->unk_1AE == 0) && (play->roomCtx.curRoom.num != this->unk_1AF)) { this->unk_1AE = 1; } } @@ -416,7 +416,7 @@ void func_80B39FA8(ObjSnowball2* this, PlayState* play) { } if (Actor_HasNoParent(&this->actor, play)) { - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; this->actor.speedXZ *= 3.8f; this->actor.velocity.y *= 0.4f; this->actor.gravity = -2.8f; diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c index acba9ec31c..20c1728035 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -166,7 +166,7 @@ s32 ObjTsubo_IsSceneNotGohtOrTwinmold(ObjTsubo* this, PlayState* play) { } void func_8092788C(ObjTsubo* this, PlayState* play) { - if (!this->unk_197 && (play->roomCtx.currRoom.num != this->homeRoom)) { + if (!this->unk_197 && (play->roomCtx.curRoom.num != this->homeRoom)) { this->unk_197 = true; } } @@ -527,7 +527,7 @@ void func_80928D80(ObjTsubo* this, PlayState* play) { func_8092788C(this, play); if (Actor_HasNoParent(&this->actor, play)) { - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; Actor_MoveWithGravity(&this->actor); this->actor.flags &= ~ACTOR_FLAG_4000000; Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0xC5); diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 898b1f351a..b4cfe295c7 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -23,10 +23,10 @@ void MapSelect_LoadGame(MapSelectState* this, u32 entrance, s32 spawn) { gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_ENABLED; gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_ENABLED; gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED; - gSaveContext.unk_3F1E = 0; - gSaveContext.unk_3F20 = 0; - gSaveContext.unk_3F22 = 0; - gSaveContext.unk_3F24 = 0; + gSaveContext.hudVisibilityForceButtonAlphasByStatus = false; + gSaveContext.nextHudVisibility = HUD_VISIBILITY_IDLE; + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + gSaveContext.hudVisibilityTimer = 0; Audio_QueueSeqCmd(NA_BGM_STOP); gSaveContext.save.entrance = entrance; diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c index 888f715c01..7f57ac7a39 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c @@ -584,13 +584,13 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { if ((cursorItem != (u32)PAUSE_ITEM_NONE) && (msgCtx->msgLength == 0)) { if (gSaveContext.buttonStatus[EQUIP_SLOT_A] == BTN_DISABLED) { gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED; - gSaveContext.unk_3F22 = 0; - Interface_ChangeAlpha(50); + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); } } else if (gSaveContext.buttonStatus[EQUIP_SLOT_A] != BTN_DISABLED) { gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_DISABLED; - gSaveContext.unk_3F22 = 0; - Interface_ChangeAlpha(50); + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); } pauseCtx->cursorItem[PAUSE_ITEM] = cursorItem; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index d741d74087..c5cd94e375 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2100,10 +2100,10 @@ 0x8010EBA0:("func_8010EBA0",), 0x8010EC54:("func_8010EC54",), 0x8010EE74:("func_8010EE74",), - 0x8010EF68:("Interface_ChangeAlpha",), - 0x8010EF9C:("func_8010EF9C",), - 0x8010F0D4:("func_8010F0D4",), - 0x8010F1A8:("func_8010F1A8",), + 0x8010EF68:("Interface_SetHudVisibility",), + 0x8010EF9C:("Interface_UpdateButtonAlphasByStatus",), + 0x8010F0D4:("Interface_UpdateButtonAlphas",), + 0x8010F1A8:("Interface_UpdateHudAlphas",), 0x80110038:("func_80110038",), 0x80111CB4:("func_80111CB4",), 0x801129E4:("func_801129E4",), diff --git a/tools/namefixer.py b/tools/namefixer.py index af17edc3c7..3008c0143f 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -483,6 +483,7 @@ wordReplace = { "func_80169E6C": "Play_SetupRespawnPoint", "func_8016A0AC": "Play_IsUnderwater", "func_801690CC": "Play_InCsMode", + "Interface_ChangeAlpha": "Interface_SetHudVisibility", "func_80112B40": "Interface_LoadItemIconImpl", "func_80112BE4": "Interface_LoadItemIcon", "func_80114978": "Item_CheckObtainability", @@ -644,6 +645,11 @@ wordReplace = { "actor.yDistToWater": "actor.depthInWater", "actor.yDistToPlayer": "actor.playerHeightRel", + "gSaveContext.unk_3F1E": "gSaveContext.hudVisibilityForceButtonAlphasByStatus", + "gSaveContext.unk_3F20": "gSaveContext.nextHudVisibility", + "gSaveContext.unk_3F22": "gSaveContext.hudVisibility", + "gSaveContext.unk_3F24": "gSaveContext.hudVisibilityTimer", + "gSaveContext.unk_3F26": "gSaveContext.prevHudVisibility", "gSaveContext.weekEventReg": "gSaveContext.save.weekEventReg", "gSaveContext.playerForm": "gSaveContext.save.playerForm", "gSaveContext.day": "gSaveContext.save.day", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 50a3309c44..6d0e03cd1a 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1614,10 +1614,10 @@ asm/non_matchings/code/z_parameter/func_8010EB50.s,func_8010EB50,0x8010EB50,0x14 asm/non_matchings/code/z_parameter/func_8010EBA0.s,func_8010EBA0,0x8010EBA0,0x2D asm/non_matchings/code/z_parameter/func_8010EC54.s,func_8010EC54,0x8010EC54,0x88 asm/non_matchings/code/z_parameter/func_8010EE74.s,func_8010EE74,0x8010EE74,0x3D -asm/non_matchings/code/z_parameter/Interface_ChangeAlpha.s,Interface_ChangeAlpha,0x8010EF68,0xD -asm/non_matchings/code/z_parameter/func_8010EF9C.s,func_8010EF9C,0x8010EF9C,0x4E -asm/non_matchings/code/z_parameter/func_8010F0D4.s,func_8010F0D4,0x8010F0D4,0x35 -asm/non_matchings/code/z_parameter/func_8010F1A8.s,func_8010F1A8,0x8010F1A8,0x3A4 +asm/non_matchings/code/z_parameter/Interface_SetHudVisibility.s,Interface_SetHudVisibility,0x8010EF68,0xD +asm/non_matchings/code/z_parameter/Interface_UpdateButtonAlphasByStatus.s,Interface_UpdateButtonAlphasByStatus,0x8010EF9C,0x4E +asm/non_matchings/code/z_parameter/Interface_UpdateButtonAlphas.s,Interface_UpdateButtonAlphas,0x8010F0D4,0x35 +asm/non_matchings/code/z_parameter/Interface_UpdateHudAlphas.s,Interface_UpdateHudAlphas,0x8010F1A8,0x3A4 asm/non_matchings/code/z_parameter/func_80110038.s,func_80110038,0x80110038,0x71F asm/non_matchings/code/z_parameter/func_80111CB4.s,func_80111CB4,0x80111CB4,0x34C asm/non_matchings/code/z_parameter/func_801129E4.s,func_801129E4,0x801129E4,0x44