Uses the hash instead of seed for spoilerfile name and icons.

This commit is contained in:
Christopher Leggett 2022-09-07 21:19:16 -04:00
parent 1763eda169
commit e3d174cc9b
No known key found for this signature in database
GPG Key ID: 7093AE5FF7037D79
6 changed files with 30 additions and 24 deletions

View File

@ -542,7 +542,7 @@ std::string GenerateRandomizer(std::unordered_map<RandomizerSettingKey, uint8_t>
Settings::Keysanity.RestoreDelayedOption();
}
return "./Randomizer/" + Settings::seed + ".json";
return "./Randomizer/" + Settings::hash + ".json";
}
std::string GetInput(const char* hintText) {

View File

@ -39,6 +39,7 @@ int Playthrough_Init(uint32_t seed, std::unordered_map<RandomizerSettingKey, uin
}
unsigned int finalHash = std::hash<std::string>{}(Settings::seed + settingsStr);
Random_Init(finalHash);
Settings::hash = std::to_string(finalHash);
Logic::UpdateHelpers();

View File

@ -20,6 +20,7 @@ using namespace SFX;
namespace Settings {
std::string seed;
std::string hash;
std::string version = RANDOMIZER_VERSION "-" COMMIT_NUMBER;
std::array<uint8_t, 5> hashIconIndexes;

View File

@ -863,6 +863,7 @@ void UpdateSettings(std::unordered_map<RandomizerSettingKey, uint8_t> cvarSettin
extern std::string seed;
extern std::string version;
extern std::array<uint8_t, 5> hashIconIndexes;
extern std::string hash;
extern bool skipChildZelda;

View File

@ -40,8 +40,11 @@ static RandomizerHash randomizerHash;
static SpoilerData spoilerData;
void GenerateHash() {
for (size_t i = 0; i < Settings::hashIconIndexes.size(); i++) {
int number = Settings::seed[i] - '0';
while (Settings::hash.length() < 10) {
Settings::hash = "0" + Settings::hash;
}
for (size_t i = 0, j = 0; i < Settings::hashIconIndexes.size(); i++, j += 2) {
int number = std::stoi(Settings::hash.substr(j, 2));
Settings::hashIconIndexes[i] = number;
}
@ -740,11 +743,11 @@ const char* SpoilerLog_Write(int language) {
std::string jsonString = jsonData.dump(4);
std::ofstream jsonFile(Ship::Window::GetPathRelativeToAppDirectory(
(std::string("Randomizer/") + std::string(Settings::seed) + std::string(".json")).c_str()));
(std::string("Randomizer/") + std::string(Settings::hash) + std::string(".json")).c_str()));
jsonFile << std::setw(4) << jsonString << std::endl;
jsonFile.close();
return Settings::seed.c_str();
return Settings::hash.c_str();
}
void PlacementLog_Msg(std::string_view msg) {

View File

@ -89,23 +89,23 @@ std::array<Sprite, 100> gSeedTextures = { {
{ dgGiantsWalletIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 78 },
{ dgDekuSeedsIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 79 },
{ dgFishingPoleIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 80 },
{ dgForestMedallionIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 81 },
{ dgFireMedallionIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 82 },
{ dgWaterMedallionIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 83 },
{ dgSpiritMedallionIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 84 },
{ dgShadowMedallionIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 85 },
{ dgLightMedallionIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 86 },
{ dgKokiriEmeraldIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 87 },
{ dgGoronRubyIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 88 },
{ dgZoraSapphireIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 89 },
{ dgStoneOfAgonyIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 90 },
{ dgGerudosCardIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 91 },
{ dgGoldSkulltulaIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 92 },
{ dgHeartContainerIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 93 },
{ dgBossKeyIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 94 },
{ dgCompassIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 95 },
{ dgDungeonMapIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 96 },
{ dgSmallKeyIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 97 },
{ dgSmallMagicJarIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 98 },
{ dgBigMagicJarIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b, 99 },
{ dgForestMedallionIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 81 },
{ dgFireMedallionIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 82 },
{ dgWaterMedallionIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 83 },
{ dgSpiritMedallionIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 84 },
{ dgShadowMedallionIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 85 },
{ dgLightMedallionIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 86 },
{ dgKokiriEmeraldIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 87 },
{ dgGoronRubyIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 88 },
{ dgZoraSapphireIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 89 },
{ dgStoneOfAgonyIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 90 },
{ dgGerudosCardIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 91 },
{ dgGoldSkulltulaIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 92 },
{ dgHeartContainerIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 93 },
{ dgBossKeyIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 94 },
{ dgCompassIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 95 },
{ dgDungeonMapIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 96 },
{ dgSmallKeyIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 97 },
{ dgSmallMagicJarIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 98 },
{ dgBigMagicJarIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b, 99 },
} };