summaryrefslogtreecommitdiff
path: root/soh/src/code
diff options
context:
space:
mode:
authorGarrett Cox <garrettjcox@gmail.com>2023-11-14 22:24:48 -0600
committerGitHub <noreply@github.com>2023-11-14 22:24:48 -0600
commit20752135440c7ad47ea7d4a729716d7882f37dd4 (patch)
treef01156da947e1964efb7f8e463ad9da6a393797d /soh/src/code
parentdd6271ecae9868c99bdc79324c6143f082fbcc65 (diff)
parent2dfbbc63e3358f4fec9c518f6cba978aa93d71db (diff)
Merge pull request #3399 from HarbourMasters/develop-macready
macready -> dev
Diffstat (limited to 'soh/src/code')
-rw-r--r--soh/src/code/code_80097A00.c11
-rw-r--r--soh/src/code/z_parameter.c1
-rw-r--r--soh/src/code/z_play.c27
3 files changed, 39 insertions, 0 deletions
diff --git a/soh/src/code/code_80097A00.c b/soh/src/code/code_80097A00.c
index 9e20d66aa..eb83738e3 100644
--- a/soh/src/code/code_80097A00.c
+++ b/soh/src/code/code_80097A00.c
@@ -204,6 +204,17 @@ u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment) {
if (equipment == EQUIP_TYPE_TUNIC) {
gSaveContext.equips.equipment |= EQUIP_VALUE_TUNIC_KOKIRI << (EQUIP_TYPE_TUNIC * 4);
+ // non-vanilla: remove goron and zora tunics from item buttons if assignable tunics is on
+ if (CVarGetInteger("gAssignableTunicsAndBoots", 0) && equipValue != EQUIP_VALUE_TUNIC_KOKIRI) {
+ ItemID item = (equipValue == EQUIP_VALUE_TUNIC_GORON ? ITEM_TUNIC_GORON : ITEM_TUNIC_ZORA);
+ for (int i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
+ if (gSaveContext.equips.buttonItems[i] == item) {
+ gSaveContext.equips.buttonItems[i] = ITEM_NONE;
+ gSaveContext.equips.cButtonSlots[i - 1] = SLOT_NONE;
+ }
+ }
+ }
+ // end non-vanilla
}
if (equipment == EQUIP_TYPE_SWORD) {
diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c
index ec25d2062..bbaa8d90b 100644
--- a/soh/src/code/z_parameter.c
+++ b/soh/src/code/z_parameter.c
@@ -1469,6 +1469,7 @@ void Inventory_SwapAgeEquipment(void) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;
} else {
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
+ Flags_SetInfTable(INFTABLE_SWORDLESS);
}
if (gSaveContext.inventory.items[SLOT_NUT] != ITEM_NONE) {
diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c
index bf7016884..59a5d0619 100644
--- a/soh/src/code/z_play.c
+++ b/soh/src/code/z_play.c
@@ -33,6 +33,7 @@ u64 D_801614D0[0xA00];
#endif
PlayState* gPlayState;
+s16 firstInit = 0;
s16 gEnPartnerId;
@@ -490,6 +491,12 @@ void Play_Init(GameState* thisx) {
}
}
+ // Properly initialize the frame counter so it doesn't use garbage data
+ if (!firstInit) {
+ play->gameplayFrames = 0;
+ firstInit = 1;
+ }
+
// Invalid entrance, so immediately exit the game to opening title
if (gSaveContext.entranceIndex == -1) {
gSaveContext.entranceIndex = 0;
@@ -2329,8 +2336,28 @@ void Play_PerformSave(PlayState* play) {
if (play != NULL && gSaveContext.fileNum != 0xFF) {
Play_SaveSceneFlags(play);
gSaveContext.savedSceneNum = play->sceneNum;
+
+ // Track values from temp B
+ uint8_t prevB = gSaveContext.equips.buttonItems[0];
+ uint8_t prevStatus = gSaveContext.buttonStatus[0];
+
+ // Replicate the B button restore from minigames/epona that kaleido does
+ if (gSaveContext.equips.buttonItems[0] == ITEM_SLINGSHOT ||
+ gSaveContext.equips.buttonItems[0] == ITEM_BOW ||
+ gSaveContext.equips.buttonItems[0] == ITEM_BOMBCHU ||
+ gSaveContext.equips.buttonItems[0] == ITEM_FISHING_POLE ||
+ (gSaveContext.equips.buttonItems[0] == ITEM_NONE && !Flags_GetInfTable(INFTABLE_SWORDLESS))) {
+
+ gSaveContext.equips.buttonItems[0] = gSaveContext.buttonStatus[0];
+ Interface_RandoRestoreSwordless();
+ }
+
Save_SaveFile();
+ // Restore temp B values back
+ gSaveContext.equips.buttonItems[0] = prevB;
+ gSaveContext.buttonStatus[0] = prevStatus;
+
uint8_t triforceHuntCompleted =
IS_RANDO &&
gSaveContext.triforcePiecesCollected == Randomizer_GetSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED) &&