summaryrefslogtreecommitdiff
path: root/soh/src/code
diff options
context:
space:
mode:
authorinspectredc <78732756+inspectredc@users.noreply.github.com>2023-04-07 22:05:12 +0100
committerGitHub <noreply@github.com>2023-04-07 17:05:12 -0400
commit1fa31410c263768ddfd31bb13a9ba036c438a2c4 (patch)
treed21c39e6ca651231a867fe0e071d2d682f76357f /soh/src/code
parent0f6147f41dc64573d0455a776ba49bd96a3d9c59 (diff)
Switch age fix (#2676)
* specific scenarios for switch age button, non rando * Working fix for vanilla swordless change age * Fix now works for randomiser * Fixed room load on change age transition * Removed potentially unnecessary function call Need to investigate this more, maybe wait for more room documentation. * Suggested Edits Moves setting cvar back into mods.cpp and makes clear the condition expected for the no sword flag
Diffstat (limited to 'soh/src/code')
-rw-r--r--soh/src/code/z_parameter.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c
index f1a0eb36a..e69fd0126 100644
--- a/soh/src/code/z_parameter.c
+++ b/soh/src/code/z_parameter.c
@@ -1411,17 +1411,18 @@ void Inventory_SwapAgeEquipment(void) {
u16 temp;
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
- // When becoming adult, remove swordless flag since we'll get master sword
- // Only in rando to keep swordless link bugs in vanilla
- if (gSaveContext.n64ddFlag) {
- gSaveContext.infTable[29] &= ~1;
- }
+
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if (i != 0) {
gSaveContext.childEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i];
} else {
- gSaveContext.childEquips.buttonItems[i] = ITEM_SWORD_KOKIRI;
+ if (CVarGetInteger("gSwitchAge", 0) &&
+ (gSaveContext.infTable[29] & 1)) {
+ gSaveContext.childEquips.buttonItems[i] = ITEM_NONE;
+ } else {
+ gSaveContext.childEquips.buttonItems[i] = ITEM_SWORD_KOKIRI;
+ }
}
if (i != 0) {
@@ -1429,6 +1430,12 @@ void Inventory_SwapAgeEquipment(void) {
}
}
+ // When becoming adult, remove swordless flag since we'll get master sword
+ // Only in rando to keep swordless link bugs in vanilla
+ if (gSaveContext.n64ddFlag) {
+ gSaveContext.infTable[29] &= ~1;
+ }
+
gSaveContext.childEquips.equipment = gSaveContext.equips.equipment;
if (gSaveContext.adultEquips.buttonItems[0] == ITEM_NONE) {
@@ -1493,7 +1500,8 @@ void Inventory_SwapAgeEquipment(void) {
gSaveContext.adultEquips.equipment = gSaveContext.equips.equipment;
- if (gSaveContext.childEquips.buttonItems[0] != ITEM_NONE) {
+ if (gSaveContext.childEquips.buttonItems[0] != ITEM_NONE ||
+ CVarGetInteger("gSwitchAge", 0)) {
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
gSaveContext.equips.buttonItems[i] = gSaveContext.childEquips.buttonItems[i];
@@ -1533,6 +1541,16 @@ void Inventory_SwapAgeEquipment(void) {
}
gSaveContext.equips.equipment = 0x1111;
}
+
+ if (CVarGetInteger("gSwitchAge", 0) &&
+ (gSaveContext.equips.buttonItems[0] == ITEM_NONE)) {
+ gSaveContext.infTable[29] |= 1;
+ if (gSaveContext.childEquips.equipment == 0) {
+ // force equip kokiri tunic and boots in scenario gSaveContext.childEquips.equipment is uninitialized
+ gSaveContext.equips.equipment &= 0xFFF0;
+ gSaveContext.equips.equipment |= 0x1100;
+ }
+ }
}
temp = gEquipMasks[EQUIP_SHIELD] & gSaveContext.equips.equipment;