forked from AmazingAmpharos/OoT-Randomizer
-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New QoL setting : textbox to equip new swords/shields/tunic when finding them #2335
Open
GSKirox
wants to merge
2
commits into
OoTRandomizer:Dev
Choose a base branch
from
GSKirox:equipment_textbox
base: Dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#include "message.h" | ||
#include "z64.h" | ||
#include "stdbool.h" | ||
#include "save.h" | ||
|
||
|
@@ -151,6 +150,144 @@ void treasure_chest_game_message() { | |
} | ||
} | ||
|
||
extern uint8_t EQUIPMENT_TEXTBOX; | ||
uint8_t kokiri_sword_message = 0; | ||
uint8_t biggoron_sword_message = 0; | ||
uint8_t deku_shield_message = 0; | ||
uint8_t hylian_shield_message = 0; | ||
uint8_t mirror_shield_message = 0; | ||
uint8_t goron_tunic_message = 0; | ||
uint8_t zora_tunic_message = 0; | ||
void manage_kokiri_sword_message() { | ||
if (kokiri_sword_message == 1 && | ||
z64_MessageGetState(((uint8_t *)(&z64_game)) + 0x20D8) == 0) { | ||
z64_DisplayTextbox(&z64_game, 0x045E, 0); | ||
kokiri_sword_message = 2; | ||
} | ||
if (kokiri_sword_message == 2) { | ||
MessageContext *msgCtx = &(z64_game.msgContext); | ||
z64_link.common.frozen = 10; | ||
if (Message_ShouldAdvance(&z64_game)) { | ||
if (msgCtx->choiceIndex == 0) { | ||
z64_file.button_items[0] = Z64_ITEM_KOKIRI_SWORD; | ||
Interface_LoadItemIcon1(&z64_game, 0); | ||
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_KOKIRI); | ||
} | ||
kokiri_sword_message = 0; | ||
} | ||
} | ||
} | ||
|
||
void manage_biggoron_sword_message() { | ||
if (biggoron_sword_message == 1 && | ||
z64_MessageGetState(((uint8_t *)(&z64_game)) + 0x20D8) == 0) { | ||
z64_DisplayTextbox(&z64_game, 0x045E, 0); | ||
biggoron_sword_message = 2; | ||
} | ||
if (biggoron_sword_message == 2) { | ||
MessageContext *msgCtx = &(z64_game.msgContext); | ||
z64_link.common.frozen = 10; | ||
if (Message_ShouldAdvance(&z64_game)) { | ||
if (msgCtx->choiceIndex == 0) { | ||
z64_file.button_items[0] = Z64_ITEM_BIGGORON_SWORD; | ||
Interface_LoadItemIcon1(&z64_game, 0); | ||
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_BIGGORON); | ||
} | ||
biggoron_sword_message = 0; | ||
} | ||
} | ||
} | ||
|
||
void manage_deku_shield_message() { | ||
if (deku_shield_message == 1 && | ||
z64_MessageGetState(((uint8_t *)(&z64_game)) + 0x20D8) == 0) { | ||
z64_DisplayTextbox(&z64_game, 0x045E, 0); | ||
deku_shield_message = 2; | ||
} | ||
if (deku_shield_message == 2) { | ||
MessageContext *msgCtx = &(z64_game.msgContext); | ||
z64_link.common.frozen = 10; | ||
if (Message_ShouldAdvance(&z64_game)) { | ||
if (msgCtx->choiceIndex == 0) { | ||
Inventory_ChangeEquipment(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_DEKU); | ||
} | ||
deku_shield_message = 0; | ||
} | ||
} | ||
} | ||
|
||
void manage_hylian_shield_message() { | ||
if (hylian_shield_message == 1 && | ||
z64_MessageGetState(((uint8_t *)(&z64_game)) + 0x20D8) == 0) { | ||
z64_DisplayTextbox(&z64_game, 0x045E, 0); | ||
hylian_shield_message = 2; | ||
} | ||
if (hylian_shield_message == 2) { | ||
MessageContext *msgCtx = &(z64_game.msgContext); | ||
z64_link.common.frozen = 10; | ||
if (Message_ShouldAdvance(&z64_game)) { | ||
if (msgCtx->choiceIndex == 0) { | ||
Inventory_ChangeEquipment(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_HYLIAN); | ||
} | ||
hylian_shield_message = 0; | ||
} | ||
} | ||
} | ||
|
||
void manage_mirror_shield_message() { | ||
if (mirror_shield_message == 1 && | ||
z64_MessageGetState(((uint8_t *)(&z64_game)) + 0x20D8) == 0) { | ||
z64_DisplayTextbox(&z64_game, 0x045E, 0); | ||
mirror_shield_message = 2; | ||
} | ||
if (mirror_shield_message == 2) { | ||
MessageContext *msgCtx = &(z64_game.msgContext); | ||
z64_link.common.frozen = 10; | ||
if (Message_ShouldAdvance(&z64_game)) { | ||
if (msgCtx->choiceIndex == 0) { | ||
Inventory_ChangeEquipment(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_MIRROR); | ||
} | ||
mirror_shield_message = 0; | ||
} | ||
} | ||
} | ||
|
||
void manage_goron_tunic_message() { | ||
if (goron_tunic_message == 1 && | ||
z64_MessageGetState(((uint8_t *)(&z64_game)) + 0x20D8) == 0) { | ||
z64_DisplayTextbox(&z64_game, 0x045E, 0); | ||
goron_tunic_message = 2; | ||
} | ||
if (goron_tunic_message == 2) { | ||
MessageContext *msgCtx = &(z64_game.msgContext); | ||
z64_link.common.frozen = 10; | ||
if (Message_ShouldAdvance(&z64_game)) { | ||
if (msgCtx->choiceIndex == 0) { | ||
Inventory_ChangeEquipment(EQUIP_TYPE_TUNIC, EQUIP_VALUE_TUNIC_GORON); | ||
} | ||
goron_tunic_message = 0; | ||
} | ||
} | ||
} | ||
|
||
void manage_zora_tunic_message() { | ||
if (zora_tunic_message == 1 && | ||
z64_MessageGetState(((uint8_t *)(&z64_game)) + 0x20D8) == 0) { | ||
z64_DisplayTextbox(&z64_game, 0x045E, 0); | ||
zora_tunic_message = 2; | ||
} | ||
if (zora_tunic_message == 2) { | ||
MessageContext *msgCtx = &(z64_game.msgContext); | ||
z64_link.common.frozen = 10; | ||
if (Message_ShouldAdvance(&z64_game)) { | ||
if (msgCtx->choiceIndex == 0) { | ||
Inventory_ChangeEquipment(EQUIP_TYPE_TUNIC, EQUIP_VALUE_TUNIC_ZORA); | ||
} | ||
zora_tunic_message = 0; | ||
} | ||
} | ||
} | ||
|
||
// Function to display custom textboxes ingame. | ||
void display_misc_messages() { | ||
if (z64_MessageGetState(((uint8_t *)(&z64_game)) + 0x20D8) == 0) { | ||
|
@@ -166,4 +303,97 @@ void display_misc_messages() { | |
treasure_chest_game_show_message = 0; | ||
} | ||
} | ||
if (EQUIPMENT_TEXTBOX & 1 << 0) { | ||
manage_deku_shield_message(); | ||
manage_hylian_shield_message(); | ||
manage_mirror_shield_message(); | ||
} | ||
if (EQUIPMENT_TEXTBOX & 1 << 1) { | ||
manage_kokiri_sword_message(); | ||
manage_biggoron_sword_message(); | ||
} | ||
if (EQUIPMENT_TEXTBOX & 1 << 2) { | ||
manage_goron_tunic_message(); | ||
manage_zora_tunic_message(); | ||
} | ||
} | ||
|
||
void equip_kokiri_sword_message(z64_file_t* save, int16_t arg1, int16_t arg2) { | ||
if (LINK_IS_ADULT) { | ||
return; | ||
} | ||
// If kokiri sword is already equipped. | ||
if (z64_file.equip_sword == 1) { | ||
return; | ||
} | ||
kokiri_sword_message = 1; | ||
} | ||
|
||
void equip_biggoron_sword_message(z64_file_t* save, int16_t arg1, int16_t arg2) { | ||
if (!LINK_IS_ADULT) { | ||
return; | ||
} | ||
// If biggoron sword is already equipped. | ||
if (z64_file.equip_sword == 3) { | ||
return; | ||
} | ||
biggoron_sword_message = 1; | ||
} | ||
|
||
void equip_deku_shield_message(z64_file_t* save, int16_t arg1, int16_t arg2) { | ||
if (LINK_IS_ADULT) { | ||
return; | ||
} | ||
// If a deku shield is already equipped. | ||
if (z64_file.equip_shield == 1) { | ||
return; | ||
} | ||
deku_shield_message = 1; | ||
} | ||
|
||
void equip_hylian_shield_message(z64_file_t* save, int16_t arg1, int16_t arg2) { | ||
// Only ask for child if he has no shield equipped at all. | ||
if (!LINK_IS_ADULT) { | ||
if (z64_file.equip_shield == 1) { | ||
return; | ||
} | ||
} | ||
// If a hylian shield or mirror shield is already equipped. | ||
if (z64_file.equip_shield > 1) { | ||
return; | ||
} | ||
hylian_shield_message = 1; | ||
} | ||
|
||
void equip_mirror_shield_message(z64_file_t* save, int16_t arg1, int16_t arg2) { | ||
if (!LINK_IS_ADULT) { | ||
return; | ||
} | ||
// If mirror shield is already equipped. | ||
if (z64_file.equip_shield == 3) { | ||
return; | ||
} | ||
mirror_shield_message = 1; | ||
} | ||
|
||
void equip_goron_tunic_message(z64_file_t* save, int16_t arg1, int16_t arg2) { | ||
if (!LINK_IS_ADULT) { | ||
return; | ||
} | ||
// If a goron tunic is already equipped. | ||
if (z64_file.equip_tunic == 2) { | ||
return; | ||
} | ||
goron_tunic_message = 1; | ||
} | ||
|
||
void equip_zora_tunic_message(z64_file_t* save, int16_t arg1, int16_t arg2) { | ||
if (!LINK_IS_ADULT) { | ||
return; | ||
} | ||
// If a zora tunic is already equipped. | ||
if (z64_file.equip_shield == 3) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is checking for shield instead of tunic |
||
return; | ||
} | ||
zora_tunic_message = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
#ifndef MESSAGE_H | ||
#define MESSAGE_H | ||
|
||
#include "z64.h" | ||
|
||
void Inventory_ChangeEquipment(int16_t equipment, uint16_t value); | ||
uint8_t Message_ShouldAdvance(z64_game_t* play); | ||
|
||
void equip_kokiri_sword_message(z64_file_t* save, int16_t arg1, int16_t arg2); | ||
void equip_biggoron_sword_message(z64_file_t* save, int16_t arg1, int16_t arg2); | ||
void equip_deku_shield_message(z64_file_t* save, int16_t arg1, int16_t arg2); | ||
void equip_hylian_shield_message(z64_file_t* save, int16_t arg1, int16_t arg2); | ||
void equip_mirror_shield_message(z64_file_t* save, int16_t arg1, int16_t arg2); | ||
void equip_goron_tunic_message(z64_file_t* save, int16_t arg1, int16_t arg2); | ||
void equip_zora_tunic_message(z64_file_t* save, int16_t arg1, int16_t arg2); | ||
void display_misc_messages(); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd put a space above this line