mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-14 21:45:16 -05:00
Fix repeatable purchases and bottles rendering incorrectly
This commit is contained in:
parent
d1dac2a2ee
commit
25ed66439e
@ -684,7 +684,7 @@ static void WriteAllLocations(int language) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Eventually check for other things here like fake name
|
// Eventually check for other things here like fake name
|
||||||
if (location->HasScrubsanityPrice() || location->HasShopsanityPrice() || location->GetPrice() > 0) {
|
if (location->HasScrubsanityPrice() || location->HasShopsanityPrice()) {
|
||||||
jsonData["locations"][location->GetName()]["item"] = placedItemName;
|
jsonData["locations"][location->GetName()]["item"] = placedItemName;
|
||||||
jsonData["locations"][location->GetName()]["price"] = location->GetPrice();
|
jsonData["locations"][location->GetName()]["price"] = location->GetPrice();
|
||||||
} else {
|
} else {
|
||||||
|
@ -751,6 +751,39 @@ std::vector<RandomizerCheck> shopItemRandomizerChecks = {
|
|||||||
RC_MARKET_BOMBCHU_SHOP_ITEM_8,
|
RC_MARKET_BOMBCHU_SHOP_ITEM_8,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Reference soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.h
|
||||||
|
std::unordered_map<RandomizerGet, int32_t> randomizerGetToEnGirlShopItem = {
|
||||||
|
{ RG_BUY_DEKU_NUT_5, 0x00 },
|
||||||
|
{ RG_BUY_ARROWS_30, 0x01 },
|
||||||
|
{ RG_BUY_ARROWS_50, 0x02 },
|
||||||
|
{ RG_BUY_BOMBS_525, 0x03 },
|
||||||
|
{ RG_BUY_DEKU_NUT_10, 0x04 },
|
||||||
|
{ RG_BUY_DEKU_STICK_1, 0x05 },
|
||||||
|
{ RG_BUY_BOMBS_10, 0x06 },
|
||||||
|
{ RG_BUY_FISH, 0x07 },
|
||||||
|
{ RG_BUY_RED_POTION_30, 0x08 },
|
||||||
|
{ RG_BUY_GREEN_POTION, 0x09 },
|
||||||
|
{ RG_BUY_BLUE_POTION, 0x0A },
|
||||||
|
{ RG_BUY_HYLIAN_SHIELD, 0x0C },
|
||||||
|
{ RG_BUY_DEKU_SHIELD, 0x0D },
|
||||||
|
{ RG_BUY_GORON_TUNIC, 0x0E },
|
||||||
|
{ RG_BUY_ZORA_TUNIC, 0x0F },
|
||||||
|
{ RG_BUY_HEART, 0x10 },
|
||||||
|
{ RG_BUY_BOMBCHU_10, 0x15 },
|
||||||
|
{ RG_BUY_BOMBCHU_20, 0x16 },
|
||||||
|
{ RG_BUY_DEKU_SEEDS_30, 0x1D },
|
||||||
|
{ RG_BUY_BLUE_FIRE, 0x27 },
|
||||||
|
{ RG_BUY_BOTTLE_BUG, 0x28 },
|
||||||
|
{ RG_BUY_POE, 0x2A },
|
||||||
|
{ RG_BUY_FAIRYS_SPIRIT, 0x2B },
|
||||||
|
{ RG_BUY_ARROWS_10, 0x2C },
|
||||||
|
{ RG_BUY_BOMBS_20, 0x2D },
|
||||||
|
{ RG_BUY_BOMBS_30, 0x2E },
|
||||||
|
{ RG_BUY_BOMBS_535, 0x2F },
|
||||||
|
{ RG_BUY_RED_POTION_40, 0x30 },
|
||||||
|
{ RG_BUY_RED_POTION_50, 0x31 },
|
||||||
|
};
|
||||||
|
|
||||||
void Randomizer::LoadShopMessages(const char* spoilerFileName) {
|
void Randomizer::LoadShopMessages(const char* spoilerFileName) {
|
||||||
if (strcmp(spoilerFileName, "") != 0) {
|
if (strcmp(spoilerFileName, "") != 0) {
|
||||||
ParseHintLocationsFile(spoilerFileName);
|
ParseHintLocationsFile(spoilerFileName);
|
||||||
@ -2512,7 +2545,7 @@ ShopItemIdentity Randomizer::IdentifyShopItem(s32 sceneNum, s32 actorParams) {
|
|||||||
shopItemIdentity.randomizerCheck = RC_UNKNOWN_CHECK;
|
shopItemIdentity.randomizerCheck = RC_UNKNOWN_CHECK;
|
||||||
shopItemIdentity.ogItemId = GI_NONE;
|
shopItemIdentity.ogItemId = GI_NONE;
|
||||||
shopItemIdentity.itemPrice = -1;
|
shopItemIdentity.itemPrice = -1;
|
||||||
shopItemIdentity.isShuffled = GetRandoSettingValue(RSK_SHOPSANITY) > 0;
|
shopItemIdentity.enGirlAShopItem = -1;
|
||||||
|
|
||||||
switch (sceneNum) {
|
switch (sceneNum) {
|
||||||
case SCENE_SHOP1:
|
case SCENE_SHOP1:
|
||||||
@ -2871,6 +2904,10 @@ ShopItemIdentity Randomizer::IdentifyShopItem(s32 sceneNum, s32 actorParams) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (randomizerGetToEnGirlShopItem.find(GetRandomizerGetFromKnownCheck(shopItemIdentity.randomizerCheck)) != randomizerGetToEnGirlShopItem.end()) {
|
||||||
|
shopItemIdentity.enGirlAShopItem = randomizerGetToEnGirlShopItem[GetRandomizerGetFromKnownCheck(shopItemIdentity.randomizerCheck)];
|
||||||
|
}
|
||||||
|
|
||||||
if (randomizerMerchantPrices.find(shopItemIdentity.randomizerCheck) != randomizerMerchantPrices.end()) {
|
if (randomizerMerchantPrices.find(shopItemIdentity.randomizerCheck) != randomizerMerchantPrices.end()) {
|
||||||
shopItemIdentity.itemPrice = randomizerMerchantPrices[shopItemIdentity.randomizerCheck];
|
shopItemIdentity.itemPrice = randomizerMerchantPrices[shopItemIdentity.randomizerCheck];
|
||||||
}
|
}
|
||||||
|
@ -1042,6 +1042,6 @@ typedef struct ShopItemIdentity {
|
|||||||
RandomizerInf randomizerInf;
|
RandomizerInf randomizerInf;
|
||||||
RandomizerCheck randomizerCheck;
|
RandomizerCheck randomizerCheck;
|
||||||
GetItemID ogItemId;
|
GetItemID ogItemId;
|
||||||
|
int32_t enGirlAShopItem;
|
||||||
int32_t itemPrice;
|
int32_t itemPrice;
|
||||||
bool isShuffled;
|
|
||||||
} ShopItemIdentity;
|
} ShopItemIdentity;
|
||||||
|
@ -392,16 +392,21 @@ void EnGirlA_InitItem(EnGirlA* this, GlobalContext* globalCtx) {
|
|||||||
this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, shopItemEntries[params].objID);
|
this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, shopItemEntries[params].objID);
|
||||||
} else {
|
} else {
|
||||||
ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->actor.params);
|
ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->actor.params);
|
||||||
if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) {
|
s16 objectId = shopItemEntries[params].objID;
|
||||||
GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck(shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId);
|
|
||||||
|
|
||||||
if (Object_IsLoaded(&globalCtx->objectCtx, getItemEntry.objectId)) {
|
if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) {
|
||||||
this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, getItemEntry.objectId);
|
if (shopItemIdentity.enGirlAShopItem == -1) {
|
||||||
|
GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck(shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId);
|
||||||
|
objectId = getItemEntry.objectId;
|
||||||
} else {
|
} else {
|
||||||
this->objBankIndex = Object_Spawn(&globalCtx->objectCtx, getItemEntry.objectId);
|
objectId = shopItemEntries[shopItemIdentity.enGirlAShopItem].objID;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Object_IsLoaded(&globalCtx->objectCtx, objectId)) {
|
||||||
|
this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, objectId);
|
||||||
} else {
|
} else {
|
||||||
this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, shopItemEntries[params].objID);
|
this->objBankIndex = Object_Spawn(&globalCtx->objectCtx, objectId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1023,7 +1028,11 @@ void EnGirlA_SetItemDescription(GlobalContext* globalCtx, EnGirlA* this) {
|
|||||||
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHOPSANITY)) {
|
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHOPSANITY)) {
|
||||||
ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->actor.params);
|
ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->actor.params);
|
||||||
if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) {
|
if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) {
|
||||||
|
if (shopItemIdentity.enGirlAShopItem == -1) {
|
||||||
this->actor.textId = 0x9100 + (shopItemIdentity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1);
|
this->actor.textId = 0x9100 + (shopItemIdentity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1);
|
||||||
|
} else {
|
||||||
|
this->actor.textId = &shopItemEntries[shopItemIdentity.enGirlAShopItem].itemDescTextId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1049,7 +1058,11 @@ void EnGirlA_UpdateStockedItem(GlobalContext* globalCtx, EnGirlA* this) {
|
|||||||
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHOPSANITY)) {
|
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHOPSANITY)) {
|
||||||
ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->actor.params);
|
ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->actor.params);
|
||||||
if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) {
|
if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) {
|
||||||
|
if (shopItemIdentity.enGirlAShopItem == -1) {
|
||||||
itemEntry->itemDescTextId = 0x9100 + (shopItemIdentity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1);
|
itemEntry->itemDescTextId = 0x9100 + (shopItemIdentity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1);
|
||||||
|
} else {
|
||||||
|
itemEntry->itemDescTextId = &shopItemEntries[shopItemIdentity.enGirlAShopItem].itemDescTextId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1079,23 +1092,6 @@ void EnGirlA_InitializeItemAction(EnGirlA* this, GlobalContext* globalCtx) {
|
|||||||
s16 params = this->actor.params;
|
s16 params = this->actor.params;
|
||||||
ShopItemEntry* itemEntry = &shopItemEntries[params];
|
ShopItemEntry* itemEntry = &shopItemEntries[params];
|
||||||
|
|
||||||
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHOPSANITY)) {
|
|
||||||
ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->actor.params);
|
|
||||||
if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) {
|
|
||||||
GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck(shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId);
|
|
||||||
itemEntry->objID = getItemEntry.objectId;
|
|
||||||
itemEntry->giDrawId = getItemEntry.gid;
|
|
||||||
itemEntry->getItemId = getItemEntry.getItemId;
|
|
||||||
itemEntry->count = 1;
|
|
||||||
itemEntry->price = shopItemIdentity.itemPrice;
|
|
||||||
itemEntry->itemDescTextId = 0x9100 + (shopItemIdentity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1);
|
|
||||||
itemEntry->itemBuyPromptTextId = 0x9100 + ((shopItemIdentity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1) + NUM_SHOP_ITEMS);
|
|
||||||
itemEntry->canBuyFunc = EnGirlA_CanBuy_Randomizer;
|
|
||||||
itemEntry->itemGiveFunc = EnGirlA_ItemGive_Randomizer;
|
|
||||||
itemEntry->buyEventFunc = EnGirlA_BuyEvent_Randomizer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) {
|
if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) {
|
||||||
this->actor.flags &= ~ACTOR_FLAG_4;
|
this->actor.flags &= ~ACTOR_FLAG_4;
|
||||||
this->actor.objBankIndex = this->objBankIndex;
|
this->actor.objBankIndex = this->objBankIndex;
|
||||||
@ -1191,6 +1187,35 @@ void EnGirlA_InitializeItemAction(EnGirlA* this, GlobalContext* globalCtx) {
|
|||||||
this->isSelected = false;
|
this->isSelected = false;
|
||||||
this->yRotation = 0;
|
this->yRotation = 0;
|
||||||
this->yRotationInit = this->actor.shape.rot.y;
|
this->yRotationInit = this->actor.shape.rot.y;
|
||||||
|
|
||||||
|
// TODO: This is pretty verbose, pointers are making this difficult
|
||||||
|
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHOPSANITY)) {
|
||||||
|
ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->actor.params);
|
||||||
|
if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) {
|
||||||
|
if (shopItemIdentity.enGirlAShopItem == -1) {
|
||||||
|
GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck(shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId);
|
||||||
|
this->actor.textId = 0x9100 + (shopItemIdentity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1);
|
||||||
|
this->itemBuyPromptTextId = 0x9100 + ((shopItemIdentity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1) + NUM_SHOP_ITEMS);
|
||||||
|
this->getItemId = getItemEntry.getItemId;
|
||||||
|
this->canBuyFunc = EnGirlA_CanBuy_Randomizer;
|
||||||
|
this->itemGiveFunc = EnGirlA_ItemGive_Randomizer;
|
||||||
|
this->buyEventFunc = EnGirlA_BuyEvent_Randomizer;
|
||||||
|
this->basePrice = shopItemIdentity.itemPrice;
|
||||||
|
this->itemCount = 1;
|
||||||
|
this->giDrawId = getItemEntry.gid;
|
||||||
|
} else {
|
||||||
|
this->actor.textId = (&shopItemEntries[shopItemIdentity.enGirlAShopItem])->itemDescTextId;
|
||||||
|
this->itemBuyPromptTextId = (&shopItemEntries[shopItemIdentity.enGirlAShopItem])->itemBuyPromptTextId;
|
||||||
|
this->getItemId = (&shopItemEntries[shopItemIdentity.enGirlAShopItem])->getItemId;
|
||||||
|
this->canBuyFunc = (&shopItemEntries[shopItemIdentity.enGirlAShopItem])->canBuyFunc;
|
||||||
|
this->itemGiveFunc = (&shopItemEntries[shopItemIdentity.enGirlAShopItem])->itemGiveFunc;
|
||||||
|
this->buyEventFunc = (&shopItemEntries[shopItemIdentity.enGirlAShopItem])->buyEventFunc;
|
||||||
|
this->basePrice = (&shopItemEntries[shopItemIdentity.enGirlAShopItem])->price;
|
||||||
|
this->itemCount = (&shopItemEntries[shopItemIdentity.enGirlAShopItem])->count;
|
||||||
|
this->giDrawId = (&shopItemEntries[shopItemIdentity.enGirlAShopItem])->giDrawId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user