Skip to content

Commit

Permalink
Time Savers: Ask to Equip New Items (HarbourMasters#1133)
Browse files Browse the repository at this point in the history
* Time Savers: Ask to Equip New Items

* Add to presets; fix early SFX

* Simplify text reading

* Shrug, does this fix it

* Merge error

* Merge develop
  • Loading branch information
vaguerant authored and th-2021 committed Nov 28, 2022
1 parent 0cc0a1c commit 62ab3ba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions soh/soh/OTRGlobals.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ void Controller_BlockGameInput();
void Controller_UnblockGameInput();
void Hooks_ExecuteAudioInit();
void* getN64WeirdFrame(s32 i);
int GetEquipNowMessage(char* buffer, char* src, const int maxBufferSize);
u32 SpoilerFileExists(const char* spoilerFileName);
Sprite* GetSeedTexture(uint8_t index);
void Randomizer_LoadSettings(const char* spoilerFileName);
Expand Down
6 changes: 3 additions & 3 deletions soh/src/code/z_message_PAL.c
Original file line number Diff line number Diff line change
Expand Up @@ -1750,16 +1750,16 @@ void Message_OpenText(PlayState* play, u16 textId) {
//font->msgLength, __FILE__, __LINE__);

} else if (CVar_GetS32("gAskToEquip", 0) &&
(((LINK_IS_ADULT || CVar_GetS32("gTimelessEquipment", 0)) &&
(((LINK_IS_ADULT || CVar_GetS32("gNoRestrictAge", 0)) &&
// 0C = Biggoron, 4B = Giant's, 4E = Mirror Shield, 50-51 = Tunics
(textId == 0x0C || textId == 0x4B || textId == 0x4E ||
textId == 0x50 || textId == 0x51)) ||
((!LINK_IS_ADULT || CVar_GetS32("gTimelessEquipment", 0)) &&
((!LINK_IS_ADULT || CVar_GetS32("gNoRestrictAge", 0)) &&
// 4C = Deku Shield, A4 = Kokiri Sword
(textId == 0x4C || textId == 0xA4)) ||
// 4D == Hylian Shield
textId == 0x4D)) {
Message_FindMessage(play, textId);
Message_FindMessage(globalCtx, textId);
msgCtx->msgLength = font->msgLength = GetEquipNowMessage(font->msgBuf, font->msgOffset, sizeof(font->msgBuf));
} else {
Message_FindMessage(play, textId);
Expand Down
16 changes: 8 additions & 8 deletions soh/src/overlays/actors/ovl_player_actor/z_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -12620,7 +12620,7 @@ s32 func_8084DFF4(PlayState* play, Player* this) {
equipItem = giEntry.itemId;
equipNow = CVar_GetS32("gAskToEquip", 0) && equipItem >= ITEM_SWORD_KOKIRI && equipItem <= ITEM_TUNIC_ZORA &&
((gItemAgeReqs[equipItem] == 9 || gItemAgeReqs[equipItem] == gSaveContext.linkAge) ||
CVar_GetS32("gTimelessEquipment", 0));
CVar_GetS32("gNoRestrictAge", 0));

Message_StartTextbox(play, giEntry.textId, &this->actor);
// RANDOTODO: Macro this boolean check.
Expand Down Expand Up @@ -12672,9 +12672,9 @@ s32 func_8084DFF4(PlayState* play, Player* this) {
Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900);
}
}
else if (equipNow && Message_ShouldAdvanceSilent(play) &&
Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) {
if (play->msgCtx.choiceIndex == 0) { // Equip now? Yes
else if (equipNow && Message_ShouldAdvanceSilent(globalCtx) &&
Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) {
if (globalCtx->msgCtx.choiceIndex == 0) { // Equip now? Yes

if (equipItem >= ITEM_SWORD_KOKIRI && equipItem <= ITEM_SWORD_BGS) {
gSaveContext.equips.buttonItems[0] = equipItem;
Expand All @@ -12684,17 +12684,17 @@ s32 func_8084DFF4(PlayState* play, Player* this) {
} else if (equipItem >= ITEM_SHIELD_DEKU && equipItem <= ITEM_SHIELD_MIRROR) {
Inventory_ChangeEquipment(EQUIP_SHIELD, equipItem - ITEM_SHIELD_DEKU + 1);
func_808328EC(&this->actor, NA_SE_IT_SHIELD_REMOVE);
Player_SetEquipmentData(play, this);
Player_SetEquipmentData(globalCtx, this);

} else if (equipItem == ITEM_TUNIC_GORON || equipItem == ITEM_TUNIC_ZORA) {
Inventory_ChangeEquipment(EQUIP_TUNIC, equipItem - ITEM_TUNIC_KOKIRI + 1);
func_808328EC(this, NA_SE_PL_CHANGE_ARMS);
Player_SetEquipmentData(play, this);
Player_SetEquipmentData(globalCtx, this);
}
}
equipNow = false;
Message_CloseTextbox(play);
play->msgCtx.msgMode = MSGMODE_TEXT_DONE;
Message_CloseTextbox(globalCtx);
globalCtx->msgCtx.msgMode = MSGMODE_TEXT_DONE;
} else {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
if (this->getItemId == GI_GAUNTLETS_SILVER && !gSaveContext.n64ddFlag) {
Expand Down

0 comments on commit 62ab3ba

Please sign in to comment.