mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-10 19:45:09 -05:00
Fix some bugs with settings (#3525)
* Fixes off by one errors for a few settings. * Removes disable of shuffle options when starting with corresponding items. * Junks checks when shuffle is off and start with is on.
This commit is contained in:
parent
36e030e339
commit
4978c3b34f
@ -670,7 +670,7 @@ void GenerateItemPool() {
|
||||
|
||||
if (ctx->GetOption(RSK_TRIFORCE_HUNT)) {
|
||||
ctx->possibleIceTrapModels.push_back(RG_TRIFORCE_PIECE);
|
||||
AddItemToMainPool(RG_TRIFORCE_PIECE, ctx->GetOption(RSK_TRIFORCE_HUNT_PIECES_TOTAL).Value<uint8_t>());
|
||||
AddItemToMainPool(RG_TRIFORCE_PIECE, (ctx->GetOption(RSK_TRIFORCE_HUNT_PIECES_TOTAL).Value<uint8_t>() + 1));
|
||||
ctx->PlaceItemInLocation(RC_TRIFORCE_COMPLETED, RG_TRIFORCE); // Win condition
|
||||
ctx->PlaceItemInLocation(RC_GANON, GetJunkItem(), false, true);
|
||||
} else {
|
||||
@ -685,14 +685,18 @@ void GenerateItemPool() {
|
||||
AddItemToMainPool(RG_KOKIRI_SWORD);
|
||||
ctx->possibleIceTrapModels.push_back(RG_KOKIRI_SWORD);
|
||||
} else {
|
||||
ctx->PlaceItemInLocation(RC_KF_KOKIRI_SWORD_CHEST, RG_KOKIRI_SWORD, false, true);
|
||||
if (!ctx->GetOption(RSK_STARTING_KOKIRI_SWORD)) {
|
||||
ctx->PlaceItemInLocation(RC_KF_KOKIRI_SWORD_CHEST, RG_KOKIRI_SWORD, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->GetOption(RSK_SHUFFLE_MASTER_SWORD)) {
|
||||
AddItemToMainPool(RG_MASTER_SWORD);
|
||||
ctx->possibleIceTrapModels.push_back(RG_MASTER_SWORD); //Master Sword without the GI enum
|
||||
} else {
|
||||
ctx->PlaceItemInLocation(RC_TOT_MASTER_SWORD, RG_MASTER_SWORD, false, true);
|
||||
if (!ctx->GetOption(RSK_STARTING_MASTER_SWORD)) {
|
||||
ctx->PlaceItemInLocation(RC_TOT_MASTER_SWORD, RG_MASTER_SWORD, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->GetOption(RSK_SHUFFLE_WEIRD_EGG)) {
|
||||
@ -709,8 +713,14 @@ void GenerateItemPool() {
|
||||
}
|
||||
ctx->possibleIceTrapModels.push_back(RG_PROGRESSIVE_OCARINA); //Progressive ocarina
|
||||
} else {
|
||||
ctx->PlaceItemInLocation(RC_LW_GIFT_FROM_SARIA, RG_PROGRESSIVE_OCARINA, false, true);
|
||||
ctx->PlaceItemInLocation(RC_HF_OCARINA_OF_TIME_ITEM, RG_PROGRESSIVE_OCARINA, false, true);
|
||||
if (ctx->GetOption(RSK_STARTING_OCARINA).Is(RO_STARTING_OCARINA_OFF)) {
|
||||
ctx->PlaceItemInLocation(RC_LW_GIFT_FROM_SARIA, RG_PROGRESSIVE_OCARINA, false, true);
|
||||
ctx->PlaceItemInLocation(RC_HF_OCARINA_OF_TIME_ITEM, RG_PROGRESSIVE_OCARINA, false, true);
|
||||
} else {
|
||||
if (ctx->GetOption(RSK_STARTING_OCARINA).IsNot(RO_STARTING_OCARINA_TIME)) {
|
||||
ctx->PlaceItemInLocation(RC_HF_OCARINA_OF_TIME_ITEM, RG_PROGRESSIVE_OCARINA, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->GetOption(RSK_SHUFFLE_COWS)) {
|
||||
|
@ -668,7 +668,7 @@ namespace Logic {
|
||||
(ctx->GetSettings()->LACSCondition() == RO_LACS_REWARDS && StoneCount + MedallionCount + (Greg && GregInLacsLogic ? 1 : 0) >= ctx->GetOption(RSK_LACS_REWARD_COUNT).Value<uint8_t>()) ||
|
||||
(ctx->GetSettings()->LACSCondition() == RO_LACS_DUNGEONS && DungeonCount + (Greg && GregInLacsLogic ? 1 : 0) >= ctx->GetOption(RSK_LACS_DUNGEON_COUNT).Value<uint8_t>()) ||
|
||||
(ctx->GetSettings()->LACSCondition() == RO_LACS_TOKENS && GoldSkulltulaTokens >= ctx->GetOption(RSK_LACS_TOKEN_COUNT).Value<uint8_t>());
|
||||
CanCompleteTriforce = TriforcePieces >= ctx->GetOption(RSK_TRIFORCE_HUNT_PIECES_REQUIRED).Value<uint8_t>();
|
||||
CanCompleteTriforce = TriforcePieces >= ctx->GetOption(RSK_TRIFORCE_HUNT_PIECES_REQUIRED).Value<uint8_t>() + 1;
|
||||
}
|
||||
|
||||
bool SmallKeys(RandomizerRegion dungeon, uint8_t requiredAmount) {
|
||||
|
@ -240,7 +240,7 @@ extern "C" void Randomizer_DrawTriforcePieceGI(PlayState* play, GetItemEntry get
|
||||
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
|
||||
|
||||
uint8_t current = gSaveContext.triforcePiecesCollected;
|
||||
uint8_t required = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED);
|
||||
uint8_t required = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED) + 1;
|
||||
|
||||
Matrix_Scale(triforcePieceScale, triforcePieceScale, triforcePieceScale, MTXMODE_APPLY);
|
||||
|
||||
|
@ -2722,7 +2722,7 @@ void CreateTriforcePieceMessages() {
|
||||
CustomMessage Randomizer::GetTriforcePieceMessage() {
|
||||
// Item is only given after the textbox, so reflect that inside the textbox.
|
||||
uint8_t current = gSaveContext.triforcePiecesCollected + 1;
|
||||
uint8_t required = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED);
|
||||
uint8_t required = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED) + 1;
|
||||
uint8_t remaining = required - current;
|
||||
float percentageCollected = (float)current / (float)required;
|
||||
uint8_t messageIndex;
|
||||
|
@ -3749,6 +3749,7 @@ typedef enum {
|
||||
typedef enum {
|
||||
RO_STARTING_OCARINA_OFF,
|
||||
RO_STARTING_OCARINA_FAIRY,
|
||||
RO_STARTING_OCARINA_TIME,
|
||||
} RandoOptionStartingOcarina;
|
||||
|
||||
//Item Pool Settings
|
||||
|
@ -528,8 +528,8 @@ void DrawItemCount(ItemTrackerItem item) {
|
||||
std::string currentString = "";
|
||||
std::string requiredString = "";
|
||||
std::string maxString = "";
|
||||
uint8_t piecesRequired = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED);
|
||||
uint8_t piecesTotal = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT_PIECES_TOTAL);
|
||||
uint8_t piecesRequired = (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED) + 1);
|
||||
uint8_t piecesTotal = (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT_PIECES_TOTAL) + 1);
|
||||
ImU32 currentColor = gSaveContext.triforcePiecesCollected >= piecesRequired ? IM_COL_GREEN : IM_COL_WHITE;
|
||||
ImU32 maxColor = IM_COL_GREEN;
|
||||
int32_t trackerTriforcePieceNumberDisplayMode = CVarGetInteger("gItemTrackerTriforcePieceTrack", TRIFORCE_PIECE_COLLECTED_REQUIRED_MAX);
|
||||
|
@ -357,7 +357,7 @@ extern "C" void Randomizer_InitSaveFile() {
|
||||
Flags_SetRandomizerInf(RAND_INF_TOT_MASTER_SWORD);
|
||||
}
|
||||
|
||||
HIGH_SCORE(HS_POE_POINTS) = 1000 - (100 * Randomizer_GetSettingValue(RSK_BIG_POE_COUNT));
|
||||
HIGH_SCORE(HS_POE_POINTS) = 1000 - (100 * (Randomizer_GetSettingValue(RSK_BIG_POE_COUNT) + 1));
|
||||
|
||||
if (Randomizer_GetSettingValue(RSK_SKIP_EPONA_RACE)) {
|
||||
Flags_SetEventChkInf(EVENTCHKINF_EPONA_OBTAINED);
|
||||
|
@ -1406,24 +1406,6 @@ void Settings::UpdateOptionProperties() {
|
||||
mOptions[RSK_MIX_INTERIOR_ENTRANCES].Hide();
|
||||
mOptions[RSK_MIX_GROTTO_ENTRANCES].Hide();
|
||||
}
|
||||
// Shuffle Kokiri Sword - Disabled when Start with Kokiri Sword is active
|
||||
if (CVarGetInteger("gRandomizeStartingKokiriSword", RO_GENERIC_OFF)) {
|
||||
mOptions[RSK_SHUFFLE_KOKIRI_SWORD].Disable("This option is disabled because \"Start with Kokiri Sword\" is enabled.");
|
||||
} else {
|
||||
mOptions[RSK_SHUFFLE_KOKIRI_SWORD].Enable();
|
||||
}
|
||||
// Shuffle Master Sword - Disabled when Start with Master Sword is active
|
||||
if (CVarGetInteger("gRandomizeStartingMasterSword", RO_GENERIC_OFF)) {
|
||||
mOptions[RSK_SHUFFLE_MASTER_SWORD].Disable("This option is disabled because \"Start with Master Sword\" is enabled");
|
||||
} else {
|
||||
mOptions[RSK_SHUFFLE_MASTER_SWORD].Enable();
|
||||
}
|
||||
// Shuffle Ocarinas - Disabled when Start with Ocarina is active
|
||||
if (CVarGetInteger("gRandomizeStartingOcarina", RO_STARTING_OCARINA_OFF)) {
|
||||
mOptions[RSK_SHUFFLE_OCARINA].Disable("This option is disabled because \"Start with Fairy Ocarina\" is enabled.");
|
||||
} else {
|
||||
mOptions[RSK_SHUFFLE_OCARINA].Enable();
|
||||
}
|
||||
// Shuffle Weird Egg - Disabled when Skip Child Zelda is active
|
||||
if (CVarGetInteger("gRandomizeSkipChildZelda", RO_GENERIC_DONT_SKIP)) {
|
||||
mOptions[RSK_SHUFFLE_WEIRD_EGG].Disable("This option is disabled because \"Skip Child Zelda\" is enabled.");
|
||||
@ -1497,7 +1479,7 @@ void Settings::UpdateOptionProperties() {
|
||||
mOptions[RSK_KEYRINGS_GERUDO_FORTRESS].Enable();
|
||||
}
|
||||
if (CVarGetInteger("gRandomizeTriforceHunt", RO_GENERIC_OFF)) {
|
||||
mOptions[RSK_GANONS_BOSS_KEY].Disable("This option is disabled because Triforcce Hunt is enabled."
|
||||
mOptions[RSK_GANONS_BOSS_KEY].Disable("This option is disabled because Triforce Hunt is enabled."
|
||||
"Ganon's Boss key\nwill instead be given to you after Triforce Hunt completion.");
|
||||
} else {
|
||||
mOptions[RSK_GANONS_BOSS_KEY].Enable();
|
||||
@ -1678,21 +1660,6 @@ void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocatio
|
||||
mOptions[RSK_MQ_DUNGEON_SET].SetSelectedIndex(RO_GENERIC_OFF);
|
||||
}
|
||||
|
||||
// TODO: Historically we have forced the shuffle settings off when we have the corresponding start
|
||||
// with setting on, but 3drando doesn't seem to actually do that. It seems like you can both shuffle
|
||||
// them in the pool and start with them.
|
||||
if (mOptions[RSK_STARTING_KOKIRI_SWORD]) {
|
||||
mOptions[RSK_SHUFFLE_KOKIRI_SWORD].SetSelectedIndex(RO_GENERIC_OFF);
|
||||
}
|
||||
|
||||
if (mOptions[RSK_STARTING_MASTER_SWORD]) {
|
||||
mOptions[RSK_SHUFFLE_MASTER_SWORD].SetSelectedIndex(RO_GENERIC_OFF);
|
||||
}
|
||||
|
||||
if (mOptions[RSK_STARTING_OCARINA].IsNot(RO_STARTING_OCARINA_OFF)) {
|
||||
mOptions[RSK_SHUFFLE_OCARINA].SetSelectedIndex(RO_GENERIC_OFF);
|
||||
}
|
||||
|
||||
// If any of the individual shuffle settings are on, turn on the main Shuffle Entrances option
|
||||
if (mOptions[RSK_SHUFFLE_DUNGEON_ENTRANCES].IsNot(RO_DUNGEON_ENTRANCE_SHUFFLE_OFF)
|
||||
|| mOptions[RSK_SHUFFLE_BOSS_ENTRANCES].IsNot(RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF)
|
||||
@ -1719,6 +1686,24 @@ void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocatio
|
||||
for (const auto randomizerTrick : enabledTricks) {
|
||||
mTrickOptions[randomizerTrick].SetSelectedIndex(1);
|
||||
}
|
||||
if (!mOptions[RSK_SHUFFLE_KOKIRI_SWORD]) {
|
||||
if (mOptions[RSK_STARTING_KOKIRI_SWORD]) {
|
||||
ctx->GetItemLocation(RC_KF_KOKIRI_SWORD_CHEST)->GetExcludedOption()->SetSelectedIndex(1);
|
||||
}
|
||||
}
|
||||
if (!mOptions[RSK_SHUFFLE_MASTER_SWORD]) {
|
||||
if (mOptions[RSK_STARTING_MASTER_SWORD]) {
|
||||
ctx->GetItemLocation(RC_MASTER_SWORD_PEDESTAL)->GetExcludedOption()->SetSelectedIndex(1);
|
||||
}
|
||||
}
|
||||
if (!mOptions[RSK_SHUFFLE_OCARINA]) {
|
||||
if (mOptions[RSK_STARTING_OCARINA].IsNot(RO_STARTING_OCARINA_OFF)) {
|
||||
ctx->GetItemLocation(RC_LW_GIFT_FROM_SARIA)->GetExcludedOption()->SetSelectedIndex(1);
|
||||
if (mOptions[RSK_STARTING_OCARINA].Is(RO_STARTING_OCARINA_TIME)) {
|
||||
ctx->GetItemLocation(RC_HF_OCARINA_OF_TIME_ITEM)->GetExcludedOption()->SetSelectedIndex(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// RANDOTODO implement chest shuffle with keysanity
|
||||
|
@ -2612,7 +2612,7 @@ u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) {
|
||||
GameInteractor_SetTriforceHuntPieceGiven(true);
|
||||
|
||||
// Teleport to credits when goal is reached.
|
||||
if (gSaveContext.triforcePiecesCollected == Randomizer_GetSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED)) {
|
||||
if (gSaveContext.triforcePiecesCollected == (Randomizer_GetSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED) + 1)) {
|
||||
gSaveContext.sohStats.itemTimestamp[TIMESTAMP_TRIFORCE_COMPLETED] = GAMEPLAYSTAT_TOTAL_TIME;
|
||||
gSaveContext.sohStats.gameComplete = 1;
|
||||
Flags_SetRandomizerInf(RAND_INF_GRANT_GANONS_BOSSKEY);
|
||||
|
@ -2362,7 +2362,7 @@ void Play_PerformSave(PlayState* play) {
|
||||
|
||||
uint8_t triforceHuntCompleted =
|
||||
IS_RANDO &&
|
||||
gSaveContext.triforcePiecesCollected == Randomizer_GetSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED) &&
|
||||
gSaveContext.triforcePiecesCollected == (Randomizer_GetSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED) + 1) &&
|
||||
Randomizer_GetSettingValue(RSK_TRIFORCE_HUNT);
|
||||
if (CVarGetInteger("gAutosave", AUTOSAVE_OFF) != AUTOSAVE_OFF || triforceHuntCompleted) {
|
||||
Overlay_DisplayText(3.0f, "Game Saved");
|
||||
|
Loading…
Reference in New Issue
Block a user