Skip to content

Commit b006047

Browse files
authored
Merge pull request #164 from SuperDude88/legacy-race-mode
Generalize Race Mode Terms
2 parents 8f0d2a7 + 5fa0bed commit b006047

13 files changed

Lines changed: 141 additions & 148 deletions

gui/desktop/mainwindow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ void MainWindow::apply_config_settings()
545545
APPLY_SPINBOX_SETTING(config, ui, damage_multiplier, float(2.0f), float(MAXIMUM_DAMAGE_MULTIPLIER));
546546

547547
auto& num_required_dungeons = config.settings.num_required_dungeons;
548-
// Race mode dungeons must be between 1 and 6 if race mode is enabled
548+
// Required dungeons must be between 1 and 6 if race mode is enabled
549549
if (config.settings.progression_dungeons == ProgressionDungeons::RaceMode)
550550
{
551551
num_required_dungeons = std::clamp(num_required_dungeons, uint8_t(1), uint8_t(MAXIMUM_NUM_DUNGEONS));
@@ -771,7 +771,7 @@ DEFINE_STATE_CHANGE_FUNCTION(progression_combat_secret_caves)
771771
void MainWindow::on_progression_dungeons_currentTextChanged(const QString &arg1)
772772
{
773773
config.settings.progression_dungeons = nameToProgressionDungeons(arg1.toStdString());
774-
// Grey out the race mode dungeons combobox if race mode/standard is not selected
774+
// Grey out the required dungeons combobox if dungeons are disabled
775775
if (config.settings.progression_dungeons == ProgressionDungeons::RaceMode)
776776
{
777777
ui->num_required_dungeons->setEnabled(true);

logic/Dungeon.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ struct Dungeon {
1616
Item map = Item();
1717
Item compass = Item();
1818
std::list<Location*> locations = {};
19-
Location* raceModeLocation = nullptr;
19+
Location* bossLocation = nullptr;
2020
Area* startingArea = nullptr;
2121
Entrance* startingEntrance = nullptr;
2222
std::list<std::string> islands = {};
2323
std::string name = "";
2424
bool isRequiredDungeon = false;
25-
bool hasNaturalRaceModeLocation = false;
25+
bool hasNaturalBossLocation = false;
2626
std::string windWarpExitStage = "";
2727
uint8_t windWarpExitRoom = 0;
2828
uint8_t windWarpExitSpawn = 0;

logic/EntranceShuffle.cpp

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -306,25 +306,24 @@ static EntranceShuffleError validateWorld(WorldPool& worlds, const Entrance* ent
306306

307307
for (auto& world : worlds)
308308
{
309-
// Ensure that all race mode bosses are assigned to a single island
309+
// Ensure that all required bosses are assigned to a single island
310310
auto& settings = world.getSettings();
311311
if (settings.progression_dungeons != ProgressionDungeons::Disabled && settings.num_required_dungeons > 0)
312312
{
313-
std::unordered_set<std::string> raceModeIslands = {};
314-
for (auto loc : world.raceModeLocations)
313+
for (auto loc : world.bossLocations)
315314
{
316-
auto bossIslands = loc->accessPoints.front()->area->findIslands();
315+
const auto& bossIslands = loc->accessPoints.front()->area->findIslands();
317316

318317
if (bossIslands.size() > 1)
319318
{
320319
#ifdef ENABLE_DEBUG
321-
LOG_TO_DEBUG("Error: More than 1 island leading to race mode boss room " + loc->accessPoints.front()->area->name);
320+
LOG_TO_DEBUG("Error: More than 1 island leading to required boss room " + loc->accessPoints.front()->area->name);
322321
for (auto& island : bossIslands)
323322
{
324323
LOG_TO_DEBUG("\t" + island);
325324
}
326325
#endif
327-
return EntranceShuffleError::AMBIGUOUS_RACE_MODE_ISLAND;
326+
return EntranceShuffleError::AMBIGUOUS_BOSS_ISLAND;
328327
}
329328
}
330329
}
@@ -952,7 +951,7 @@ EntranceShuffleError randomizeEntrances(WorldPool& worlds)
952951
}
953952
}
954953

955-
// Now set the islands the race mode dungeons are in
954+
// Now set the islands the dungeons are in
956955
for (auto& [name, dungeon] : world.dungeons)
957956
{
958957
dungeon.islands = dungeon.startingArea->findIslands();
@@ -982,12 +981,8 @@ const std::string errorToName(EntranceShuffleError err)
982981
return "NO_MORE_VALID_ENTRANCES";
983982
case EntranceShuffleError::ALL_LOCATIONS_NOT_REACHABLE:
984983
return "ALL_LOCATIONS_NOT_REACHABLE";
985-
case EntranceShuffleError::AMBIGUOUS_RACE_MODE_ISLAND:
986-
return "AMBIGUOUS_RACE_MODE_ISLAND";
987-
case EntranceShuffleError::AMBIGUOUS_RACE_MODE_DUNGEON:
988-
return "AMBIGUOUS_RACE_MODE_DUNGEON";
989-
case EntranceShuffleError::NO_RACE_MODE_ISLAND:
990-
return "NO_RACE_MODE_ISLAND";
984+
case EntranceShuffleError::AMBIGUOUS_BOSS_ISLAND:
985+
return "AMBIGUOUS_BOSS_ISLAND";
991986
case EntranceShuffleError::NOT_ENOUGH_SPHERE_ZERO_LOCATIONS:
992987
return "NOT_ENOUGH_SPHERE_ZERO_LOCATIONS";
993988
case EntranceShuffleError::ATTEMPTED_SELF_CONNECTION:

logic/EntranceShuffle.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ enum struct EntranceShuffleError
1212
RAN_OUT_OF_RETRIES,
1313
NO_MORE_VALID_ENTRANCES,
1414
ALL_LOCATIONS_NOT_REACHABLE,
15-
AMBIGUOUS_RACE_MODE_ISLAND,
16-
AMBIGUOUS_RACE_MODE_DUNGEON,
17-
NO_RACE_MODE_ISLAND,
15+
AMBIGUOUS_BOSS_ISLAND,
1816
NOT_ENOUGH_SPHERE_ZERO_LOCATIONS,
1917
ATTEMPTED_SELF_CONNECTION,
2018
FAILED_TO_DISCONNECT_TARGET,

logic/Fill.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,7 @@ void placeVanillaItems(WorldPool& worlds)
323323
// Determine which items are major items. A major item is any item required
324324
// for access to any progression location and/or game beatability. This function
325325
// is called multiple times during the fill algorithm as the items required for
326-
// beatability may change depending on which items are placed in race mode locations
327-
// and/or plandomized
326+
// beatability may change depending on which items are placed in boss locations and/or plandomized
328327
void determineMajorItems(WorldPool& worlds, ItemPool& itemPool, LocationPool& allLocations)
329328
{
330329
LOG_TO_DEBUG("Determining Major Items");
@@ -405,7 +404,7 @@ static FillError randomizeOwnDungeon(WorldPool& worlds, ItemPool& itemPool)
405404
{
406405
// Filter to only the dungeons locations which are progression locations
407406
// If dungeons are not progression locations, or if race mode is on
408-
// and this isn't a race mode dungeon, then take all locations in
407+
// and this isn't a required dungeon, then take all locations in
409408
// the dungeon since none of them are progression anyway
410409
auto worldLocations = world.getLocations();
411410
auto dungeonLocations = filterFromPool(worldLocations, [&dungeon = dungeon, &settings = settings](const Location* loc){
@@ -586,66 +585,67 @@ static FillError handleDungeonItems(WorldPool& worlds, ItemPool& itemPool)
586585
return FillError::NONE;
587586
}
588587

589-
static void generateRaceModeItems(const LocationPool& raceModeLocations, ItemPool& raceModeItems, ItemPool& itemsToChooseFrom, ItemPool& mainItemPool)
588+
static void generateBossItems(const LocationPool& bossLocations, ItemPool& chosenItems, ItemPool& itemsToChooseFrom, ItemPool& mainItemPool)
590589
{
591590
shufflePool(itemsToChooseFrom);
592-
while (!itemsToChooseFrom.empty() && raceModeItems.size() < raceModeLocations.size())
591+
while (!itemsToChooseFrom.empty() && chosenItems.size() < bossLocations.size())
593592
{
594-
raceModeItems.push_back(popRandomElement(itemsToChooseFrom));
593+
chosenItems.push_back(popRandomElement(itemsToChooseFrom));
595594
}
596595
// Add back any unused elements
597596
addElementsToPool(mainItemPool, itemsToChooseFrom);
598597
}
599598

600599
// Place progression items in specific locations at the end of dungeons to require the player
601600
// to beat those dungeons.
602-
static FillError placeRaceModeItems(WorldPool& worlds, ItemPool& itemPool, LocationPool& allLocations)
601+
static FillError placeBossItems(WorldPool& worlds, ItemPool& itemPool, LocationPool& allLocations)
603602
{
604-
LocationPool raceModeLocations;
605-
ItemPool raceModeItems;
603+
LocationPool bossLocations;
604+
ItemPool bossItems;
606605
for (auto& world : worlds)
607606
{
608607
if(world.getSettings().required_boss_items) {
609608
for (auto& [name, dungeon] : world.dungeons)
610609
{
611610
if (dungeon.isRequiredDungeon)
612611
{
613-
auto raceModeLocation = dungeon.raceModeLocation;
612+
auto bossLocation = dungeon.bossLocation;
614613
// If this location already has an item placed at it, then skip it
615-
if (raceModeLocation->currentItem.getGameItemId() != GameItem::INVALID)
614+
if (bossLocation->currentItem.getGameItemId() != GameItem::INVALID)
616615
{
617616
continue;
618617
}
619-
raceModeLocations.push_back(raceModeLocation);
618+
bossLocations.push_back(bossLocation);
620619
}
621620
}
622621
}
623622
}
624623

625624
// Build up the list of boss items with major items.
626625
auto majorItems = filterAndEraseFromPool(itemPool, [](const Item& item){return item.isMajorItem();});
627-
generateRaceModeItems(raceModeLocations, raceModeItems, majorItems, itemPool);
626+
generateBossItems(bossLocations, bossItems, majorItems, itemPool);
628627

629-
// logItemPool("raceModeItems", raceModeItems);
628+
logItemPool("Boss Items", bossItems);
630629

631-
if (raceModeItems.size() < raceModeLocations.size())
630+
if (bossItems.size() < bossLocations.size())
632631
{
633-
Utility::platformLog("WARNING: Not enough major items to place at race mode locations.");
632+
Utility::platformLog("WARNING: Not enough major items to place at boss locations.");
634633
}
635634

636-
// Then place the items in the race mode locations
635+
// Then place the items in the boss locations
637636
FillError err;
638-
FILL_ERROR_CHECK(assumedFill(worlds, raceModeItems, itemPool, raceModeLocations));
637+
FILL_ERROR_CHECK(assumedFill(worlds, bossItems, itemPool, bossLocations));
639638

640-
// Set race mode locations which had items placed at them as having expected items
641-
for (auto raceModeLoc : raceModeLocations)
639+
// Set boss locations which had items placed at them as having expected items
640+
for (auto loc : bossLocations)
642641
{
643-
raceModeLoc->hasExpectedItem = true;
642+
loc->hasExpectedItem = true;
644643
}
645644

646645
// Recalculate major items since new items may now be required depending on
647-
// what items were placed at race mode locations
646+
// what items were placed at boss locations
648647
determineMajorItems(worlds, itemPool, allLocations);
648+
649649
return FillError::NONE;
650650
}
651651

@@ -734,10 +734,10 @@ FillError fill(WorldPool& worlds)
734734

735735
determineMajorItems(worlds, itemPool, allLocations);
736736
FILL_ERROR_CHECK(placeNonProgressLocationPlandomizerItems(worlds, itemPool));
737-
// Handle dungeon items and race mode dungeons first if necessary. Generally
737+
// Handle dungeon and/or boss items first if necessary. Generally
738738
// we need to place items that go into more restrictive location pools first before
739739
// we can place other items.
740-
FILL_ERROR_CHECK(placeRaceModeItems(worlds, itemPool, allLocations));
740+
FILL_ERROR_CHECK(placeBossItems(worlds, itemPool, allLocations));
741741
FILL_ERROR_CHECK(handleDungeonItems(worlds, itemPool));
742742

743743
// Recalculate major items again since new items may now be required depending on

logic/Generate.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,13 @@ int generateWorlds(WorldPool& worlds, std::vector<Settings>& settingsVector)
156156

157157
// Now that all entrances have been randomized, we can flatten the world's
158158
// logic requirements for some useful operations later on
159-
// Determine race mode dungeons after entrance randomizer to ensure we pick
159+
// Determine required dungeons after entrance randomizer to ensure we pick
160160
// dungeons which can be properly reached depending on any entrance rando settings
161161
for (auto& world : worlds)
162162
{
163163
world.flattenLogicRequirements();
164164
WORLD_LOADING_ERROR_CHECK(world.setDungeonLocations(worlds));
165-
WORLD_LOADING_ERROR_CHECK(world.determineRaceModeDungeons(worlds));
165+
WORLD_LOADING_ERROR_CHECK(world.determineRequiredDungeons(worlds));
166166
}
167167

168168
// Retry the main fill algorithm a couple times incase it completely fails.

logic/Hints.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ static HintError calculatePossiblePathLocations(WorldPool& worlds)
3333
world.goalLocations.push_back(world.locationTable["Ganon's Tower - Defeat Ganondorf"].get());
3434
for (auto& [name, dungeon] : world.dungeons)
3535
{
36-
// Race mode locations are also goal locations
36+
// Boss locations are also goal locations
3737
if (dungeon.isRequiredDungeon)
3838
{
39-
world.goalLocations.push_back(dungeon.raceModeLocation);
39+
world.goalLocations.push_back(dungeon.bossLocation);
4040
}
4141
}
4242

@@ -311,7 +311,7 @@ static HintError generatePathHintLocations(World& world, std::list<Hint>& hints)
311311
for (auto& goalLocation : world.goalLocations)
312312
{
313313
shufflePool(goalLocation->pathLocations);
314-
// Initially we want to pull path hints from race mode dungeons before pulling from Ganondorf
314+
// Initially we want to pull path hints from required dungeons before pulling from Ganondorf
315315
if (goalLocation->getName() != "Ganon's Tower - Defeat Ganondorf")
316316
{
317317
goalLocations.push_back(goalLocation);
@@ -321,15 +321,15 @@ static HintError generatePathHintLocations(World& world, std::list<Hint>& hints)
321321
bool addedGanonPathLocation = false;
322322
for (uint8_t i = 0; i < world.getSettings().path_hints; i++)
323323
{
324-
// Try to get at least one hint for each race mode dungeon first
324+
// Try to get at least one hint for each required dungeon first
325325
Location* goalLocation = nullptr;
326326
if (i < goalLocations.size())
327327
{
328328
goalLocation = goalLocations[i];
329329
}
330330
else
331331
{
332-
// Once we've pulled from all race mode dungeons, then add Ganondorf to the list
332+
// Once we've pulled from all required dungeons, then add Ganondorf to the list
333333
// and choose randomly
334334
if (i == goalLocations.size() && !addedGanonPathLocation)
335335
{
@@ -650,7 +650,7 @@ static HintError generateLocationHintLocations(World& world, std::list<Hint>& hi
650650
{
651651
if (location->progression &&
652652
!location->hasBeenHinted &&
653-
!location->isRaceModeLocation &&
653+
!location->isBossLocation &&
654654
location->hintPriority == "Sometimes" &&
655655
!(world.getSettings().ho_ho_triforce_hints && location->currentItem.isTriforceShard()))
656656
{

logic/Location.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ bool Location::currentItemCanBeBarren() const
187187
// if it's a required race mode location
188188
bool Location::isBarrenAsChainLocation() const
189189
{
190-
return !progression || (currentItem.canBeInBarrenRegion() && !isRequiredRaceModeLocation);
190+
return !progression || (currentItem.canBeInBarrenRegion() && !isRequiredBossLocation);
191191
}
192192

193193
std::u16string Location::generateImportanceText(const std::string& language)

logic/Location.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ class Location
7171
std::unordered_map<std::string, std::string> names = {};
7272
std::unordered_set<LocationCategory> categories;
7373
bool progression;
74-
bool isRaceModeLocation;
75-
bool isRequiredRaceModeLocation;
74+
bool isBossLocation;
75+
bool isRequiredBossLocation;
7676
uint8_t stageId = 0;
7777
bool plandomized;
7878
bool hasBeenHinted;
@@ -100,7 +100,7 @@ class Location
100100
// Message Label if this is a hint location
101101
std::string messageLabel;
102102

103-
// goal names if this is a race mode location (one for each language)
103+
// goal names if this is a boss location (one for each language)
104104
std::unordered_map<std::string, std::string> goalNames = {};
105105

106106
// Tracker properties
@@ -112,8 +112,8 @@ class Location
112112
names({}),
113113
categories({LocationCategory::INVALID}),
114114
progression(false),
115-
isRaceModeLocation(false),
116-
isRequiredRaceModeLocation(false),
115+
isBossLocation(false),
116+
isRequiredBossLocation(false),
117117
stageId(0),
118118
plandomized(false),
119119
hasBeenHinted(false),

0 commit comments

Comments
 (0)