use shopsanity enum (#2054)

* enums for rainbow bridge

* reorder enum

* use enums for shopsanity

* remove space

Co-authored-by: briaguya <briaguya@alice>
This commit is contained in:
briaguya 2022-11-30 00:30:51 -05:00 committed by GitHub
parent e193f0dc0e
commit d6c528d9d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 18 deletions

View File

@ -1211,7 +1211,7 @@ void DrawEquipmentTab() {
"Giant (500)", "Giant (500)",
}; };
// only display Tycoon wallet if you're in a save file that would allow it. // only display Tycoon wallet if you're in a save file that would allow it.
if (gSaveContext.n64ddFlag && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHOPSANITY) > 1) { if (gSaveContext.n64ddFlag && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHOPSANITY) > RO_SHOPSANITY_ZERO_ITEMS) {
const std::string walletName = "Tycoon (999)"; const std::string walletName = "Tycoon (999)";
walletNamesImpl.push_back(walletName); walletNamesImpl.push_back(walletName);
} }

View File

@ -602,7 +602,7 @@ const std::vector<PresetEntry> hellModePresetEntries = {
PRESET_ENTRY_S32("gRandomizeLinksPocket", RO_LINKS_POCKET_NOTHING), PRESET_ENTRY_S32("gRandomizeLinksPocket", RO_LINKS_POCKET_NOTHING),
PRESET_ENTRY_S32("gRandomizeMqDungeons", 2), PRESET_ENTRY_S32("gRandomizeMqDungeons", 2),
PRESET_ENTRY_S32("gRandomizeRainbowBridge", RO_BRIDGE_DUNGEON_REWARDS), PRESET_ENTRY_S32("gRandomizeRainbowBridge", RO_BRIDGE_DUNGEON_REWARDS),
PRESET_ENTRY_S32("gRandomizeShopsanity", 5), PRESET_ENTRY_S32("gRandomizeShopsanity", RO_SHOPSANITY_FOUR_ITEMS),
PRESET_ENTRY_S32("gRandomizeShuffleAdultTrade", 1), PRESET_ENTRY_S32("gRandomizeShuffleAdultTrade", 1),
PRESET_ENTRY_S32("gRandomizeShuffleBeans", 1), PRESET_ENTRY_S32("gRandomizeShuffleBeans", 1),
PRESET_ENTRY_S32("gRandomizeShuffleCows", 1), PRESET_ENTRY_S32("gRandomizeShuffleCows", 1),

View File

@ -675,19 +675,19 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) {
break; break;
case RSK_SHOPSANITY: case RSK_SHOPSANITY:
if(it.value() == "Off") { if(it.value() == "Off") {
gSaveContext.randoSettings[index].value = SHOPSANITY_OFF; gSaveContext.randoSettings[index].value = RO_SHOPSANITY_OFF;
} else if(it.value() == "0 Items") { } else if(it.value() == "0 Items") {
gSaveContext.randoSettings[index].value = SHOPSANITY_ZERO; gSaveContext.randoSettings[index].value = RO_SHOPSANITY_ZERO_ITEMS;
} else if(it.value() == "1 Item") { } else if(it.value() == "1 Item") {
gSaveContext.randoSettings[index].value = SHOPSANITY_ONE; gSaveContext.randoSettings[index].value = RO_SHOPSANITY_ONE_ITEM;
} else if(it.value() == "2 Items") { } else if(it.value() == "2 Items") {
gSaveContext.randoSettings[index].value = SHOPSANITY_TWO; gSaveContext.randoSettings[index].value = RO_SHOPSANITY_TWO_ITEMS;
} else if(it.value() == "3 Items") { } else if(it.value() == "3 Items") {
gSaveContext.randoSettings[index].value = SHOPSANITY_THREE; gSaveContext.randoSettings[index].value = RO_SHOPSANITY_THREE_ITEMS;
} else if(it.value() == "4 Items") { } else if(it.value() == "4 Items") {
gSaveContext.randoSettings[index].value = SHOPSANITY_FOUR; gSaveContext.randoSettings[index].value = RO_SHOPSANITY_FOUR_ITEMS;
} else if(it.value() == "Random") { } else if(it.value() == "Random") {
gSaveContext.randoSettings[index].value = SHOPSANITY_RANDOM; gSaveContext.randoSettings[index].value = RO_SHOPSANITY_RANDOM;
} }
break; break;
case RSK_SHUFFLE_SCRUBS: case RSK_SHUFFLE_SCRUBS:
@ -1287,7 +1287,7 @@ ItemObtainability Randomizer::GetItemObtainabilityFromRandomizerGet(RandomizerGe
// Shopsanity with at least one item shuffled allows for a third wallet upgrade. // Shopsanity with at least one item shuffled allows for a third wallet upgrade.
// This is needed since Plentiful item pool also adds a third progressive wallet // This is needed since Plentiful item pool also adds a third progressive wallet
// but we should *not* get Tycoon's Wallet in that mode. // but we should *not* get Tycoon's Wallet in that mode.
u8 numWallets = GetRandoSettingValue(RSK_SHOPSANITY) > 1 ? 3 : 2; u8 numWallets = GetRandoSettingValue(RSK_SHOPSANITY) > RO_SHOPSANITY_ZERO_ITEMS ? 3 : 2;
switch (randoGet) { switch (randoGet) {
case RG_NONE: case RG_NONE:
case RG_TRIFORCE: case RG_TRIFORCE:
@ -2588,7 +2588,7 @@ void GenerateRandomizerImgui() {
cvarSettings[RSK_SHUFFLE_DUNGEON_REWARDS] = CVar_GetS32("gRandomizeShuffleDungeonReward", RO_DUNGEON_REWARDS_END_OF_DUNGEON); cvarSettings[RSK_SHUFFLE_DUNGEON_REWARDS] = CVar_GetS32("gRandomizeShuffleDungeonReward", RO_DUNGEON_REWARDS_END_OF_DUNGEON);
cvarSettings[RSK_SHUFFLE_SONGS] = CVar_GetS32("gRandomizeShuffleSongs", 0); cvarSettings[RSK_SHUFFLE_SONGS] = CVar_GetS32("gRandomizeShuffleSongs", 0);
cvarSettings[RSK_SHUFFLE_TOKENS] = CVar_GetS32("gRandomizeShuffleTokens", 0); cvarSettings[RSK_SHUFFLE_TOKENS] = CVar_GetS32("gRandomizeShuffleTokens", 0);
cvarSettings[RSK_SHOPSANITY] = CVar_GetS32("gRandomizeShopsanity", 0); cvarSettings[RSK_SHOPSANITY] = CVar_GetS32("gRandomizeShopsanity", RO_SHOPSANITY_OFF);
cvarSettings[RSK_SHUFFLE_SCRUBS] = CVar_GetS32("gRandomizeShuffleScrubs", 0); cvarSettings[RSK_SHUFFLE_SCRUBS] = CVar_GetS32("gRandomizeShuffleScrubs", 0);
cvarSettings[RSK_SHUFFLE_COWS] = CVar_GetS32("gRandomizeShuffleCows", 0); cvarSettings[RSK_SHUFFLE_COWS] = CVar_GetS32("gRandomizeShuffleCows", 0);
cvarSettings[RSK_SHUFFLE_ADULT_TRADE] = CVar_GetS32("gRandomizeShuffleAdultTrade", 0); cvarSettings[RSK_SHUFFLE_ADULT_TRADE] = CVar_GetS32("gRandomizeShuffleAdultTrade", 0);

View File

@ -280,7 +280,7 @@ ItemTrackerNumbers GetItemCurrentAndMax(ItemTrackerItem item) {
case ITEM_WALLET_ADULT: case ITEM_WALLET_ADULT:
case ITEM_WALLET_GIANT: case ITEM_WALLET_GIANT:
result.currentCapacity = CUR_CAPACITY(UPG_WALLET); result.currentCapacity = CUR_CAPACITY(UPG_WALLET);
result.maxCapacity = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHOPSANITY) > 1 ? 999 : 500; result.maxCapacity = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHOPSANITY) > RO_SHOPSANITY_ZERO_ITEMS ? 999 : 500;
result.currentAmmo = gSaveContext.rupees; result.currentAmmo = gSaveContext.rupees;
break; break;
case ITEM_BOMBCHU: case ITEM_BOMBCHU:

View File

@ -108,7 +108,7 @@ void SaveManager::LoadRandomizerVersion1() {
if (randomizer->GetRandoSettingValue(RSK_SHUFFLE_SCRUBS) > 0) { if (randomizer->GetRandoSettingValue(RSK_SHUFFLE_SCRUBS) > 0) {
merchantPricesSize += NUM_SCRUBS; merchantPricesSize += NUM_SCRUBS;
} }
if (randomizer->GetRandoSettingValue(RSK_SHOPSANITY) > 0) { if (randomizer->GetRandoSettingValue(RSK_SHOPSANITY) != RO_SHOPSANITY_OFF) {
merchantPricesSize += NUM_SHOP_ITEMS; merchantPricesSize += NUM_SHOP_ITEMS;
} }

View File

@ -410,7 +410,7 @@ void EnGirlA_InitItem(EnGirlA* this, PlayState* play) {
return; return;
} }
if (!gSaveContext.n64ddFlag || !Randomizer_GetSettingValue(RSK_SHOPSANITY)) { if (!gSaveContext.n64ddFlag || Randomizer_GetSettingValue(RSK_SHOPSANITY) == RO_SHOPSANITY_OFF) {
this->objBankIndex = Object_GetIndex(&play->objectCtx, shopItemEntries[params].objID); this->objBankIndex = Object_GetIndex(&play->objectCtx, shopItemEntries[params].objID);
} else { } else {
s16 objectId = shopItemEntries[params].objID; s16 objectId = shopItemEntries[params].objID;
@ -603,7 +603,8 @@ s32 EnGirlA_CanBuy_DekuShield(PlayState* play, EnGirlA* this) {
} }
s32 EnGirlA_CanBuy_GoronTunic(PlayState* play, EnGirlA* this) { s32 EnGirlA_CanBuy_GoronTunic(PlayState* play, EnGirlA* this) {
if (LINK_AGE_IN_YEARS == YEARS_CHILD && (!gSaveContext.n64ddFlag || !Randomizer_GetSettingValue(RSK_SHOPSANITY))) { if (LINK_AGE_IN_YEARS == YEARS_CHILD &&
(!gSaveContext.n64ddFlag || Randomizer_GetSettingValue(RSK_SHOPSANITY) == RO_SHOPSANITY_OFF)) {
return CANBUY_RESULT_CANT_GET_NOW; return CANBUY_RESULT_CANT_GET_NOW;
} }
if (gBitFlags[9] & gSaveContext.inventory.equipment) { if (gBitFlags[9] & gSaveContext.inventory.equipment) {
@ -619,7 +620,8 @@ s32 EnGirlA_CanBuy_GoronTunic(PlayState* play, EnGirlA* this) {
} }
s32 EnGirlA_CanBuy_ZoraTunic(PlayState* play, EnGirlA* this) { s32 EnGirlA_CanBuy_ZoraTunic(PlayState* play, EnGirlA* this) {
if (LINK_AGE_IN_YEARS == YEARS_CHILD && (!gSaveContext.n64ddFlag || !Randomizer_GetSettingValue(RSK_SHOPSANITY))) { if (LINK_AGE_IN_YEARS == YEARS_CHILD &&
(!gSaveContext.n64ddFlag || Randomizer_GetSettingValue(RSK_SHOPSANITY) == RO_SHOPSANITY_OFF)) {
return CANBUY_RESULT_CANT_GET_NOW; return CANBUY_RESULT_CANT_GET_NOW;
} }
if (gBitFlags[10] & gSaveContext.inventory.equipment) { if (gBitFlags[10] & gSaveContext.inventory.equipment) {

View File

@ -427,7 +427,7 @@ void EnOssan_SpawnItemsOnShelves(EnOssan* this, PlayState* play, ShopItem* shopI
this->shelfSlots[i] = NULL; this->shelfSlots[i] = NULL;
} else { } else {
itemParams = sShopItemReplaceFunc[shopItems->shopItemIndex](shopItems->shopItemIndex); itemParams = sShopItemReplaceFunc[shopItems->shopItemIndex](shopItems->shopItemIndex);
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHOPSANITY)) { if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHOPSANITY) != RO_SHOPSANITY_OFF) {
ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, i); ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, i);
if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) { if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) {
itemParams = shopItemIdentity.enGirlAShopItem; itemParams = shopItemIdentity.enGirlAShopItem;
@ -447,7 +447,7 @@ void EnOssan_SpawnItemsOnShelves(EnOssan* this, PlayState* play, ShopItem* shopI
shelves->actor.world.pos.y + shopItems->yOffset, shelves->actor.world.pos.z + shopItems->zOffset, shelves->actor.world.pos.y + shopItems->yOffset, shelves->actor.world.pos.z + shopItems->zOffset,
shelves->actor.shape.rot.x, shelves->actor.shape.rot.y + sItemShelfRot[i], shelves->actor.shape.rot.x, shelves->actor.shape.rot.y + sItemShelfRot[i],
shelves->actor.shape.rot.z, itemParams); shelves->actor.shape.rot.z, itemParams);
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHOPSANITY)) { if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHOPSANITY) != RO_SHOPSANITY_OFF) {
this->shelfSlots[i]->randoSlotIndex = i; this->shelfSlots[i]->randoSlotIndex = i;
} }
} }