rando: option to allow swordless epona items (#6727)

This commit is contained in:
Philip Dubé
2026-06-14 14:21:16 +00:00
committed by GitHub
parent 1894ffca46
commit 360f4882d2
11 changed files with 112 additions and 50 deletions
+1 -1
View File
@@ -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;
}
+19 -45
View File
@@ -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;
}
+1 -1
View File
@@ -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();
@@ -4866,7 +4866,7 @@ void KaleidoScope_Update(PlayState* play) {
}
// Used to clear swordless temp B after unpause so minigame/epona handling restarts
Interface_RandoRestoreSwordless();
GameInteractor_Should(VB_TEMP_B_RESTORE_SWORDLESS, true);
interfaceCtx->unk_1FA = interfaceCtx->unk_1FC = 0;
osSyncPrintf(VT_FGCOL(YELLOW));