Fix: Various Rando generation crashes (#3108)

* fix rando gen crash when not enough remaining items to place

* fix rando gen crash due to missing granny shop hint

* add error sound if rando gen fails
This commit is contained in:
Adam Bird 2023-08-11 23:06:38 -04:00 committed by GitHub
parent b2e9d547ba
commit 535157ce00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View File

@ -548,13 +548,13 @@ static void CalculateWotH() {
static void FastFill(std::vector<uint32_t> items, std::vector<uint32_t> locations, bool endOnItemsEmpty = false) { static void FastFill(std::vector<uint32_t> items, std::vector<uint32_t> locations, bool endOnItemsEmpty = false) {
//Loop until locations are empty, or also end if items are empty and the parameters specify to end then //Loop until locations are empty, or also end if items are empty and the parameters specify to end then
while (!locations.empty() && (!endOnItemsEmpty || !items.empty())) { while (!locations.empty() && (!endOnItemsEmpty || !items.empty())) {
uint32_t loc = RandomElement(locations, true);
Location(loc)->SetAsHintable();
PlaceItemInLocation(loc, RandomElement(items, true));
if (items.empty() && !endOnItemsEmpty) { if (items.empty() && !endOnItemsEmpty) {
items.push_back(GetJunkItem()); items.push_back(GetJunkItem());
} }
uint32_t loc = RandomElement(locations, true);
Location(loc)->SetAsHintable();
PlaceItemInLocation(loc, RandomElement(items, true));
} }
} }

View File

@ -423,6 +423,11 @@ void HintTable_Init_Exclude_Overworld() {
Text{"#Medigoron# sells", /*french*/"#Medigoron# vend", /*spanish*/"#Medigoron# vende"}, Text{"#Medigoron# sells", /*french*/"#Medigoron# vend", /*spanish*/"#Medigoron# vende"},
}); });
hintTable[KAK_GRANNYS_SHOP] = HintText::Exclude({
// obscure text
Text{"the #potion shop lady# sells", /*french*/"la #dame du magasin de potion# vend", /*spanish*/"la #señora de la tienda de pociones# vende" },
});
hintTable[KAK_IMPAS_HOUSE_FREESTANDING_POH] = HintText::Exclude({ hintTable[KAK_IMPAS_HOUSE_FREESTANDING_POH] = HintText::Exclude({
//obscure text //obscure text
Text{"#imprisoned in a house# lies", /*french*/"#encagé dans une maison# gît", /*spanish*/"#en una casa entre rejas# yace"}, Text{"#imprisoned in a house# lies", /*french*/"#encagé dans une maison# gît", /*spanish*/"#en una casa entre rejas# yace"},

View File

@ -346,7 +346,11 @@ void FileChoose_UpdateRandomizer() {
func_800F5E18(SEQ_PLAYER_BGM_MAIN, NA_BGM_HORSE, 0, 7, 1); func_800F5E18(SEQ_PLAYER_BGM_MAIN, NA_BGM_HORSE, 0, 7, 1);
return; return;
} else if (CVarGetInteger("gRandoGenerating", 0) == 0 && generating) { } else if (CVarGetInteger("gRandoGenerating", 0) == 0 && generating) {
if (SpoilerFileExists(CVarGetString("gSpoilerLog", ""))) {
Audio_PlayFanfare(NA_BGM_HORSE_GOAL); Audio_PlayFanfare(NA_BGM_HORSE_GOAL);
} else {
func_80078884(NA_SE_SY_OCARINA_ERROR);
}
func_800F5E18(SEQ_PLAYER_BGM_MAIN, NA_BGM_FILE_SELECT, 0, 7, 1); func_800F5E18(SEQ_PLAYER_BGM_MAIN, NA_BGM_FILE_SELECT, 0, 7, 1);
generating = 0; generating = 0;
return; return;