Merge branch 'develop-rando' of github.com:Malkierian/Shipwright into dev-to-rando-5-6

This commit is contained in:
Malkierian 2024-05-07 14:37:00 -07:00
commit ee1f15523c
6 changed files with 1175 additions and 865 deletions

View File

@ -531,44 +531,40 @@ int32_t getRandomWeight(int32_t totalWeight){
}
static void DistributeHints(std::vector<uint8_t>& selected, size_t stoneCount, std::vector<HintDistributionSetting> distTable, uint8_t junkWieght, bool addFixed = true){
int32_t totalWeight = junkWieght;
int32_t totalWeight = junkWieght; //Start with our Junk Weight, the natural chance of a junk hint
for (HintDistributionSetting setting: distTable){
totalWeight += setting.weight;
for (HintDistributionSetting setting: distTable){ //Gather the wieghts of each distribution and, if it's the first pass, apply fixed hints
totalWeight += setting.weight; //Note that PlaceHints will set weights of distributions to zero if it can't place anything from them
if (addFixed){
selected[setting.type] += setting.fixed;
stoneCount -= setting.fixed * setting.copies;
}
}
int32_t currentWeight = getRandomWeight(totalWeight);
while(stoneCount > 0 && totalWeight > 0){
int32_t currentWeight = getRandomWeight(totalWeight); //Initialise with the first random weight from 1 to the total.
while(stoneCount > 0 && totalWeight > 0){//Loop until we run out of stones or have no TotalWeight. 0 totalWeight means junkWeight is 0
//and that all weights have been 0'd out for another reason, and skips to placing all junk hints
for (uint8_t distribution = 0; distribution < distTable.size(); distribution++){
currentWeight -= distTable[distribution].weight;
if (currentWeight <= 0){
if (distTable[distribution].copies == 0) {
// This should only happen if we ran out of locations to place hints of a certain distribution earlier. Skip
// to the next distribution.
break;
}
if (stoneCount >= distTable[distribution].copies){
selected[distribution] += 1;
currentWeight -= distTable[distribution].weight; //go over each distribution, subtracting the weight each time. Once we reach zero or less,
if (currentWeight <= 0){ //tell the system to make 1 of that hint, unless not enough stones remain
if (stoneCount >= distTable[distribution].copies && distTable[distribution].copies > 0){
selected[distribution] += 1; //if we have enough stones, and copies are not zero, assign 1 to this hint type, remove the stones, and break
stoneCount -= distTable[distribution].copies;
break;
} else {
totalWeight -= distTable[distribution].weight;
distTable[distribution].weight = 0;
break; //This leaves the whole for loop
} else { //If we don't have the stones, or copies is 0 despite there being the wieght to trigger a hit, temporerally set wieght to zero
totalWeight -= distTable[distribution].weight; //Unlike PlaceHint, distTable is passed by value here, making this temporary
distTable[distribution].weight = 0; //this is so we can still roll this hint type if more stones free up later
break;
}
}
}
//if there's still weight, then it's junk
if (currentWeight > 0){
//if there's still weight then it's junk, as the leftover weight is junkWeight
if (currentWeight > 0){ //zero TotalWeight breaks the while loop and hits the fallback, so skipping this is fine in that case
selected[selected.size()-1] += 1;
stoneCount -= 1;
}
currentWeight = getRandomWeight(totalWeight);
}
//if stones are left, assign junk
//if stones are left, assign junk to every remaining stone as a fallback.
if (stoneCount > 0){
selected[selected.size()-1] += stoneCount;
}
@ -586,10 +582,11 @@ uint8_t PlaceHints(std::vector<uint8_t>& selectedHints,
RandomizerCheck hintedLocation = RC_UNKNOWN_CHECK;
hintedLocation = CreateRandomHint(hintTypePool, distribution.copies, distribution.type, distribution.name);
if (hintedLocation == RC_UNKNOWN_CHECK){ //if hint failed to place
if (hintedLocation == RC_UNKNOWN_CHECK){ //if hint failed to place, remove all wieght and copies then return the number of stones to redistribute
uint8_t hintsToRemove = (selectedHints[curSlot] - numHint) * distribution.copies;
selectedHints[curSlot] = 0;
distTable[curSlot].copies = 0;
selectedHints[curSlot] = 0; //as distTable is passed by refernce here, these changes stick for the rest of this seed generation
distTable[curSlot].copies = 0;//and prevent future distribution from choosing this slot
distTable[curSlot].weight = 0;
return hintsToRemove;
}
if(Rando::StaticData::GetLocation(hintedLocation)->IsDungeon()){
@ -661,9 +658,8 @@ void CreateStoneHints() {
while(totalStones != 0){
totalStones = PlaceHints(selectedHints, distTable);
while (totalStones != 0){
if (totalStones != 0){
DistributeHints(selectedHints, totalStones, distTable, hintSetting.junkWeight, false);
totalStones = PlaceHints(selectedHints, distTable);
}
}

View File

@ -108,6 +108,17 @@ Rando::Location Rando::Location::Base(RandomizerCheck rc, RandomizerCheckQuest q
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
}
Rando::Location Rando::Location::Base(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_, int32_t actorParams_,
uint8_t flag_, std::string&& shortName_,
const RandomizerHintTextKey hintKey, const RandomizerGet vanillaItem,
std::vector<Category>&& categories, SpoilerCollectionCheck collectionCheck,
SpoilerCollectionCheckGroup collectionCheckGroup, bool isVanillaCompletion_) {
return {rc, quest_, checkType_, area_, LocationType::Base, actorId_, scene_, actorParams_, flag_,
std::move(shortName_), hintKey, vanillaItem, std::move(categories),
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
}
Rando::Location Rando::Location::Chest(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_,
int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
@ -121,6 +132,19 @@ Rando::Location Rando::Location::Chest(RandomizerCheck rc, RandomizerCheckQuest
collectionCheckGroup};
}
Rando::Location Rando::Location::Chest(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_,
int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
const RandomizerHintTextKey hintKey,
const RandomizerGet vanillaItem, std::vector<Category>&& categories,
SpoilerCollectionCheckGroup collectionCheckGroup, bool isVanillaCompletion_) {
return {rc, quest_, checkType_, area_, LocationType::Chest, actorId_, scene_, actorParams_, flag_,
std::move(shortName_), hintKey, vanillaItem, std::move(categories),
isVanillaCompletion_,
SpoilerCollectionCheck(SPOILER_CHK_CHEST, scene_, flag_),
collectionCheckGroup};
}
Rando::Location Rando::Location::Chest(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_,
int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
@ -133,6 +157,18 @@ Rando::Location Rando::Location::Chest(RandomizerCheck rc, RandomizerCheckQuest
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
}
Rando::Location Rando::Location::Chest(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_,
int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
const RandomizerHintTextKey hintKey,
const RandomizerGet vanillaItem, std::vector<Category>&& categories,
SpoilerCollectionCheck collectionCheck,
SpoilerCollectionCheckGroup collectionCheckGroup, bool isVanillaCompletion_) {
return {rc, quest_, checkType_, area_, LocationType::Chest, actorId_, scene_, actorParams_, flag_,
std::move(shortName_), hintKey, vanillaItem, std::move(categories),
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
}
Rando::Location Rando::Location::Collectable(
RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_, RandomizerCheckArea area_,
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
@ -145,6 +181,18 @@ Rando::Location Rando::Location::Collectable(
collectionCheckGroup};
}
Rando::Location Rando::Location::Collectable(
RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_, RandomizerCheckArea area_,
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
const RandomizerHintTextKey hintKey, const RandomizerGet vanillaItem,
std::vector<Category>&& categories, SpoilerCollectionCheckGroup collectionCheckGroup, bool isVanillaCompletion_) {
return {rc, quest_, checkType_, area_, LocationType::Collectable, actorId_, scene_, actorParams_, flag_,
std::move(shortName_), hintKey, vanillaItem, std::move(categories),
isVanillaCompletion_,
SpoilerCollectionCheck(SPOILER_CHK_COLLECTABLE, scene_, flag_),
collectionCheckGroup};
}
Rando::Location Rando::Location::Collectable(RandomizerCheck rc, RandomizerCheckQuest quest_,
RandomizerCheckType checkType_, RandomizerCheckArea area_,
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
@ -160,6 +208,21 @@ Rando::Location Rando::Location::Collectable(RandomizerCheck rc, RandomizerCheck
collectionCheckGroup};
}
Rando::Location Rando::Location::Collectable(RandomizerCheck rc, RandomizerCheckQuest quest_,
RandomizerCheckType checkType_, RandomizerCheckArea area_,
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
std::string&& shortName_,
const RandomizerHintTextKey hintKey, const RandomizerGet vanillaItem,
std::vector<Category>&& categories, const uint8_t collectFlag_,
SpoilerCollectionCheckGroup collectionCheckGroup,
bool isVanillaCompletion_) {
return {rc, quest_, checkType_, area_, LocationType::Collectable, actorId_, scene_, actorParams_, flag_,
std::move(shortName_), hintKey, vanillaItem, std::move(categories),
isVanillaCompletion_,
SpoilerCollectionCheck(SPOILER_CHK_COLLECTABLE, scene_, collectFlag_),
collectionCheckGroup};
}
Rando::Location Rando::Location::Collectable(RandomizerCheck rc, RandomizerCheckQuest quest_,
RandomizerCheckType checkType_, RandomizerCheckArea area_,
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
@ -173,6 +236,19 @@ Rando::Location Rando::Location::Collectable(RandomizerCheck rc, RandomizerCheck
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
}
Rando::Location Rando::Location::Collectable(RandomizerCheck rc, RandomizerCheckQuest quest_,
RandomizerCheckType checkType_, RandomizerCheckArea area_,
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
std::string&& shortName_,
const RandomizerHintTextKey hintKey, const RandomizerGet vanillaItem,
std::vector<Category>&& categories, SpoilerCollectionCheck collectionCheck,
SpoilerCollectionCheckGroup collectionCheckGroup,
bool isVanillaCompletion_) {
return {rc, quest_, checkType_, area_, LocationType::Collectable, actorId_, scene_, actorParams_, flag_,
std::move(shortName_), hintKey, vanillaItem, std::move(categories),
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
}
Rando::Location Rando::Location::GSToken(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_,
uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
std::string&& spoilerName_, const RandomizerHintTextKey hintKey,
@ -185,6 +261,18 @@ Rando::Location Rando::Location::GSToken(RandomizerCheck rc, RandomizerCheckQues
collectionCheckGroup};
}
Rando::Location Rando::Location::GSToken(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_,
uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
const RandomizerHintTextKey hintKey,
std::vector<Category>&& categories,
SpoilerCollectionCheckGroup collectionCheckGroup, bool isVanillaCompletion_) {
return {rc, quest_, RCTYPE_SKULL_TOKEN, area_, LocationType::GSToken, ACTOR_EN_SI, scene_, actorParams_,
flag_, std::move(shortName_), hintKey, RG_GOLD_SKULLTULA_TOKEN,
std::move(categories), isVanillaCompletion_,
SpoilerCollectionCheck(SPOILER_CHK_GOLD_SKULLTULA, scene_, flag_),
collectionCheckGroup};
}
Rando::Location Rando::Location::GSToken(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_,
uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
std::string&& spoilerName_, const RandomizerHintTextKey hintKey,
@ -197,6 +285,18 @@ Rando::Location Rando::Location::GSToken(RandomizerCheck rc, RandomizerCheckQues
collectionCheckGroup};
}
Rando::Location Rando::Location::GSToken(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_,
uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
const RandomizerHintTextKey hintKey,
std::vector<Category>&& categories, const uint8_t skullScene_,
SpoilerCollectionCheckGroup collectionCheckGroup, bool isVanillaCompletion_) {
return {rc, quest_, RCTYPE_SKULL_TOKEN, area_, LocationType::GSToken, ACTOR_EN_SI, scene_, actorParams_,
flag_, std::move(shortName_), hintKey, RG_GOLD_SKULLTULA_TOKEN,
std::move(categories), isVanillaCompletion_,
SpoilerCollectionCheck(SPOILER_CHK_GOLD_SKULLTULA, skullScene_, flag_),
collectionCheckGroup};
}
Rando::Location Rando::Location::GrottoScrub(RandomizerCheck rc, RandomizerCheckQuest quest_,
RandomizerCheckType checkType_, RandomizerCheckArea area_,
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
@ -210,6 +310,19 @@ Rando::Location Rando::Location::GrottoScrub(RandomizerCheck rc, RandomizerCheck
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
}
Rando::Location Rando::Location::GrottoScrub(RandomizerCheck rc, RandomizerCheckQuest quest_,
RandomizerCheckType checkType_, RandomizerCheckArea area_,
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
std::string&& shortName_,
const RandomizerHintTextKey hintKey, const RandomizerGet vanillaItem,
std::vector<Category>&& categories, SpoilerCollectionCheck collectionCheck,
SpoilerCollectionCheckGroup collectionCheckGroup,
bool isVanillaCompletion_) {
return {rc, quest_, checkType_, area_, LocationType::GrottoScrub, actorId_, scene_, actorParams_, flag_,
std::move(shortName_), hintKey, vanillaItem, std::move(categories),
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
}
Rando::Location Rando::Location::Delayed(RandomizerCheck rc, RandomizerCheckQuest quest_,
RandomizerCheckType checkType_, RandomizerCheckArea area_, ActorID actorId_,
uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
@ -222,6 +335,18 @@ Rando::Location Rando::Location::Delayed(RandomizerCheck rc, RandomizerCheckQues
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
}
Rando::Location Rando::Location::Delayed(RandomizerCheck rc, RandomizerCheckQuest quest_,
RandomizerCheckType checkType_, RandomizerCheckArea area_, ActorID actorId_,
uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
const RandomizerHintTextKey hintKey,
const RandomizerGet vanillaItem, std::vector<Category>&& categories,
SpoilerCollectionCheck collectionCheck,
SpoilerCollectionCheckGroup collectionCheckGroup, bool isVanillaCompletion_) {
return {rc, quest_, checkType_, area_, LocationType::Delayed, actorId_, scene_, actorParams_, flag_,
std::move(shortName_), hintKey, vanillaItem, std::move(categories),
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
}
Rando::Location Rando::Location::Reward(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_,
int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
@ -234,6 +359,18 @@ Rando::Location Rando::Location::Reward(RandomizerCheck rc, RandomizerCheckQuest
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
}
Rando::Location Rando::Location::Reward(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_,
int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
const RandomizerHintTextKey hintKey,
const RandomizerGet vanillaItem, std::vector<Category>&& categories,
SpoilerCollectionCheck collectionCheck,
SpoilerCollectionCheckGroup collectionCheckGroup, bool isVanillaCompletion_) {
return {rc, quest_, checkType_, area_, LocationType::TempleReward, actorId_, scene_, actorParams_, flag_,
std::move(shortName_), hintKey, vanillaItem, std::move(categories),
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
}
Rando::Location Rando::Location::OtherHint(RandomizerCheck rc, RandomizerCheckQuest quest_,
RandomizerCheckType checkType_, RandomizerCheckArea area_, ActorID actorId_,
uint8_t scene_,
@ -243,6 +380,15 @@ Rando::Location Rando::Location::OtherHint(RandomizerCheck rc, RandomizerCheckQu
std::move(shortName_), std::move(spoilerName_), RHT_NONE, RG_NONE, {}, isVanillaCompletion_};
}
Rando::Location Rando::Location::OtherHint(RandomizerCheck rc, RandomizerCheckQuest quest_,
RandomizerCheckType checkType_, RandomizerCheckArea area_, ActorID actorId_,
uint8_t scene_,
std::string&& shortName_,
bool isVanillaCompletion_) {
return {rc, quest_, checkType_, area_, LocationType::OtherHint, actorId_, scene_, 0x00, 0x00,
std::move(shortName_), RHT_NONE, RG_NONE, {}, isVanillaCompletion_};
}
Rando::Location Rando::Location::HintStone(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_,
uint8_t scene_, int32_t actorParams_, uint8_t flag_,
std::string&& shortName_, std::string&& spoilerName_,
@ -251,3 +397,12 @@ Rando::Location Rando::Location::HintStone(RandomizerCheck rc, RandomizerCheckQu
std::move(shortName_), std::move(spoilerName_), RHT_NONE, RG_NONE, std::move(categories),
isVanillaCompletion_};
}
Rando::Location Rando::Location::HintStone(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_,
uint8_t scene_, int32_t actorParams_, uint8_t flag_,
std::string&& shortName_,
std::vector<Category>&& categories, bool isVanillaCompletion_) {
return {rc, quest_, RCTYPE_GOSSIP_STONE, area_, LocationType::Base, ACTOR_EN_GS, scene_, actorParams_, flag_,
std::move(shortName_), RHT_NONE, RG_NONE, std::move(categories),
isVanillaCompletion_};
}

View File

@ -10,6 +10,7 @@
#include "randomizerTypes.h"
#include "z64actor_enum.h"
#include "z64scene.h"
#include "../../util.h"
namespace Rando {
class SpoilerCollectionCheck {
@ -110,6 +111,24 @@ class Location {
isVanillaCompletion(isVanillaCompletion_), collectionCheck(collectionCheck_),
collectionCheckGroup(collectionCheckGroup_) {
}
Location(const RandomizerCheck rc_, const RandomizerCheckQuest quest_, const RandomizerCheckType checkType_,
const RandomizerCheckArea area_, const LocationType locationType_, const ActorID actorId_, const uint8_t scene_,
const int32_t actorParams_, const uint8_t flag_, std::string shortName_,
const RandomizerHintTextKey hintKey_, const RandomizerGet vanillaItem_, std::vector<Category> categories_,
const bool isVanillaCompletion_ = false, const SpoilerCollectionCheck collectionCheck_ = SpoilerCollectionCheck(),
const SpoilerCollectionCheckGroup collectionCheckGroup_ = GROUP_NO_GROUP)
: rc(rc_), quest(quest_), checkType(checkType_), area(area_), locationType(locationType_), actorId(actorId_),
scene(scene_), actorParams(actorParams_), flag(flag_), shortName(shortName_),
spoilerName(SpoilerNameFromShortName(shortName_, area_)), hintKey(hintKey_), vanillaItem(vanillaItem_), categories(std::move(categories_)),
isVanillaCompletion(isVanillaCompletion_), collectionCheck(collectionCheck_),
collectionCheckGroup(collectionCheckGroup_) {}
static std::string SpoilerNameFromShortName(std::string shortName, RandomizerCheckArea area) {
if (area < 0 || area >= RCAREA_INVALID) {
return shortName;
}
return SohUtils::GetRandomizerCheckAreaPrefix(area) + " " + shortName;
}
RandomizerCheck GetRandomizerCheck() const;
SpoilerCollectionCheck GetCollectionCheck() const;
@ -144,6 +163,15 @@ class Location {
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = false);
static Location Base(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_, int32_t actorParams_,
uint8_t flag_, std::string&& shortName_,
RandomizerHintTextKey hintKey, RandomizerGet vanillaItem,
std::vector<Category>&& categories,
SpoilerCollectionCheck collectionCheck = SpoilerCollectionCheck(),
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = false);
static Location
Chest(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_, RandomizerCheckArea area_,
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
@ -152,6 +180,14 @@ class Location {
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = false);
static Location
Chest(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_, RandomizerCheckArea area_,
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
RandomizerHintTextKey hintKey, RandomizerGet vanillaItem,
std::vector<Category>&& categories,
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = false);
static Location
Chest(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_, RandomizerCheckArea area_,
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
@ -160,6 +196,14 @@ class Location {
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = false);
static Location
Chest(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_, RandomizerCheckArea area_,
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
RandomizerHintTextKey hintKey, RandomizerGet vanillaItem,
std::vector<Category>&& categories, SpoilerCollectionCheck collectionCheck = SpoilerCollectionCheck(),
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = false);
static Location
Collectable(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
@ -168,6 +212,14 @@ class Location {
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = false);
static Location
Collectable(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
std::string&& shortName_, RandomizerHintTextKey hintKey,
RandomizerGet vanillaItem, std::vector<Category>&& categories,
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = false);
static Location
Collectable(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
@ -176,6 +228,14 @@ class Location {
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = false);
static Location
Collectable(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
std::string&& shortName_, RandomizerHintTextKey hintKey,
RandomizerGet vanillaItem, std::vector<Category>&& categories, uint8_t collectFlag_,
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = false);
static Location
Collectable(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
@ -185,6 +245,15 @@ class Location {
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = false);
static Location
Collectable(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
std::string&& shortName_, RandomizerHintTextKey hintKey,
RandomizerGet vanillaItem, std::vector<Category>&& categories,
SpoilerCollectionCheck collectionCheck = SpoilerCollectionCheck(),
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = false);
static Location
GSToken(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_,
uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
@ -192,8 +261,15 @@ class Location {
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = true);
static Location
GSToken(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_,
uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
RandomizerHintTextKey hintKey, std::vector<Category>&& categories,
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = true);
/// @brief For certain scenes, the sceneId and the "Scene" in spoiler collection check later used to check the
/// GS flags don't necessarily match. Use this constructor for those. scene_ should be the actual scene where
/// GS flags don't necessarily match. Use this constructor (or the next one) for those. scene_ should be the actual scene where
/// the GS is located, skullScene_ is the value passed to GET_GS_FLAGS to get the correct skulltula. It is normal
/// and expected that these don't always match, and the naming is a holdover from 3drando.
/// @param rc
@ -218,6 +294,14 @@ class Location {
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = true);
static Location
GSToken(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_,
uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
RandomizerHintTextKey hintKey, std::vector<Category>&& categories,
uint8_t skullScene_,
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = true);
static Location
GrottoScrub(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
@ -227,6 +311,15 @@ class Location {
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = false);
static Location
GrottoScrub(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
std::string&& shortName_, RandomizerHintTextKey hintKey,
RandomizerGet vanillaItem, std::vector<Category>&& categories,
SpoilerCollectionCheck collectionCheck = SpoilerCollectionCheck(),
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = false);
static Location
Delayed(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_, RandomizerCheckArea area_,
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
@ -235,6 +328,14 @@ class Location {
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = false);
static Location
Delayed(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_, RandomizerCheckArea area_,
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
RandomizerHintTextKey hintKey, RandomizerGet vanillaItem,
std::vector<Category>&& categories, SpoilerCollectionCheck collectionCheck = SpoilerCollectionCheck(),
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
bool isVanillaCompletion_ = false);
static Location
Reward(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_, RandomizerCheckArea area_,
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
@ -242,14 +343,29 @@ class Location {
std::vector<Category>&& categories, SpoilerCollectionCheck collectionCheck = SpoilerCollectionCheck(),
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP, bool isVanillaCompletion_ = false);
static Location
Reward(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_, RandomizerCheckArea area_,
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
RandomizerHintTextKey hintKey, RandomizerGet vanillaItem,
std::vector<Category>&& categories, SpoilerCollectionCheck collectionCheck = SpoilerCollectionCheck(),
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP, bool isVanillaCompletion_ = false);
static Location OtherHint(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_,
std::string&& shortName_, std::string&& spoilerName_, bool isVanillaCompletion_ = false);
static Location OtherHint(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_,
std::string&& shortName_, bool isVanillaCompletion_ = false);
static Location HintStone(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_, uint8_t scene_,
int32_t actorParams_, uint8_t flag_, std::string&& shortName_, std::string&& spoilerName_,
std::vector<Category>&& categories, bool isVanillaCompletion_ = false);
static Location HintStone(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_, uint8_t scene_,
int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
std::vector<Category>&& categories, bool isVanillaCompletion_ = false);
private:
RandomizerCheck rc;
RandomizerCheckQuest quest;

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,8 @@
#include <string.h>
#include <vector>
#include <algorithm>
#include <array>
#include "Enhancements/randomizer/randomizerTypes.h"
std::vector<std::string> sceneNames = {
"Inside the Deku Tree",
@ -303,6 +305,41 @@ std::vector<std::string> questItemNames = {
"Gold Skulltula Token",
};
std::array<std::string, RA_MAX> rcareaPrefixes = {
"KF",
"LW",
"SFM",
"HF",
"LH",
"GV",
"GF",
"Wasteland",
"Colossus",
"Market",
"HC",
"Kak",
"Graveyard",
"DMT",
"GC",
"DMC",
"ZR",
"ZD",
"ZF",
"LLR",
"Deku Tree",
"Dodongos Cavern",
"Jabu Jabus Belly",
"Forest Temple",
"Fire Temple",
"Water Temple",
"Spirit Temple",
"Shadow Temple",
"Bottom of the Well",
"Ice Cavern",
"Gerudo Training Grounds",
"Ganon's Castle",
};
const std::string& SohUtils::GetSceneName(int32_t scene) {
return sceneNames[scene];
}
@ -315,6 +352,10 @@ const std::string& SohUtils::GetQuestItemName(int32_t item) {
return questItemNames[item];
}
const std::string& SohUtils::GetRandomizerCheckAreaPrefix(int32_t rcarea) {
return rcareaPrefixes[rcarea];
}
void SohUtils::CopyStringToCharArray(char* destination, std::string source, size_t size) {
strncpy(destination, source.c_str(), size - 1);
destination[size - 1] = '\0';

View File

@ -9,6 +9,8 @@ namespace SohUtils {
const std::string& GetQuestItemName(int32_t item);
const std::string& GetRandomizerCheckAreaPrefix(int32_t rcarea);
// Copies a string and ensures the destination is null terminated if the source string is larger than size
// Only up to size-1 characters are copied from the source string
void CopyStringToCharArray(char* destination, std::string source, size_t size);