Various changes from PR feedback

This commit is contained in:
Garrett Cox 2022-09-16 11:29:17 -05:00
commit 77ec3954dc
4 changed files with 17 additions and 8 deletions

View file

@ -2228,7 +2228,7 @@ ScrubIdentity Randomizer::IdentifyScrub(s32 sceneNum, s32 actorParams, s32 respa
} }
ShopItemIdentity Randomizer::IdentifyShopItem(s32 sceneNum, u8 slotIndex) { ShopItemIdentity Randomizer::IdentifyShopItem(s32 sceneNum, u8 slotIndex) {
struct ShopItemIdentity shopItemIdentity; ShopItemIdentity shopItemIdentity;
shopItemIdentity.randomizerCheck = RC_UNKNOWN_CHECK; shopItemIdentity.randomizerCheck = RC_UNKNOWN_CHECK;
shopItemIdentity.ogItemId = GI_NONE; shopItemIdentity.ogItemId = GI_NONE;
@ -4143,7 +4143,7 @@ void DrawRandoEditor(bool& open) {
"\n" "\n"
"1-4 Items - Vanilla shop items will be shuffled among different shops, and each shop will contain 1-4 non-vanilla shop items.\n" "1-4 Items - Vanilla shop items will be shuffled among different shops, and each shop will contain 1-4 non-vanilla shop items.\n"
"\n" "\n"
"Random - Vanilla shop items will be shuffled among different shops, and each shop will contain a random number of non-vanilla shop items.\n" "Random - Vanilla shop items will be shuffled among different shops, and each shop will contain a random number(1-4) of non-vanilla shop items.\n"
); );
UIWidgets::EnhancementCombobox("gRandomizeShopsanity", randoShopsanity, 7, 0); UIWidgets::EnhancementCombobox("gRandomizeShopsanity", randoShopsanity, 7, 0);

View file

@ -1339,12 +1339,14 @@ void EnItem00_CustomItemsParticles(Actor* Parent, GlobalContext* globalCtx, GetI
velocity.y = -0.05f; velocity.y = -0.05f;
accel.y = -0.025f; accel.y = -0.025f;
pos.x = Rand_CenteredFloat(32.0f) + Parent->world.pos.x; pos.x = Rand_CenteredFloat(32.0f) + Parent->world.pos.x;
pos.y = (Rand_ZeroOne() * 6.0f) + Parent->world.pos.y + 25; // Shop items are rendered at a different height than the rest, so a different y offset is required
pos.z = Rand_CenteredFloat(32.0f) + Parent->world.pos.z;
if (Parent->id == ACTOR_EN_GIRLA) { if (Parent->id == ACTOR_EN_GIRLA) {
pos.y = (Rand_ZeroOne() * 6.0f) + Parent->world.pos.y + 5; pos.y = (Rand_ZeroOne() * 6.0f) + Parent->world.pos.y + 5;
} else {
pos.y = (Rand_ZeroOne() * 6.0f) + Parent->world.pos.y + 25;
} }
pos.z = Rand_CenteredFloat(32.0f) + Parent->world.pos.z;
EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 1000, 50); EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 1000, 50);
} }

View file

@ -596,7 +596,7 @@ s32 EnGirlA_CanBuy_DekuShield(GlobalContext* globalCtx, EnGirlA* this) {
} }
s32 EnGirlA_CanBuy_GoronTunic(GlobalContext* globalCtx, EnGirlA* this) { s32 EnGirlA_CanBuy_GoronTunic(GlobalContext* globalCtx, EnGirlA* this) {
if (LINK_AGE_IN_YEARS == YEARS_CHILD && !Randomizer_GetSettingValue(RSK_SHOPSANITY)) { if (LINK_AGE_IN_YEARS == YEARS_CHILD && (!gSaveContext.n64ddFlag || !Randomizer_GetSettingValue(RSK_SHOPSANITY))) {
return CANBUY_RESULT_CANT_GET_NOW; return CANBUY_RESULT_CANT_GET_NOW;
} }
if (gBitFlags[9] & gSaveContext.inventory.equipment) { if (gBitFlags[9] & gSaveContext.inventory.equipment) {
@ -612,7 +612,7 @@ s32 EnGirlA_CanBuy_GoronTunic(GlobalContext* globalCtx, EnGirlA* this) {
} }
s32 EnGirlA_CanBuy_ZoraTunic(GlobalContext* globalCtx, EnGirlA* this) { s32 EnGirlA_CanBuy_ZoraTunic(GlobalContext* globalCtx, EnGirlA* this) {
if (LINK_AGE_IN_YEARS == YEARS_CHILD && !Randomizer_GetSettingValue(RSK_SHOPSANITY)) { if (LINK_AGE_IN_YEARS == YEARS_CHILD && (!gSaveContext.n64ddFlag || !Randomizer_GetSettingValue(RSK_SHOPSANITY))) {
return CANBUY_RESULT_CANT_GET_NOW; return CANBUY_RESULT_CANT_GET_NOW;
} }
if (gBitFlags[10] & gSaveContext.inventory.equipment) { if (gBitFlags[10] & gSaveContext.inventory.equipment) {
@ -924,6 +924,11 @@ void EnGirlA_ItemGive_Randomizer(GlobalContext* globalCtx, EnGirlA* this) {
Randomizer_Item_Give(globalCtx, getItemEntry); Randomizer_Item_Give(globalCtx, getItemEntry);
} }
// RANDOTOD: Move this into Item_Give() or some other more central location
if (getItemEntry.getItemId == GI_SWORD_BGS) {
gSaveContext.bgsFlag = true;
}
Flags_SetRandomizerInf(shopItemIdentity.randomizerInf); Flags_SetRandomizerInf(shopItemIdentity.randomizerInf);
Rupees_ChangeBy(-this->basePrice); Rupees_ChangeBy(-this->basePrice);
} }
@ -1199,7 +1204,7 @@ void EnGirlA_InitializeItemAction(EnGirlA* this, GlobalContext* globalCtx) {
this->basePrice = shopItemIdentity.itemPrice; this->basePrice = shopItemIdentity.itemPrice;
this->giDrawId = getItemEntry.gid; this->giDrawId = getItemEntry.gid;
// Dungeon reward stones are spawned with incorrect rotation // Correct the rotation for spiritual stones
if (getItemEntry.getItemId >= RG_KOKIRI_EMERALD && getItemEntry.getItemId <= RG_ZORA_SAPPHIRE) { if (getItemEntry.getItemId >= RG_KOKIRI_EMERALD && getItemEntry.getItemId <= RG_ZORA_SAPPHIRE) {
this->actor.shape.rot.y = this->actor.shape.rot.y + 20000; this->actor.shape.rot.y = this->actor.shape.rot.y + 20000;
} }

View file

@ -1347,6 +1347,7 @@ void EnOssan_GiveItemWithFanfare(GlobalContext* globalCtx, EnOssan* this) {
func_8002F434(&this->actor, globalCtx, this->shelfSlots[this->cursorIndex]->getItemId, 120.0f, 120.0f); func_8002F434(&this->actor, globalCtx, this->shelfSlots[this->cursorIndex]->getItemId, 120.0f, 120.0f);
} else { } else {
ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->cursorIndex); ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->cursorIndex);
// en_ossan/en_girla are used for happy mask shop as well, so if we don't find a valid RC check, fall back to vanilla logic
if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) { if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) {
GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId); GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId);
GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 120.0f, 120.0f); GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 120.0f, 120.0f);
@ -1692,6 +1693,7 @@ void EnOssan_State_GiveItemWithFanfare(EnOssan* this, GlobalContext* globalCtx,
func_8002F434(&this->actor, globalCtx, this->shelfSlots[this->cursorIndex]->getItemId, 120.0f, 120.0f); func_8002F434(&this->actor, globalCtx, this->shelfSlots[this->cursorIndex]->getItemId, 120.0f, 120.0f);
} else { } else {
ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->cursorIndex); ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->cursorIndex);
// en_ossan/en_girla are used for happy mask shop as well, so if we don't find a valid RC check, fall back to vanilla logic
if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) { if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) {
GetItemEntry getItemEntry = GetItemEntry getItemEntry =
Randomizer_GetItemFromKnownCheck(shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId); Randomizer_GetItemFromKnownCheck(shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId);