diff --git a/Z3DR b/Z3DR index bc4e460..c283bf9 160000 --- a/Z3DR +++ b/Z3DR @@ -1 +1 @@ -Subproject commit bc4e460064f4b6a462d4df5780097f86cbb1689b +Subproject commit c283bf93116dcd4845bb7f6ae056e2f27c183518 diff --git a/source/spoiler_log.cpp b/source/spoiler_log.cpp index 83198d1..cbd31a7 100644 --- a/source/spoiler_log.cpp +++ b/source/spoiler_log.cpp @@ -360,33 +360,41 @@ static void WriteIngameSpoilerLog() { spoilerData.ItemLocationsCount = spoilerTotalItems; if (Settings::IngameSpoilers) { - bool playthroughItemNotFound = false; // Write playthrough data to in-game spoiler log if (!spoilerOutOfSpace) { - for (u32 i = 0; i < playthroughLocations.size(); i++) { - if (i >= SPOILER_SPHERES_MAX) { + // Locations hidden from the item list above (vanilla tokens and stray fairies, alternate + // checks, ...) can still be in the playthrough. Leave them out here too; a sphere made only + // of hidden locations is dropped rather than shown empty. + u32 sphere = 0; + for (const std::vector& sphereLocations : playthroughLocations) { + if (sphere >= SPOILER_SPHERES_MAX) { spoilerOutOfSpace = true; break; } - spoilerData.Spheres[i].ItemLocationsOffset = spoilerSphereItemoffset; - for (u32 loc = 0; loc < playthroughLocations[i].size(); ++loc) { + spoilerData.Spheres[sphere].ItemLocationsOffset = spoilerSphereItemoffset; + spoilerData.Spheres[sphere].ItemCount = 0; + for (const LocationKey key : sphereLocations) { if (spoilerSphereItemoffset >= SPOILER_ITEMS_MAX) { spoilerOutOfSpace = true; break; } - const auto foundItemLoc = itemLocationsMap.find(playthroughLocations[i][loc]); + const auto foundItemLoc = itemLocationsMap.find(key); if (foundItemLoc != itemLocationsMap.end()) { spoilerData.SphereItemLocations[spoilerSphereItemoffset++] = foundItemLoc->second; - } else { - playthroughItemNotFound = true; + ++spoilerData.Spheres[sphere].ItemCount; } - ++spoilerData.Spheres[i].ItemCount; } - ++spoilerData.SphereCount; + if (spoilerData.Spheres[sphere].ItemCount > 0) { + ++sphere; + } + if (spoilerOutOfSpace) { + break; + } } + spoilerData.SphereCount = sphere; } - if (spoilerOutOfSpace || playthroughItemNotFound) { + if (spoilerOutOfSpace) { printf("%sError!%s ", YELLOW, WHITE); } }