summaryrefslogtreecommitdiff
path: root/soh/src/code
diff options
context:
space:
mode:
authorPhilip Dubé <159546+serprex@users.noreply.github.com>2026-06-14 14:21:16 +0000
committerGitHub <noreply@github.com>2026-06-14 14:21:16 +0000
commit360f4882d21dc84ded570baf017aa075e5eea87d (patch)
tree6d3d87654dc9e2ee9ad9fd873e76b5d278577d3f /soh/src/code
parent1894ffca46eba57957c2e9eac7a2327fede93b0a (diff)
rando: option to allow swordless epona items (#6727)
Diffstat (limited to 'soh/src/code')
-rw-r--r--soh/src/code/z_game_over.c2
-rw-r--r--soh/src/code/z_parameter.c64
-rw-r--r--soh/src/code/z_play.c2
3 files changed, 21 insertions, 47 deletions
diff --git a/soh/src/code/z_game_over.c b/soh/src/code/z_game_over.c
index 5b16bbc38..e57e5a3a2 100644
--- a/soh/src/code/z_game_over.c
+++ b/soh/src/code/z_game_over.c
@@ -60,7 +60,7 @@ void GameOver_Update(PlayState* play) {
if (gSaveContext.buttonStatus[0] != BTN_ENABLED) {
gSaveContext.equips.buttonItems[0] = gSaveContext.buttonStatus[0];
- Interface_RandoRestoreSwordless();
+ GameInteractor_Should(VB_TEMP_B_RESTORE_SWORDLESS, true);
} else {
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
}
diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c
index 2064527e6..e96929a10 100644
--- a/soh/src/code/z_parameter.c
+++ b/soh/src/code/z_parameter.c
@@ -796,20 +796,6 @@ void func_80082850(PlayState* play, s16 maxAlpha) {
}
}
-// buttonStatus[0] is used to represent if the B button is disabled, but also tracks
-// the last active B button item during mini-games/epona (temp B)
-// Since ITEM_NONE is the same as BTN_DISABLED (255), we need a different value to help us track
-// that the player was swordless before like ITEM_NONE_FE (254)
-#define SWORDLESS_STATUS ITEM_NONE_FE
-
-// Restores swordless state when using the custom value for temp B and then clears temp B
-void Interface_RandoRestoreSwordless(void) {
- if (IS_RANDO && gSaveContext.buttonStatus[0] == SWORDLESS_STATUS) {
- gSaveContext.equips.buttonItems[0] = ITEM_NONE;
- gSaveContext.buttonStatus[0] = BTN_ENABLED;
- }
-}
-
void func_80083108(PlayState* play) {
MessageContext* msgCtx = &play->msgCtx;
Player* player = GET_PLAYER(play);
@@ -817,20 +803,14 @@ void func_80083108(PlayState* play) {
s16 i;
s16 sp28 = 0;
- // Check for the player being swordless in rando (no item on B and swordless flag set)
- // Child is always assumed due to not finding kokiri sword yet. Adult is only checked with MS shuffle on.
- u8 randoIsSwordless = IS_RANDO && (LINK_IS_CHILD || Randomizer_GetSettingValue(RSK_SHUFFLE_MASTER_SWORD)) &&
- gSaveContext.equips.buttonItems[0] == ITEM_NONE && Flags_GetInfTable(INFTABLE_SWORDLESS);
- u8 randoWasSwordlessBefore = IS_RANDO && gSaveContext.buttonStatus[0] == SWORDLESS_STATUS;
- u8 randoCanTrackSwordless = randoIsSwordless && !randoWasSwordlessBefore;
-
if ((gSaveContext.cutsceneIndex < 0xFFF0) ||
((play->sceneNum == SCENE_LON_LON_RANCH) && (gSaveContext.cutsceneIndex == 0xFFF0))) {
gSaveContext.forceRisingButtonAlphas = 0;
if ((player->stateFlags1 & PLAYER_STATE1_ON_HORSE) || (play->shootingGalleryStatus > 1) ||
((play->sceneNum == SCENE_BOMBCHU_BOWLING_ALLEY) && Flags_GetSwitch(play, 0x38))) {
- if (gSaveContext.equips.buttonItems[0] != ITEM_NONE || randoCanTrackSwordless) {
+ if (GameInteractor_Should(VB_TEMP_B_TREAT_AS_OCCUPIED, gSaveContext.equips.buttonItems[0] != ITEM_NONE,
+ play)) {
gSaveContext.forceRisingButtonAlphas = 1;
if (gSaveContext.buttonStatus[0] == BTN_DISABLED) {
@@ -843,13 +823,10 @@ void func_80083108(PlayState* play) {
if ((gSaveContext.equips.buttonItems[0] != ITEM_SLINGSHOT) &&
(gSaveContext.equips.buttonItems[0] != ITEM_BOW) &&
(gSaveContext.equips.buttonItems[0] != ITEM_BOMBCHU) &&
- (gSaveContext.equips.buttonItems[0] != ITEM_NONE || randoCanTrackSwordless)) {
+ GameInteractor_Should(VB_TEMP_B_TREAT_AS_OCCUPIED, gSaveContext.equips.buttonItems[0] != ITEM_NONE,
+ play)) {
gSaveContext.buttonStatus[0] = gSaveContext.equips.buttonItems[0];
-
- // Track swordless status for restoration later
- if (randoCanTrackSwordless) {
- gSaveContext.buttonStatus[0] = SWORDLESS_STATUS;
- }
+ GameInteractor_Should(VB_TEMP_B_STASH_SWORDLESS, true, play);
if ((play->sceneNum == SCENE_BOMBCHU_BOWLING_ALLEY) && Flags_GetSwitch(play, 0x38)) {
gSaveContext.equips.buttonItems[0] = ITEM_BOMBCHU;
@@ -902,12 +879,7 @@ void func_80083108(PlayState* play) {
if (play->interfaceCtx.unk_260 != 0) {
if (gSaveContext.equips.buttonItems[0] != ITEM_FISHING_POLE) {
gSaveContext.buttonStatus[0] = gSaveContext.equips.buttonItems[0];
-
- // Track swordless status for restoration later
- if (randoCanTrackSwordless) {
- gSaveContext.buttonStatus[0] = SWORDLESS_STATUS;
- }
-
+ GameInteractor_Should(VB_TEMP_B_STASH_SWORDLESS, true, play);
gSaveContext.equips.buttonItems[0] = ITEM_FISHING_POLE;
gSaveContext.unk_13EA = 0;
Interface_LoadItemIcon1(play, 0);
@@ -921,7 +893,7 @@ void func_80083108(PlayState* play) {
gSaveContext.equips.buttonItems[0] = gSaveContext.buttonStatus[0];
gSaveContext.unk_13EA = 0;
- Interface_RandoRestoreSwordless();
+ GameInteractor_Should(VB_TEMP_B_RESTORE_SWORDLESS, true);
if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) {
Interface_LoadItemIcon1(play, 0);
@@ -1030,7 +1002,7 @@ void func_80083108(PlayState* play) {
(gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KNIFE)) {
gSaveContext.equips.buttonItems[0] = gSaveContext.buttonStatus[0];
- Interface_RandoRestoreSwordless();
+ GameInteractor_Should(VB_TEMP_B_RESTORE_SWORDLESS, true);
} else {
gSaveContext.buttonStatus[0] = gSaveContext.equips.buttonItems[0];
}
@@ -1070,11 +1042,12 @@ void func_80083108(PlayState* play) {
(gSaveContext.equips.buttonItems[0] == ITEM_BOW) ||
(gSaveContext.equips.buttonItems[0] == ITEM_BOMBCHU) ||
(gSaveContext.equips.buttonItems[0] == ITEM_NONE)) {
- if ((gSaveContext.equips.buttonItems[0] != ITEM_NONE) || (gSaveContext.infTable[29] == 0) ||
- randoWasSwordlessBefore) {
+ if (GameInteractor_Should(VB_TEMP_B_SHOULD_RESTORE,
+ (gSaveContext.equips.buttonItems[0] != ITEM_NONE) ||
+ (gSaveContext.infTable[29] == 0))) {
gSaveContext.equips.buttonItems[0] = gSaveContext.buttonStatus[0];
- Interface_RandoRestoreSwordless();
+ GameInteractor_Should(VB_TEMP_B_RESTORE_SWORDLESS, true);
sp28 = 1;
@@ -1097,11 +1070,12 @@ void func_80083108(PlayState* play) {
(gSaveContext.equips.buttonItems[0] == ITEM_BOW) ||
(gSaveContext.equips.buttonItems[0] == ITEM_BOMBCHU) ||
(gSaveContext.equips.buttonItems[0] == ITEM_NONE)) {
- if ((gSaveContext.equips.buttonItems[0] != ITEM_NONE) || (gSaveContext.infTable[29] == 0) ||
- randoWasSwordlessBefore) {
+ if (GameInteractor_Should(VB_TEMP_B_SHOULD_RESTORE,
+ (gSaveContext.equips.buttonItems[0] != ITEM_NONE) ||
+ (gSaveContext.infTable[29] == 0))) {
gSaveContext.equips.buttonItems[0] = gSaveContext.buttonStatus[0];
- Interface_RandoRestoreSwordless();
+ GameInteractor_Should(VB_TEMP_B_RESTORE_SWORDLESS, true);
sp28 = 1;
@@ -1762,13 +1736,13 @@ void func_80084BF4(PlayState* play, u16 flag) {
(gSaveContext.equips.buttonItems[0] == ITEM_BOMBCHU) ||
(gSaveContext.equips.buttonItems[0] == ITEM_FISHING_POLE)) {
gSaveContext.equips.buttonItems[0] = gSaveContext.buttonStatus[0];
- Interface_RandoRestoreSwordless();
+ GameInteractor_Should(VB_TEMP_B_RESTORE_SWORDLESS, true);
Interface_LoadItemIcon1(play, 0);
}
} else if (gSaveContext.equips.buttonItems[0] == ITEM_NONE) {
if ((gSaveContext.equips.buttonItems[0] != ITEM_NONE) || (gSaveContext.infTable[29] == 0)) {
gSaveContext.equips.buttonItems[0] = gSaveContext.buttonStatus[0];
- Interface_RandoRestoreSwordless();
+ GameInteractor_Should(VB_TEMP_B_RESTORE_SWORDLESS, true);
Interface_LoadItemIcon1(play, 0);
}
}
@@ -5924,7 +5898,7 @@ void Interface_Draw(PlayState* play) {
(gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KNIFE)) {
if (gSaveContext.buttonStatus[0] != BTN_ENABLED) {
gSaveContext.equips.buttonItems[0] = gSaveContext.buttonStatus[0];
- Interface_RandoRestoreSwordless();
+ GameInteractor_Should(VB_TEMP_B_RESTORE_SWORDLESS, true);
} else {
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
}
diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c
index 00d1066a2..7da3f61cb 100644
--- a/soh/src/code/z_play.c
+++ b/soh/src/code/z_play.c
@@ -2225,7 +2225,7 @@ void Play_PerformSave(PlayState* play) {
(gSaveContext.equips.buttonItems[0] == ITEM_NONE && !Flags_GetInfTable(INFTABLE_SWORDLESS))) {
gSaveContext.equips.buttonItems[0] = gSaveContext.buttonStatus[0];
- Interface_RandoRestoreSwordless();
+ GameInteractor_Should(VB_TEMP_B_RESTORE_SWORDLESS, true);
}
Save_SaveFile();