Skip to content

Commit

Permalink
Add Hearts requirements for LACS and Bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
HylianFreddy committed Jul 22, 2023
1 parent 3042ce7 commit 0b312a9
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 11 deletions.
2 changes: 2 additions & 0 deletions code/src/actors/rainbow_bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ u32 BgGjyoBridge_CheckCondition(void) {
return BgGjyoBridge_ConditionDungeons();
case RAINBOWBRIDGE_TOKENS:
return gSaveContext.gsTokens >= gSettingsContext.bridgeTokenCount;
case RAINBOWBRIDGE_HEARTS:
return gSaveContext.healthCapacity >= gSettingsContext.bridgeHeartCount * 16;
default:
return BgGjyoBridge_ConditionVanilla();
}
Expand Down
2 changes: 2 additions & 0 deletions code/src/cutscenes.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ void Cutscene_OverrideLACS(void) {
break;
case LACSCONDITION_TOKENS:
conditionMet = LACS_ConditionTokens();
case LACSCONDITION_HEARTS:
conditionMet = gSaveContext.healthCapacity >= gSettingsContext.lacsHeartCount * 16;
break;
}
if (conditionMet) {
Expand Down
5 changes: 5 additions & 0 deletions code/src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ typedef enum {
RAINBOWBRIDGE_REWARDS,
RAINBOWBRIDGE_DUNGEONS,
RAINBOWBRIDGE_TOKENS,
RAINBOWBRIDGE_HEARTS,
} RainbowBridgeSetting;

typedef enum {
Expand All @@ -78,6 +79,7 @@ typedef enum {
LACSCONDITION_REWARDS,
LACSCONDITION_DUNGEONS,
LACSCONDITION_TOKENS,
LACSCONDITION_HEARTS,
} LACSConditionSetting;

typedef enum {
Expand Down Expand Up @@ -235,6 +237,7 @@ typedef enum {
GANONSBOSSKEY_LACS_REWARDS,
GANONSBOSSKEY_LACS_DUNGEONS,
GANONSBOSSKEY_LACS_TOKENS,
GANONSBOSSKEY_LACS_HEARTS,
} GanonsBossKeySetting;

typedef enum {
Expand Down Expand Up @@ -467,6 +470,7 @@ typedef struct {
u8 bridgeRewardCount;
u8 bridgeDungeonCount;
u8 bridgeTokenCount;
u8 bridgeHeartCount;
u8 randomGanonsTrials;
u8 ganonsTrialsCount;

Expand Down Expand Up @@ -522,6 +526,7 @@ typedef struct {
u8 lacsRewardCount;
u8 lacsDungeonCount;
u8 lacsTokenCount;
u8 lacsHeartCount;

u8 ringFortress;
u8 ringForest;
Expand Down
6 changes: 6 additions & 0 deletions source/descriptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ string_view bridgeDungeons = "The Rainbow Bridge requires completing
"into the blue warp at the end of them."; //
string_view bridgeTokens = "The Rainbow Bridge requires collecting a\n" //
"configurable number of Gold Skulltula Tokens."; //
string_view bridgeHearts = "The Rainbow Bridge requires collecting a\n" //
"configurable number of Hearts."; //
/*------------------------------ //
| BRIDGE CONDITIONS | //
------------------------------*/ //
Expand All @@ -162,6 +164,8 @@ string_view bridgeDungeonCountDesc = "Set the number of completed dungeons re
"spawn the Rainbow Bridge."; //
string_view bridgeTokenCountDesc = "Set the number of Gold Skulltula Tokens required\n"
"to spawn the Rainbow Bridge."; //
string_view bridgeHeartCountDesc = "Set the number of Hearts required to spawn the\n" //
"Rainbow Bridge."; //
/*------------------------------ //
| RANDOM GANONS TRIALS | //
------------------------------*/ //
Expand Down Expand Up @@ -643,6 +647,8 @@ string_view lacsDungeonCountDesc = "Set the number of completed dungeons re
"into the blue warp at the end of them."; //
string_view lacsTokenCountDesc = "Set the number of Gold Skulltula Tokens required\n"
"to trigger the Light Arrow Cutscene."; //
string_view lacsHeartCountDesc = "Set the number of Hearts required to trigger the\n"
"Light Arrow Cutscene."; //
/*------------------------------ //
| SKIP CHILD STEALTH | //
------------------------------*/ //
Expand Down
3 changes: 3 additions & 0 deletions source/descriptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@ extern string_view bridgeMedallions;
extern string_view bridgeRewards;
extern string_view bridgeDungeons;
extern string_view bridgeTokens;
extern string_view bridgeHearts;

extern string_view bridgeStoneCountDesc;
extern string_view bridgeMedallionCountDesc;
extern string_view bridgeRewardCountDesc;
extern string_view bridgeDungeonCountDesc;
extern string_view bridgeTokenCountDesc;
extern string_view bridgeHeartCountDesc;

extern string_view randomGanonsTrialsDesc;

Expand Down Expand Up @@ -207,6 +209,7 @@ extern string_view lacsStoneCountDesc;
extern string_view lacsRewardCountDesc;
extern string_view lacsDungeonCountDesc;
extern string_view lacsTokenCountDesc;
extern string_view lacsHeartCountDesc;

extern string_view childStealthDesc;

Expand Down
18 changes: 18 additions & 0 deletions source/hint_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1855,6 +1855,15 @@ void HintTable_Init() {
/*german*/"Die Weisen werden darauf&warten, dass der Held #%d&|Skulltula-Symbol|Skulltula-Symbole|# sammelt."},
});

hintTable[BRIDGE_HEARTS_HINT] = HintText::Bridge({
// obscure text
Text{"The awakened ones will await for the&Hero to collect #%d |Heart|Hearts|#.",
/*french*/"Les êtres de sagesse attendront le&héros muni de #%d |cœur|cœurs|#.",
/*spanish*/"Los sabios aguardarán a que el héroe&obtenga #%d |corazón|corazones|#.",
/*italian*/"I Saggi aspetteranno che l'Eroe&ottenga #%d |cuore|cuori|#.",
/*german*/"Die Weisen werden darauf&warten, dass der Held #%d&|Herz|Herzen|# sammelt."},
});

/*--------------------------
| GANON BOSS KEY HINT TEXT |
---------------------------*/
Expand Down Expand Up @@ -1979,6 +1988,15 @@ void HintTable_Init() {
/*italian*/"E la chiave del #re del male# sarà&ricevuta da Zelda dopo aver ottenuto&#%d |teschio|teschi| d'oro#.",
/*german*/"Und der #Schlüssel des Bösen# wird&von Zelda verliehen, sobald #%d&|Skulltula-Symbol# gesammelt wurde|Skulltula-Symbole# gesammelt wurden|."},
});

hintTable[LACS_HEARTS_HINT] = HintText::LACS({
// obscure text singular plural
Text{"And the #evil one#'s key will be&provided by Zelda once #%d |Heart#&is|Hearts#&are| retrieved.",
/*french*/"Aussi, Zelda crééra la clé du&#Malin# avec #%d |cœur|cœurs|#.",
/*spanish*/"Y Zelda entregará la llave&del #señor del mal# tras obtener&#%d |corazón|corazones|#.",
/*italian*/"E la chiave del #re del male# sarà&ricevuta da Zelda dopo aver ottenuto&#%d |cuore|cuori|#.",
/*german*/"Und der #Schlüssel des Bösen# wird&von Zelda verliehen, sobald #%d&|Herz# gesammelt wurde|Herzen# gesammelt wurden|."},
});
/*--------------------------
| TRIAL HINT TEXT |
---------------------------*/
Expand Down
6 changes: 6 additions & 0 deletions source/hints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,9 @@ static Text BuildBridgeReqsText() {

} else if (Bridge.Is(RAINBOWBRIDGE_TOKENS)) {
bridgeText = BuildCountReq(BRIDGE_TOKENS_HINT, BridgeTokenCount);

} else if (Bridge.Is(RAINBOWBRIDGE_HEARTS)) {
bridgeText = BuildCountReq(BRIDGE_HEARTS_HINT, BridgeHeartCount);
}

return Text() + ITEM_OBTAINED(ITEM_ARROW_LIGHT) + bridgeText + "^";
Expand Down Expand Up @@ -709,6 +712,9 @@ static Text BuildGanonBossKeyText() {

} else if (GanonsBossKey.Is(GANONSBOSSKEY_LACS_TOKENS)) {
ganonBossKeyText = BuildCountReq(LACS_TOKENS_HINT, LACSTokenCount);

} else if (GanonsBossKey.Is(GANONSBOSSKEY_LACS_HEARTS)) {
ganonBossKeyText = BuildCountReq(LACS_HEARTS_HINT, LACSHeartCount);
}

return Text() + ITEM_OBTAINED(ITEM_KEY_BOSS) + ganonBossKeyText + "^";
Expand Down
2 changes: 2 additions & 0 deletions source/keys.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1674,6 +1674,7 @@ typedef enum {
BRIDGE_REWARDS_HINT,
BRIDGE_DUNGEONS_HINT,
BRIDGE_TOKENS_HINT,
BRIDGE_HEARTS_HINT,

GANON_BK_START_WITH_HINT,
GANON_BK_VANILLA_HINT,
Expand All @@ -1689,6 +1690,7 @@ typedef enum {
LACS_REWARDS_HINT,
LACS_DUNGEONS_HINT,
LACS_TOKENS_HINT,
LACS_HEARTS_HINT,

SIX_TRIALS,
ZERO_TRIALS,
Expand Down
6 changes: 4 additions & 2 deletions source/logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,15 +812,17 @@ void UpdateHelpers() {
(Bridge.Is(RAINBOWBRIDGE_MEDALLIONS) && MedallionCount >= BridgeMedallionCount.Value<u8>()) ||
(Bridge.Is(RAINBOWBRIDGE_REWARDS) && StoneCount + MedallionCount >= BridgeRewardCount.Value<u8>()) ||
(Bridge.Is(RAINBOWBRIDGE_DUNGEONS) && DungeonCount >= BridgeDungeonCount.Value<u8>()) ||
(Bridge.Is(RAINBOWBRIDGE_TOKENS) && GoldSkulltulaTokens >= BridgeTokenCount.Value<u8>());
(Bridge.Is(RAINBOWBRIDGE_TOKENS) && GoldSkulltulaTokens >= BridgeTokenCount.Value<u8>()) ||
(Bridge.Is(RAINBOWBRIDGE_HEARTS) && Hearts >= BridgeHeartCount.Value<u8>());

CanTriggerLACS =
(LACSCondition == LACSCONDITION_VANILLA && ShadowMedallion && SpiritMedallion) ||
(LACSCondition == LACSCONDITION_STONES && StoneCount >= LACSStoneCount.Value<u8>()) ||
(LACSCondition == LACSCONDITION_MEDALLIONS && MedallionCount >= LACSMedallionCount.Value<u8>()) ||
(LACSCondition == LACSCONDITION_REWARDS && StoneCount + MedallionCount >= LACSRewardCount.Value<u8>()) ||
(LACSCondition == LACSCONDITION_DUNGEONS && DungeonCount >= LACSDungeonCount.Value<u8>()) ||
(LACSCondition == LACSCONDITION_TOKENS && GoldSkulltulaTokens >= LACSTokenCount.Value<u8>());
(LACSCondition == LACSCONDITION_TOKENS && GoldSkulltulaTokens >= LACSTokenCount.Value<u8>()) ||
(LACSCondition == LACSCONDITION_HEARTS && Hearts >= LACSHeartCount.Value<u8>());
}

bool SmallKeys(Key dungeon, u8 requiredAmount) {
Expand Down
9 changes: 8 additions & 1 deletion source/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ void MoveCursor(u32 kDown, bool updatedByHeld) {

void MenuUpdate(u32 kDown, bool updatedByHeld) {
consoleSelect(&bottomScreen);
consoleClear();
if (currentMenu->mode != POST_GENERATE || (kDown & KEY_B)) {
// Don't clear console if ValidateSettings printed error
consoleClear();
}

// Check for menu change
// If user pressed A on a non-option, non-action menu, they're navigating to a new menu
Expand Down Expand Up @@ -707,6 +710,10 @@ static void RestoreOverrides() {

void GenerateRandomizer() {

if (!Settings::ValidateSettings()) {
return;
}

consoleSelect(&topScreen);
consoleClear();
printf("\x1b[6;10HCaching Settings...");
Expand Down
Loading

0 comments on commit 0b312a9

Please sign in to comment.