mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-23 06:02:08 -05:00
Merge pull request #1422 from garrettjoecox/scrubs-trials-persist
Add merchantPrices to save file instead of loading from active spoiler log
This commit is contained in:
commit
885d6dc6c2
@ -261,5 +261,6 @@ extern GraphicsContext* __gfxCtx;
|
|||||||
#define SEG_ADDR(seg, addr) (addr | (seg << 24) | 1)
|
#define SEG_ADDR(seg, addr) (addr | (seg << 24) | 1)
|
||||||
|
|
||||||
#define NUM_TRIALS 6
|
#define NUM_TRIALS 6
|
||||||
|
#define NUM_SCRUBS 35
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -110,7 +110,7 @@ Sprite* Randomizer::GetSeedTexture(uint8_t index) {
|
|||||||
Randomizer::~Randomizer() {
|
Randomizer::~Randomizer() {
|
||||||
this->randoSettings.clear();
|
this->randoSettings.clear();
|
||||||
this->itemLocations.clear();
|
this->itemLocations.clear();
|
||||||
this->randomizerMerchantPrices.clear();
|
this->merchantPrices.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unordered_map<std::string, RandomizerInf> spoilerFileTrialToEnum = {
|
std::unordered_map<std::string, RandomizerInf> spoilerFileTrialToEnum = {
|
||||||
@ -1206,7 +1206,7 @@ void Randomizer::ParseItemLocationsFile(const char* spoilerFileName, bool silent
|
|||||||
gSaveContext.itemLocations[index].check = SpoilerfileCheckNameToEnum[it.key()];
|
gSaveContext.itemLocations[index].check = SpoilerfileCheckNameToEnum[it.key()];
|
||||||
gSaveContext.itemLocations[index].get = SpoilerfileGetNameToEnum[itemit.value()];
|
gSaveContext.itemLocations[index].get = SpoilerfileGetNameToEnum[itemit.value()];
|
||||||
} else if (itemit.key() == "price") {
|
} else if (itemit.key() == "price") {
|
||||||
randomizerMerchantPrices[gSaveContext.itemLocations[index].check] = itemit.value();
|
merchantPrices[gSaveContext.itemLocations[index].check] = itemit.value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2417,8 +2417,8 @@ ScrubIdentity Randomizer::IdentifyScrub(s32 sceneNum, s32 actorParams, s32 respa
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (randomizerMerchantPrices.find(scrubIdentity.randomizerCheck) != randomizerMerchantPrices.end()) {
|
if (merchantPrices.find(scrubIdentity.randomizerCheck) != merchantPrices.end()) {
|
||||||
scrubIdentity.itemPrice = randomizerMerchantPrices[scrubIdentity.randomizerCheck];
|
scrubIdentity.itemPrice = merchantPrices[scrubIdentity.randomizerCheck];
|
||||||
}
|
}
|
||||||
|
|
||||||
return scrubIdentity;
|
return scrubIdentity;
|
||||||
|
@ -14,13 +14,11 @@ class Randomizer {
|
|||||||
private:
|
private:
|
||||||
std::unordered_map<RandomizerCheck, RandomizerGet> itemLocations;
|
std::unordered_map<RandomizerCheck, RandomizerGet> itemLocations;
|
||||||
std::unordered_map<RandomizerCheck, std::string> hintLocations;
|
std::unordered_map<RandomizerCheck, std::string> hintLocations;
|
||||||
std::unordered_map<RandomizerInf, bool> trialsRequired;
|
|
||||||
std::string childAltarText;
|
std::string childAltarText;
|
||||||
std::string adultAltarText;
|
std::string adultAltarText;
|
||||||
std::string ganonHintText;
|
std::string ganonHintText;
|
||||||
std::string ganonText;
|
std::string ganonText;
|
||||||
std::unordered_map<RandomizerSettingKey, u8> randoSettings;
|
std::unordered_map<RandomizerSettingKey, u8> randoSettings;
|
||||||
std::unordered_map<RandomizerCheck, u16> randomizerMerchantPrices;
|
|
||||||
void ParseRandomizerSettingsFile(const char* spoilerFileName);
|
void ParseRandomizerSettingsFile(const char* spoilerFileName);
|
||||||
void ParseHintLocationsFile(const char* spoilerFileName);
|
void ParseHintLocationsFile(const char* spoilerFileName);
|
||||||
void ParseRequiredTrialsFile(const char* spoilerFileName);
|
void ParseRequiredTrialsFile(const char* spoilerFileName);
|
||||||
@ -38,6 +36,10 @@ class Randomizer {
|
|||||||
static const std::string rupeeMessageTableID;
|
static const std::string rupeeMessageTableID;
|
||||||
static const std::string NaviRandoMessageTableID;
|
static const std::string NaviRandoMessageTableID;
|
||||||
|
|
||||||
|
// Public for now to be accessed by SaveManager, will be made private again soon :tm:
|
||||||
|
std::unordered_map<RandomizerInf, bool> trialsRequired;
|
||||||
|
std::unordered_map<RandomizerCheck, u16> merchantPrices;
|
||||||
|
|
||||||
static Sprite* GetSeedTexture(uint8_t index);
|
static Sprite* GetSeedTexture(uint8_t index);
|
||||||
s16 GetItemModelFromId(s16 itemId);
|
s16 GetItemModelFromId(s16 itemId);
|
||||||
s32 GetItemIDFromGetItemID(s32 getItemId);
|
s32 GetItemIDFromGetItemID(s32 getItemId);
|
||||||
|
@ -91,6 +91,18 @@ void SaveManager::LoadRandomizerVersion1() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SaveManager::Instance->LoadData("adultTradeItems", gSaveContext.adultTradeItems);
|
SaveManager::Instance->LoadData("adultTradeItems", gSaveContext.adultTradeItems);
|
||||||
|
|
||||||
|
std::shared_ptr<Randomizer> randomizer = OTRGlobals::Instance->gRandomizer;
|
||||||
|
|
||||||
|
SaveManager::Instance->LoadArray("merchantPrices", NUM_SCRUBS, [&](size_t i) {
|
||||||
|
SaveManager::Instance->LoadStruct("", [&]() {
|
||||||
|
RandomizerCheck rc;
|
||||||
|
SaveManager::Instance->LoadData("check", rc);
|
||||||
|
uint32_t price;
|
||||||
|
SaveManager::Instance->LoadData("price", price);
|
||||||
|
randomizer->merchantPrices[rc] = price;
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveManager::SaveRandomizer() {
|
void SaveManager::SaveRandomizer() {
|
||||||
@ -135,6 +147,20 @@ void SaveManager::SaveRandomizer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SaveManager::Instance->SaveData("adultTradeItems", gSaveContext.adultTradeItems);
|
SaveManager::Instance->SaveData("adultTradeItems", gSaveContext.adultTradeItems);
|
||||||
|
|
||||||
|
std::shared_ptr<Randomizer> randomizer = OTRGlobals::Instance->gRandomizer;
|
||||||
|
|
||||||
|
std::vector<std::pair<RandomizerCheck, u16>> merchantPrices;
|
||||||
|
for (const auto & [ check, price ] : randomizer->merchantPrices) {
|
||||||
|
merchantPrices.push_back(std::make_pair(check, price));
|
||||||
|
}
|
||||||
|
|
||||||
|
SaveManager::Instance->SaveArray("merchantPrices", NUM_SCRUBS, [&](size_t i) {
|
||||||
|
SaveManager::Instance->SaveStruct("", [&]() {
|
||||||
|
SaveManager::Instance->SaveData("check", merchantPrices[i].first);
|
||||||
|
SaveManager::Instance->SaveData("price", merchantPrices[i].second);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveManager::Init() {
|
void SaveManager::Init() {
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
#define NUM_DUNGEONS 8
|
#define NUM_DUNGEONS 8
|
||||||
#define NUM_COWS 10
|
#define NUM_COWS 10
|
||||||
#define NUM_SCRUBS 35
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize new save.
|
* Initialize new save.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user